Codebase list python-castellan / b719a5b
Adding pre-commit Introduced changes: - pre-commit config and rules - Add pre-commit to pep8 gate, Flake8 is covered in the pre-commit hooks. - Applying fixes for pre-commit compliance in all code. Also commit hash will be used instead of version tags in pre-commit to prevend arbitrary code from running in developer's machines. pre-commit will be used to: - trailing whitespace; - Replaces or checks mixed line ending (mixed-line-ending); - Forbid files which have a UTF-8 byte-order marker (check-byte-order-marker); - Checks that non-binary executables have a proper shebang (check-executables-have-shebangs); - Check for files that contain merge conflict strings (check-merge-conflict); - Check for debugger imports and py37+ breakpoint() calls in python source (debug-statements); - Attempts to load all yaml files to verify syntax (check-yaml); - Run flake8 checks (flake8) (local) For further details about tests please refer to: https://github.com/pre-commit/pre-commit-hooks Change-Id: I35e092c472e5d564ebc9bb6c2a4f6d40b54ff120 Signed-off-by: Moisés Guimarães de Medeiros <moguimar@redhat.com> Hervé Beraud authored 3 years ago Moisés Guimarães committed 3 years ago
4 changed file(s) with 40 addition(s) and 5 deletion(s). Raw diff Collapse all Expand all
0 # We from the Oslo project decided to pin repos based on the
1 # commit hash instead of the version tag to prevend arbitrary
2 # code from running in developer's machines. To update to a
3 # newer version, run `pre-commit autoupdate` and then replace
4 # the newer versions with their commit hash.
5
6 default_language_version:
7 python: python3
8
9 repos:
10 - repo: https://github.com/pre-commit/pre-commit-hooks
11 rev: ebc15addedad713c86ef18ae9632c88e187dd0af # v3.1.0
12 hooks:
13 - id: trailing-whitespace
14 # Replaces or checks mixed line ending
15 - id: mixed-line-ending
16 args: ['--fix', 'lf']
17 exclude: '.*\.(svg)$'
18 # Forbid files which have a UTF-8 byte-order marker
19 - id: check-byte-order-marker
20 # Checks that non-binary executables have a proper shebang
21 - id: check-executables-have-shebangs
22 # Check for files that contain merge conflict strings.
23 - id: check-merge-conflict
24 # Check for debugger imports and py37+ breakpoint()
25 # calls in python source
26 - id: debug-statements
27 - id: check-yaml
28 files: .*\.(yaml|yml)$
29 - repo: https://gitlab.com/pycqa/flake8
30 rev: 181bb46098dddf7e2d45319ea654b4b4d58c2840 # 3.8.3
31 hooks:
32 - id: flake8
33 additional_dependencies:
34 - hacking>=3.0.1,<3.1.0
0 # Copyright (C) 2020 Red Hat, Inc.
1 #
02 # Licensed under the Apache License, Version 2.0 (the "License");
13 # you may not use this file except in compliance with the License.
24 # You may obtain a copy of the License at
2022 # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
2123 extensions = [
2224 'sphinx.ext.autodoc',
23 #'sphinx.ext.intersphinx',
2425 'openstackdocstheme',
2526 'sphinxcontrib.rsvgconverter',
2627 ]
8081
8182 latex_use_xindy = False
8283
83 # Example configuration for intersphinx: refer to the Python standard library.
84 #intersphinx_mapping = {'https://docs.python.org/3/': None}
85
8684 # -- Options for openstackdocstheme -------------------------------------------
8785 openstackdocs_repo_name = 'openstack/castellan'
8886 openstackdocs_pdf_link = True
1616 testtools>=2.2.0 # MIT
1717 bandit>=1.1.0,<1.6.0 # Apache-2.0
1818 pifpaf>=0.10.0 # Apache-2.0
19
20 pre-commit>=2.6.0 # MIT
1717
1818 [testenv:pep8]
1919 commands =
20 flake8
20 pre-commit run -a
2121 bandit -r castellan -x tests -s B105,B106,B107,B607
2222
2323 [testenv:bandit]