* Update hacking from branch 'master'
to 977ee0353404552e1c71f6175cdc818b69960c1c
- Drop tox target for python 3.5
... because the minimum version currently supported is 3.8.
Change-Id: Iebae234e47a3d04c0587d447f5672c683fbb04e0
* Update hacking from branch 'master'
to 86e3688c66ac94e4469a3eea1edf39c18f975ed7
- Merge "Bump flake8-docstrings version"
- Bump flake8-docstrings version
The version in use is way old and does not support Python 3.11. Bump it.
Change-Id: I047293ed51e249c69dc64c32029680439e3972fd
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
* Update hacking from branch 'master'
to ba52c7bebebc3f42b679cc03c5bf9858e256a58e
- Bump flake8 version
Change-Id: Ie5fd08a6c624e3ddc8f9fb237143c98eeec34ab9
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
* Update hacking from branch 'master'
to 77977ceb56d0f5bf1daebea18d5ade94773a74ea
- Merge "Fix nova integration job"
- Fix nova integration job
Running it turned up a bunch of false positives around delayed LOG
string interpolation, so we need to fix our pattern match from
`.format` to `.format(` to avoid incorrectly catching things like
`.format_message()`.
We also add the E checks in the Nova integration tests. As we saw in
the previous commit, sometimes flake8 gets bugs that caused things
that would normally get flagged to not actually get flagged, like
lines longer than 80 chars in docstrings. By running Nova
integration with E, we make sure any such changes are caught ahead of
time.
Depends-on: https://review.opendev.org/c/openstack/nova/+/874517
Change-Id: I236a25e5380b5492009d587e76347e52ec50c09f
* Update hacking from branch 'master'
to 9bf31498315737117b1614d67079fbfe62a16c83
- Merge "Use py3 as the default runtime for tox"
- Use py3 as the default runtime for tox
Moving on py3 as the default runtime for tox to avoid to update
this at each new cycle.
Change-Id: Ibbe6fde1fe22d087f607616571e0a273b0712c40
* Update hacking from branch 'master'
to f4c3128ac9c92fcae40658c3949f5b30fa727c21
- Improve H212 failure message
This currently fails with:
H212: Use assert{type(A),B} instance
which makes no sense. What we actually want is for users to use use
assertIsInstance. Correct this.
Change-Id: I99b01bf2349aede0e90b5fb3702c5637aad412bc
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
* Update hacking from branch 'master'
to 8d0a4a18747dd7023a684123799f5773c49de0f3
- Fix delayed log interpolation false positives
Previously, we detected non-delayed string interpolation by checking
for the presence of '.format'. This can turn up false positives, like
'.format_message('. Fix this by checking for '.format('.
Hacking version 6.0.0 got released with a bumped and fixed version of
flake8 that started detecting pep8 errors lurking in code, but also
started detecting these false positives, so once this patch is merged
we'll need a new hacking release so that projects can correctly bump
their hacking version.
Change-Id: I49e12b0dedbfd7820984cc5393f9ca2f72be89cb
* Update hacking from branch 'master'
to 3fde1e570a064ce38e7c512b16610ff4650426c3
- Bump flake8 to 5.0 to pick up fixes
There is a bug [1] in older flake8 that we need to pick up. In
particular, Nova has at least one line longer than 80 characters in it
[2] because of that bug. Our own unit tests start breaking with the
new flake8, so we need to fix whitespace for one `if`, and start
calling flake8 with `--enable-extentions` to force flake8 to load
extensions decorated with @off_by_default.
[1] https://github.com/PyCQA/flake8/issues/1534
[2] 5c32d5efe1/nova/image/glance.py (L392)
Change-Id: I7799049924b5a2cde867c88c03154c36831c9670
* Update hacking from branch 'master'
to 52b9f4f11079fd108f7a276bfac82567c028ac65
- Make tox.ini 4.0 compatible
This patch removes skipdist=True as otherwise the hacking source is not
installed in the venv and the unit test discovery fails to load most of
the test cases.
Change-Id: Ie2a39d9d1009b4be1f0ed9e6b50b4475969b03e5
* Update hacking from branch 'master'
to 2931131b69af7f1e76d8ab506c250a94b330ffb9
- Drop py36 and py37 support
We are not testing with py36 and py37 so we cannot be sure hacking works
with these versions.
Add releasenote that also mentions the previous changes in py35 and
flake8 support.
Sem-Ver: api-break
Change-Id: I798dd39afcf2f16a8660ab597b6f5bae70ab2a81
* Update hacking from branch 'master'
to a6b9aabca57c03ade8e26a3f765f1381a37a6d8b
- Add support for flake8 4.x
flake 4 dropped support for py35 so this patch drops py35 support from
hacking too
Change-Id: Ia17d6978f4d7db776d986b75c3879cb9dc672e08
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
* Update hacking from branch 'master'
to b75c7e6b2584f9154fcb969ef6de2d5136c7f8fd
- Fix test errors with python3.10
Python3.10 has become more strict when parsing code that contains syntax
errors, fix those.
Signed-off-by: Dr. Jens Harbott <harbott@osism.tech>
Change-Id: Ic9f2cb0df6e52b23b17dd9494b6fceeef9626d8a
* Update hacking from branch 'master'
to e3071cdc4ba1e2f20757dd0c242abb1f0370e0d1
- Use TOX_CONSTRAINTS_FILE
UPPER_CONSTRAINTS_FILE is old name and deprecated
This allows to use upper-constraints file as more
readable way instead of UPPER_CONSTRAINTS_FILE=<lower-constraints file>.
Change-Id: I66af58e30d01ed329dd19f243eb4862985b886af
* Update hacking from branch 'master'
to 8e26e603ec820c90782ef39b9c6e4152cc7b65be
- Merge "Fix unconditional license print if H103 is not selected"
- Fix unconditional license print if H103 is not selected
Regardless of H103 being selected by the user, if the license is not
an exact apache2 license, it will be printed out poluting the output.
With this change the comparison will be printed along with the error
message, so will not be visible if H103 was not selected.
Change-Id: Id526d83626e377aedd0bd2a998fc7d6e01058d3e
* Update hacking from branch 'master'
to a787403f0c5eb05a74b8303feb938d7d9cb69fd3
- Update CI to use unversioned jobs template
As part of the migration of this project to the independent release
model, we failed to notice that the job template was still tied to a
specific release. We've now introduced a new unversioned job template,
'openstack-python3-jobs' [1], which was can and should use. Do this.
[1] https://review.opendev.org/c/openstack/openstack-zuul-jobs/+/833286/
Change-Id: Ibad67323f0b5f2a3b7985d16eecb3db26511986c
Depends-On: https://review.opendev.org/c/openstack/openstack-zuul-jobs/+/833286/
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
* Update hacking from branch 'master'
to 6763c87d68df766199eb33b319bd659dd5590ffe
- remove unicode from code
Change-Id: I4e325e9775f07a9052b92be33724cc794d8bfdcb
* Update hacking from branch 'master'
to f11b009e15042e97384635a67c682f2260ddc657
- Merge "setup.cfg: Replace dashes with underscores"
- setup.cfg: Replace dashes with underscores
Setuptools v54.1.0 introduces a warning that the use of dash-separated
options in 'setup.cfg' will not be supported in a future version [1].
Get ahead of the issue by replacing the dashes with underscores. Without
this, we see 'UserWarning' messages like the following on new enough
versions of setuptools:
UserWarning: Usage of dash-separated 'description-file' will not be
supported in future versions. Please use the underscore name
'description_file' instead
[1] https://github.com/pypa/setuptools/commit/a2e9ae4cb
Change-Id: I67c7fb8eebc0334d3dba4c821d1fa5af4b672145
* Update hacking from branch 'master'
to 7a6141469e4b91a1f8173d1e193e2f50e572ff97
- setup.cfg: Replace dashes with underscores
Setuptools v54.1.0 introduces a warning that the use of dash-separated
options in 'setup.cfg' will not be supported in a future version [1].
Get ahead of the issue by replacing the dashes with underscores. Without
this, we see 'UserWarning' messages like the following on new enough
versions of setuptools:
UserWarning: Usage of dash-separated 'description-file' will not be
supported in future versions. Please use the underscore name
'description_file' instead
[1] https://github.com/pypa/setuptools/commit/a2e9ae4cb
Change-Id: I6083f49c2ba2baf80e20968a1f2d809089196613
* Update hacking from branch 'master'
to dfb09fb05515bdcbd60c3798c995a442d1e6b8df
- Allow hacking to be used as a pre-commit hook
This allows hacking to be used the same way flake8 is used as
a pre-commit hook. This allows repository owners to control bumping
using `pre-commit auto-update` when they feel appropriate.
Change-Id: Id00b79ff3006c390f925dcc5031ac503374cf9bd
Needed-By: https://review.opendev.org/c/openstack/tripleo-heat-templates/+/783828
* Update hacking from branch 'master'
to f56b276b972d85aa083ee1107c62bb85f09ba069
- Enable py39 testing with hacking
- bump template to wallaby to make use of py39 job
- advertise py39 support in metadata
- clean default tox envlist to be python version agnostic
Change-Id: I47ce403f35460bcf27d044450c7e6ed00cda7c4f
* Update hacking from branch 'master'
to bb71c7271d6b6490bf1c214a74c689d2e98cb1d7
- Add useful project links to metadata
Hacking PyPI presence does miss to expose few essential links related
to the project, so we add them to avoid forcing users to dig into
the documentation to find them.
Change-Id: I534ca4509bdb5f6846a41bf7cd25dd1773abaca7
* Update hacking from branch 'master'
to 11fef202d7729387f816b70d480417a9cad32593
- Drop lower bound testing
As discussed in ML and TC meeting, lower bound
testing is optional and its up to projects to
maintain it or drop it.
- http://lists.openstack.org/pipermail/openstack-discuss/2021-March/021204.html
Change-Id: I41f876ab7363f05a0f912a65d1484b10d5613a3e
* Update hacking from branch 'master'
to 65eee9782cd49ddcaad96c65103f8b7d3a157535
- Changed minversion in tox to 3.18.0
The patch bumps min version of tox to 3.18.0 python in order to
replace tox's whitelist_externals by allowlist_externals option:
https://github.com/tox-dev/tox/blob/master/docs/changelog.rst#v3180-2020-07-23
Change-Id: Ic73f1212d3a4a7178a7c735dae696bb9b8792d84
* Update hacking from branch 'master'
to 213936559ee3a9399a0ac2ffbc41578e2779f3f2
- Merge "Add H216 to flag use of third party mock"
- Add H216 to flag use of third party mock
Many projects use mocking in their unit tests, and most do not realize
that there is a difference between "import mock" and "import
unittest.mock", assuming that both use a standard part of the Python
library.
We've seen many cases where mock is not listed in the project's
requirements, but the code imports the third party mock instead of
unittest.mock. We've also seen a few break due to this, once their
dependencies have stopped pulling in that package for them.
There have also been several projects that have taken the effort to
switch all of there "import mock" statements over to "import
unittest.mock", as well as removing mock from their requirements, only
to then accidentally merge a patch that does "import mock" again because
it is hard to notice in code reviews.
This check is on by default. If a project is using the mock lib, then
they are able to explicitly do so by disabling this check. Otherwise,
projects don't need to take any action to get this protection, since
this is now the recommended default.
Change-Id: I8d255a00792a19279074703a8209a3699b480fd0
Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
* Update hacking from branch 'master'
to 5cfcdbc8d90c8f54df9248e1cadc57dc81b110b3
- Updating lower-constarints job as non voting
There is an ongoing discussion in ML to drop the
lower-constraints job [1].
Moving it to Non-voting until any decision is being
made in TC meeting.
[1]: http://lists.openstack.org/pipermail/openstack-discuss/2021-January/019672.html
Change-Id: Ia091d020641766089786cf6995e0c7a92f159a84
* Update hacking from branch 'master'
to 4069b0c4f50177dbcaa188aff0de67b4d316a873
- Add separate releasenotes page per version
Change-Id: I98b3b0e257172c6d43f5dd4b0d9147fc154bd5e6
* Update hacking from branch 'master'
- Catch .format() use in log string interpoliation check
This adds checking for using .format() instead of % when looking for
cases of preformatting log strings.
Change-Id: Ia12f898ca3d206c9da0e5057c7223e124ee2548c
Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
* Update hacking from branch 'master'
- Handle formatting of args in string interpolation check
We have added a check to make sure format strings and any args are being
passed in to be formatted as needed by the logger. The check did not
take into account string formatting that may be needed in preparing the
value args. There are some cases where this is needed, and we should not
be raising an error if the string formatting is being done there.
This adds a new test string and updates the hacking check to account for
these cases so the new hacking release does not raise unnecessary
errors.
Change-Id: Ie4e3f95d24dc954deb7336835a6f9b7bf54c9674
Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
* Update hacking from branch 'master'
- Merge "Fix H903 hacking_no_cr"
- Fix H903 hacking_no_cr
Hacking check was failing to match on lines that should have been
flagged an issue. This fixes the check and adds unit tests to validate
the check is working as expected.
Change-Id: I20e3b54a0c5830565e5d4bbb3bbc8b4921c82fb2
Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
* Update hacking from branch 'master'
- Merge "Fix H904 hacking_delayed_string_interpolation"
- Fix H904 hacking_delayed_string_interpolation
The regex for this check was wrong, resulting in misses. This fixes the
checks for string interpolation and adds unit tests to make sure we are
actually handling the cases we expect to be.
Change-Id: Id61094bb8ee8e93275c51c53caeb9ca27252b144
Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
* Update hacking from branch 'master'
- Move the most common hacking rules from other projects
This patch will copy the most common hacking rules used in diff.
projects and add them to hacking itself.
Currently, added assert_true_instance, assert_equal_type
assert_raises_regexp, assert_true_or_false_with_in
assert_equal_in
Change-Id: I122d250cab90964c346e9d53046a97c25054bc00
* Update hacking from branch 'master'
- drop mock from lower-constraints and requirements
The mock third party library was needed for mock support in py2
runtimes. Since we now only support py36 and later, we don't need it
in lower-constraints and requirements.
These changes will help us to drop `mock` from openstack/requirements
Change-Id: I71a09f2eddd3a344225cb69f9679e99fdeb3e2db
* Update hacking from branch 'master'
- Merge "Switch to newer openstackdocstheme and reno versions"
- Switch to newer openstackdocstheme and reno versions
Switch to openstackdocstheme 2.2.1 and reno 3.1.0 versions. Using
these versions will allow especially:
* Linking from HTML to PDF document
* Allow parallel building of documents
* Fix some rendering problems
Update Sphinx version as well.
openstackdocstheme renames some variables, so follow the renames
before the next release removes them. A couple of variables are also
not needed anymore, remove them.
Set openstackdocs_pdf_link to link to PDF file. Note that
the link to the published document only works on docs.openstack.org
where the PDF file is placed in the top-level html directory. The
site-preview places the PDF in a pdf directory.
Set openstackdocs_auto_name to use 'project' as name.
Change pygments_style to 'native' since old theme version always used
'native' and the theme now respects the setting and using 'sphinx' can
lead to some strange rendering.
See also
http://lists.openstack.org/pipermail/openstack-discuss/2020-May/014971.html
Change pygments_style to 'native' since old theme version always used
'native' and the theme now respects the setting and using 'sphinx' can
lead to some strange rendering.
See also
http://lists.openstack.org/pipermail/openstack-discuss/2020-May/014971.html
Change-Id: I8e6c4b1d09e5f56b505c6006ea048baf896444c3
* Update hacking from branch 'master'
- Merge "Add PDF documentation build"
- Add PDF documentation build
This commit adds PDF documentation build target 'pdf-docs' that will
build PDF versions of our docs.
This is one of the Train community goals:
https://governance.openstack.org/tc/goals/selected/train/pdf-doc-generation.html
Change-Id: Iae6bc9ae92fe61385c424923eaad35dc449880e9
Story: #2006070
Task: #35464
* Update hacking from branch 'master'
- Add in-tree upper-constraints for py35 job
It is difficult to keep the py35 upper constraints on reqiorements
repo's upper-constarint.txt file as update-constraint tools generate
the new file everytime with official supported python version only
which is py3.6 and py3.8 for Victoria cycle
- https://review.opendev.org/#/c/730428
Let's keep the py3.5 constraints in-tree which can be used in py35
unit test job.
Change-Id: I397edb7eccdb23656d1a618635d9cb9c0c901d39
* Update hacking from branch 'master'
- Remove py35 job
Ussuri release has capped hacking < 3.1.0 and this repo is now at 3.2.0
and ready for victoria.
Remove py35 job.
This fixes building since zipp 3.1.0 is only available for python 3.6
and newer and upper-constraints.txt requires that version, so py35 job
fails.
Remove also unneeded install_command from tox.ini.
Change-Id: I07395f5ba167e849c936ad66936237ea9d90864e
* Update hacking from branch 'master'
- Merge "Switch testing to Victoria testing runtime"
- Switch testing to Victoria testing runtime
Upating the testing template from ussuri to victoria
testing runtime
- https://governance.openstack.org/tc/reference/runtimes/victoria.html
Change-Id: Ib3e5b14aee87ab90f231c69beea95701be8093cc
* Update hacking from branch 'master'
- Enable flake8 3.8.*
It has been disabled previously to avoid pulling in new checks.
Now it's time to re-enable it with a new release.
Change-Id: Idd80085602ddb1fcf5a8d3de449866ba25a9c046
* Update hacking from branch 'master'
- Cap flake8 < 3.8.0
This version has enabled some new checks and fixed old ones, so
CI jobs started failing. Cap it for now so that it can be release
a patch version and then a major version uncapping it.
Change-Id: If39298338ff69327379ef10d34efac0c6f164084
* Update hacking from branch 'master'
- Merge "Document new way of registering local plugins"
- Document new way of registering local plugins
The way plugins has changed with flake8 2.5, document the new way.
Change-Id: I2d952cecaf7e267893f478427e396a5db88e7190
* Update hacking from branch 'master'
- Merge "Remove usage of six"
- Remove usage of six
The repo is python 3 only now, we can remove six usage and assume
python3 everywhere.
Change-Id: I0c742c2c7898914fae48b675e53c4dafb358bf9a
* Update hacking from branch 'master'
- Merge "Stop building universal wheels"
- Stop building universal wheels
Hacking requires python >= 3.5, but we build universal wheels which are
valid under python2. This creates some confusion for people that expect
these wheels to then function under python2.
Avoid confusion by building python3 only wheels instead.
Change-Id: Ic1d957f711738ad4932e3d9c3356ab6d640aa373