From 430bebe376ee76e8b7d0a8cae1e7d65b35816234 Mon Sep 17 00:00:00 2001 From: Artem Goncharov Date: Thu, 11 Jul 2024 17:03:28 +0200 Subject: [PATCH] Add pre-commit As a starting point for the code renovation it makes sense to add pre-commit with the same configuration as we spread across the other services. For now comment out hooks that fail and address them one by one. At the end of the series we would have pre-commit executing all the necessary checks (linting, flake, black, mypy, etc) and it will be invoked directly in the `tox -e pep8` to unify all the processing. We are going to re-format source code with `black` adding revisions to git blame ignore to reduce amount of noise. This will help us to have reasonable formatting of the code with possibility to just auto-format the code. Change-Id: Ia00f4209cde8f64828dc2d827d49bfc4bd6c1efa --- .pre-commit-config.yaml | 46 +++++++++++++++++++ doc/source/admin/external-authentication.rst | 2 +- doc/source/admin/oauth2-usage-guide.rst | 2 +- .../notes/bug-1794376-53ce14528f00f01d.yaml | 2 +- 4 files changed, 49 insertions(+), 3 deletions(-) create mode 100644 .pre-commit-config.yaml diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000000..0789a0e945 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,46 @@ +--- +default_language_version: + # force all unspecified python hooks to run python3 + python: python3 +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.6.0 + hooks: + - id: trailing-whitespace + - id: mixed-line-ending + args: ['--fix', 'lf'] + exclude: '.*\.(svg)$' + - id: check-byte-order-marker + - id: check-executables-have-shebangs + - id: check-merge-conflict + - id: debug-statements + - id: check-yaml + files: .*\.(yaml|yml)$ + exclude: '^zuul.d/.*$' + # TODO(gtema): Uncomment once content is fixed + # - repo: https://github.com/PyCQA/doc8 + # rev: v1.1.1 + # hooks: + # - id: doc8 + # - repo: https://github.com/asottile/pyupgrade + # rev: v3.15.2 + # hooks: + # - id: pyupgrade + # args: ['--py38-plus'] + # TODO(gtema): Uncomment it once all files are blackified + # - repo: https://github.com/psf/black + # rev: 24.4.0 + # hooks: + # - id: black + # args: ['-S', '-l', '79'] + # - repo: https://opendev.org/openstack/hacking + # rev: 6.1.0 + # hooks: + # - id: hacking + # additional_dependencies: + # - flake8-import-order~=0.18.2 + # exclude: '^(doc|releasenotes|tools)/.*$' + # - repo: https://github.com/pre-commit/mirrors-mypy + # rev: v1.9.0 + # hooks: + # - id: mypy diff --git a/doc/source/admin/external-authentication.rst b/doc/source/admin/external-authentication.rst index e801f9cd60..da1ffdb78e 100644 --- a/doc/source/admin/external-authentication.rst +++ b/doc/source/admin/external-authentication.rst @@ -4,7 +4,7 @@ Using external authentication with Keystone When Keystone is executed in a web server like Apache HTTPD, it is possible to have the web server also handle authentication. -This enables support for additional methods of authentication that +This enables support for additional methods of authentication that are not provided by the identity store backend and the authentication plugins that Keystone supports. diff --git a/doc/source/admin/oauth2-usage-guide.rst b/doc/source/admin/oauth2-usage-guide.rst index 14a2b8f521..c9797505e0 100644 --- a/doc/source/admin/oauth2-usage-guide.rst +++ b/doc/source/admin/oauth2-usage-guide.rst @@ -23,7 +23,7 @@ Grant by the following steps in this guide. In this example, .. _application credentials: https://docs.openstack.org/api-ref/identity/v3/index.html#application-credentials .. _`Identity API reference`: https://docs.openstack.org/api-ref/identity/v3/index.html#os-oauth2-api -.. warning:: +.. warning:: It is strongly recommended that HTTPS be enabled in Keystone when using OAuth2.0 Client Credentials. See :doc:`./configure-https` for details. diff --git a/releasenotes/notes/bug-1794376-53ce14528f00f01d.yaml b/releasenotes/notes/bug-1794376-53ce14528f00f01d.yaml index cf342c0e84..72048c32fa 100644 --- a/releasenotes/notes/bug-1794376-53ce14528f00f01d.yaml +++ b/releasenotes/notes/bug-1794376-53ce14528f00f01d.yaml @@ -16,7 +16,7 @@ deprecations: [`bug 1794376 `_] The following domain policy check strings have been deprecated in favor of more clear and concise defaults: - + * ``identity:get_domain`` * ``identity:list_domains`` * ``identity:create_domain``