reorder and extend pre-commit hooks
This change mainly just reorders the hooks to be easier ot read and hopefully slightly more efficent to run locally. a number of extra useful hooks are added such as the detect-private-key hook and the check-shebang-scripts-are-executable Thise were already available before but disabled. finally the check-docstring-first is added and the relevent module docs strings moved if required. Change-Id: I19a9e2adc9a029f4fbb819af1f128b874a5907e9
This commit is contained in:
@@ -3,41 +3,61 @@ repos:
|
|||||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||||
rev: v5.0.0
|
rev: v5.0.0
|
||||||
hooks:
|
hooks:
|
||||||
|
# whitespace
|
||||||
- id: trailing-whitespace
|
- id: trailing-whitespace
|
||||||
- id: mixed-line-ending
|
- id: mixed-line-ending
|
||||||
args: ['--fix', 'lf']
|
args: ['--fix', 'lf']
|
||||||
exclude: '.*\.(svg)$'
|
exclude: '.*\.(svg)$'
|
||||||
|
# file format and permissions
|
||||||
- id: fix-byte-order-marker
|
- id: fix-byte-order-marker
|
||||||
- id: check-executables-have-shebangs
|
- id: check-executables-have-shebangs
|
||||||
- id: check-merge-conflict
|
- id: check-shebang-scripts-are-executable
|
||||||
- id: debug-statements
|
|
||||||
# nova/cmd/manage.py imports pdb on purpose.
|
|
||||||
exclude: 'nova/cmd/manage.py'
|
|
||||||
- id: check-json
|
- id: check-json
|
||||||
files: .*\.json$
|
files: .*\.json$
|
||||||
- id: check-yaml
|
- id: check-yaml
|
||||||
files: .*\.(yaml|yml)$
|
files: .*\.(yaml|yml)$
|
||||||
|
# git
|
||||||
|
- id: check-added-large-files
|
||||||
|
- id: check-merge-conflict
|
||||||
|
- id: check-case-conflict
|
||||||
|
- id: detect-private-key
|
||||||
|
exclude: '^doc/api_samples/.*|^nova/tests/.*'
|
||||||
|
# python
|
||||||
|
- id: debug-statements
|
||||||
|
# nova/cmd/manage.py imports pdb on purpose.
|
||||||
|
exclude: 'nova/cmd/manage.py'
|
||||||
|
- id: check-docstring-first
|
||||||
|
exclude: 'nova/virt/ironic/ironic_states.py'
|
||||||
|
|
||||||
- repo: https://github.com/Lucas-C/pre-commit-hooks
|
- repo: https://github.com/Lucas-C/pre-commit-hooks
|
||||||
rev: v1.5.5
|
rev: v1.5.5
|
||||||
hooks:
|
hooks:
|
||||||
- id: remove-tabs
|
- id: remove-tabs
|
||||||
exclude: '.*\.(svg)$'
|
exclude: '.*\.(svg)$'
|
||||||
|
|
||||||
|
- repo: https://github.com/hhatto/autopep8
|
||||||
|
rev: v2.3.2
|
||||||
|
hooks:
|
||||||
|
- id: autopep8
|
||||||
|
files: '^.*\.py$'
|
||||||
|
|
||||||
|
# run hacking after autopep8 so that if it can fix
|
||||||
|
# it it will. note it will still fail in ci because
|
||||||
|
# fixing an issue changes the code and that should
|
||||||
|
# not happen in ci.
|
||||||
- repo: https://opendev.org/openstack/hacking
|
- repo: https://opendev.org/openstack/hacking
|
||||||
rev: 7.0.0
|
rev: 7.0.0
|
||||||
hooks:
|
hooks:
|
||||||
- id: hacking
|
- id: hacking
|
||||||
additional_dependencies: []
|
additional_dependencies: []
|
||||||
exclude: '^(doc|releasenotes|tools)/.*$'
|
exclude: '^(doc|releasenotes|tools)/.*$'
|
||||||
- repo: https://github.com/hhatto/autopep8
|
|
||||||
rev: v2.3.2
|
|
||||||
hooks:
|
|
||||||
- id: autopep8
|
|
||||||
files: '^.*\.py$'
|
|
||||||
- repo: https://github.com/codespell-project/codespell
|
- repo: https://github.com/codespell-project/codespell
|
||||||
rev: v2.4.1
|
rev: v2.4.1
|
||||||
hooks:
|
hooks:
|
||||||
- id: codespell
|
- id: codespell
|
||||||
args: ['--ignore-words=doc/dictionary.txt']
|
args: ['--ignore-words=doc/dictionary.txt']
|
||||||
|
|
||||||
- repo: https://github.com/pre-commit/mirrors-mypy
|
- repo: https://github.com/pre-commit/mirrors-mypy
|
||||||
rev: v1.15.0
|
rev: v1.15.0
|
||||||
hooks:
|
hooks:
|
||||||
@@ -72,6 +92,7 @@ repos:
|
|||||||
| nova/virt/libvirt/host.py
|
| nova/virt/libvirt/host.py
|
||||||
| nova/virt/libvirt/utils.py
|
| nova/virt/libvirt/utils.py
|
||||||
)
|
)
|
||||||
|
|
||||||
- repo: https://github.com/sphinx-contrib/sphinx-lint
|
- repo: https://github.com/sphinx-contrib/sphinx-lint
|
||||||
rev: v1.0.0
|
rev: v1.0.0
|
||||||
hooks:
|
hooks:
|
||||||
|
@@ -12,17 +12,6 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
from oslo_log import log as logging
|
|
||||||
|
|
||||||
from keystoneauth1 import exceptions as ks_exc
|
|
||||||
|
|
||||||
from nova import exception
|
|
||||||
from nova.i18n import _
|
|
||||||
from nova import objects
|
|
||||||
from nova.scheduler import utils as schedutils
|
|
||||||
from nova import service_auth
|
|
||||||
from nova import utils
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Note on object relationships:
|
Note on object relationships:
|
||||||
1 device profile (DP) has D >= 1 request groups (just as a flavor
|
1 device profile (DP) has D >= 1 request groups (just as a flavor
|
||||||
@@ -52,6 +41,17 @@ from nova import utils
|
|||||||
See cyborg/cyborg/objects/device_profile.py for more details.
|
See cyborg/cyborg/objects/device_profile.py for more details.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
from oslo_log import log as logging
|
||||||
|
|
||||||
|
from keystoneauth1 import exceptions as ks_exc
|
||||||
|
|
||||||
|
from nova import exception
|
||||||
|
from nova.i18n import _
|
||||||
|
from nova import objects
|
||||||
|
from nova.scheduler import utils as schedutils
|
||||||
|
from nova import service_auth
|
||||||
|
from nova import utils
|
||||||
|
|
||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
@@ -13,13 +13,6 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
from unittest import mock
|
|
||||||
|
|
||||||
import fixtures as fx
|
|
||||||
import testtools
|
|
||||||
|
|
||||||
from nova.tests import fixtures
|
|
||||||
|
|
||||||
"""Test request logging middleware under various conditions.
|
"""Test request logging middleware under various conditions.
|
||||||
|
|
||||||
The request logging middleware is needed when running under something
|
The request logging middleware is needed when running under something
|
||||||
@@ -33,6 +26,13 @@ All these tests use GET / to hit an endpoint that doesn't require the
|
|||||||
database setup. We have to do a bit of mocking to make that work.
|
database setup. We have to do a bit of mocking to make that work.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
from unittest import mock
|
||||||
|
|
||||||
|
import fixtures as fx
|
||||||
|
import testtools
|
||||||
|
|
||||||
|
from nova.tests import fixtures
|
||||||
|
|
||||||
|
|
||||||
class TestRequestLogMiddleware(testtools.TestCase):
|
class TestRequestLogMiddleware(testtools.TestCase):
|
||||||
|
|
||||||
|
0
nova/tests/unit/ssl_cert/new_cert.sh
Normal file → Executable file
0
nova/tests/unit/ssl_cert/new_cert.sh
Normal file → Executable file
Reference in New Issue
Block a user