Skip to content

Commit

Permalink
Fix exclusion in Flake8 configuration (#16087)
Browse files Browse the repository at this point in the history
Related to #16071

Summary of the issue:
When linting we exclude certain directories where the code is auto generated. These exclusions are not working (this probably regressed with the Flake8 update, though I haven't checked).

Description of user facing changes
When linting exclusions in Flake8 configuration are once again respected.

Description of development approach
Flake8 considers that paths in the exclusion list are provided relative to the config file location not to the CWD, our exclusions were modified to account for this
After the file was modified I started getting errors due to usage of inline comments, apparently this was never supposed to work, as per this quote from the documentation:
Following the recommended settings for Python’s configparser, Flake8 does not support inline comments for any of the keys. So while this is fine:...

Therefore we no longer use inline comments in the config.
  • Loading branch information
lukaszgo1 authored Jan 25, 2024
1 parent 5d4bfb0 commit e71916d
Showing 1 changed file with 25 additions and 13 deletions.
38 changes: 25 additions & 13 deletions tests/lint/flake8.ini
Original file line number Diff line number Diff line change
Expand Up @@ -27,26 +27,38 @@ max-line-length = 110
hang-closing = False

ignore =
W191, # indentation contains tabs
W503, # line break before binary operator. We want W504(line break after binary operator)
# indentation contains tabs
W191,
# Line break before binary operator.
# We want W504 (line break after binary operator).
W503,

# inform flake8 about functions we consider built-in.
builtins =
# translation lookup
_,
# translation lookup
ngettext,
# translation lookup
pgettext,
# translation lookup
npgettext,

builtins = # inform flake8 about functions we consider built-in.
_, # translation lookup
ngettext, # translation lookup
pgettext, # translation lookup
npgettext, # translation lookup

exclude = # don't bother looking in the following subdirectories / files.
# don't bother looking in the following subdirectories / files.
exclude =
.git,
__pycache__,
.tox,
build,
output,
include/*,
miscDeps,
source/louis,
source/comInterfaces/*, # #10924: generated by third-party dependencies
# When excluding concrete paths relative to a directory,
# not matching multiple folders by name e.g. `__pycache__`,
# paths are relative to the configuration file.
../../include/*,
../../miscDeps,
../../source/louis,
# #10924: generated by third-party dependencies
../../source/comInterfaces/*,

filename =
*.py,
Expand Down

0 comments on commit e71916d

Please sign in to comment.