Skip to content

Fix exclusion in Flake8 configuration#16087

Merged
seanbudd merged 4 commits into
nvaccess:masterfrom
lukaszgo1:flakeFIxExclusion
Jan 25, 2024
Merged

Fix exclusion in Flake8 configuration#16087
seanbudd merged 4 commits into
nvaccess:masterfrom
lukaszgo1:flakeFIxExclusion

Conversation

@lukaszgo1

Copy link
Copy Markdown
Contributor

Link to issue number:

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.

Testing strategy:

Performed lint on the code from #16071 - ensured that comInterfaces are ignored as they should be.

Known issues with pull request:

None known

Code Review Checklist:

  • Documentation:
    • Change log entry
    • User Documentation
    • Developer / Technical Documentation
    • Context sensitive help for GUI changes
  • Testing:
    • Unit tests
    • System (end to end) tests
    • Manual testing
  • UX of all users considered:
    • Speech
    • Braille
    • Low Vision
    • Different web browsers
    • Localization in other languages / culture than English
  • API is compatible with existing add-ons.
  • Security precautions taken.

@lukaszgo1 lukaszgo1 requested a review from a team as a code owner January 23, 2024 21:48
@lukaszgo1 lukaszgo1 requested a review from seanbudd January 23, 2024 21:48
@lukaszgo1 lukaszgo1 mentioned this pull request Jan 23, 2024
5 tasks
Comment thread tests/lint/flake8.ini Outdated
Comment thread tests/lint/flake8.ini Outdated
exclude = # don't bother looking in the following subdirectories / files.
# indentation contains tabs
W191,
# line break before binary operator. We want W504(line break after binary operator)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# line break before binary operator. We want W504(line break after binary operator)
# line break before binary operator.
# We want W504 (line break after binary operator)

Comment thread tests/lint/flake8.ini Outdated
Comment thread tests/lint/flake8.ini
miscDeps,
source/louis,
source/comInterfaces/*, # #10924: generated by third-party dependencies
../../include/*,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
../../include/*,
# When excluding concrete paths (i.e not each folder named `__pycache__`)
# paths are relative to the configuration file.
../../include/*,

@seanbudd

Copy link
Copy Markdown
Member

Thanks @lukaszgo1

Comment thread tests/lint/flake8.ini Outdated
Comment thread tests/lint/flake8.ini Outdated
@AppVeyorBot

Copy link
Copy Markdown

See test results for failed build of commit 3f626e4d21

@seanbudd seanbudd merged commit e71916d into nvaccess:master Jan 25, 2024
@nvaccessAuto nvaccessAuto added this to the 2024.2 milestone Jan 25, 2024
@lukaszgo1 lukaszgo1 deleted the flakeFIxExclusion branch January 25, 2024 10:27
Nael-Sayegh pushed a commit to Nael-Sayegh/nvda that referenced this pull request Feb 15, 2024
Related to nvaccess#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.
SaschaCowley pushed a commit to SaschaCowley/nvda that referenced this pull request Feb 27, 2024
Related to nvaccess#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.
Adriani90 pushed a commit to Adriani90/nvda that referenced this pull request Mar 13, 2024
Related to nvaccess#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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants