From c74a0e9263d094cc7034583ef05b2fe86a7a139e Mon Sep 17 00:00:00 2001 From: "Bradley A. Thornton" Date: Tue, 25 Jan 2022 09:20:29 -0800 Subject: [PATCH] Disable warnings related to the use of assert in the tests directory as reported with `lint-vetting` (#792) Disable warnings related to the use of assert in the tests directory as reported with `lint-vetting` This adds a few additional files to the per-file-ignore list within the flake8 configuration with an exemption for S101 which is reported by flake8-bandit as part of the wemake style guide which is being vetted. The list was also alphabetized to ensure new entries were placed in a sane location. A note was added to the top of the flake8 per-file-ignores indicating that the glob for the tests folder ignoring s101 can be added later. Currently there is a conflict between globs and per-file entries. See PyCQA/flake8#670 This eliminates the S101 entry from the output of tox -e lint-vetting so users of it can see messages only related to the changes they are making and not for files that were previously added to the repository: 1 C812 missing trailing comma 1 RST304 Unknown interpreted text role "mod". - 13 S101 Use of assert detected. The enclosed code will be removed when compiling to optimised byte code. 1 S404 Consider possible security implications associated with the subprocess module. 1 S603 subprocess call - check for execution of untrusted input. 2 S604 Function call with shell=True parameter identified, possible security issue. 2 WPS111 Found too short name: p < 2 2 WPS115 Found upper-case constant in a class: KEGEX 3 WPS201 Found module with too many imports: 13 > 12 6 WPS210 Found too many local variables: 6 > 5 3 WPS220 Found too deep nesting: 24 > 20 2 WPS221 Found line with high Jones Complexity: 16 > 14 3 WPS226 Found string literal over-use: test_option > 3 9 WPS305 Found `f` string 1 WPS316 Found context manager with too many assignments 6 WPS317 Found incorrect multi-line parameters 2 WPS323 Found `%` string formatting 4 WPS324 Found inconsistent `return` statement 2 WPS414 Found incorrect unpacking target 1 WPS430 Found nested function: getcwd 14 WPS436 Found protected module import: _curses 3 WPS450 Found protected object import: _CursesWindow 1 WPS602 Found using `@staticmethod` Related #713 Reviewed-by: Sviatoslav Sydorenko Reviewed-by: Bradley A. Thornton Reviewed-by: None --- .flake8 | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/.flake8 b/.flake8 index a38bebbb3..fd8dd45a8 100644 --- a/.flake8 +++ b/.flake8 @@ -59,8 +59,18 @@ inline-quotes = " max-line-length = 100 # Allow certain violations in certain files: -# Please keep this list sorted, as it will be easier for others to find and add entries in the future +# Please keep both sections of this list sorted, as it will be easier for others to find and add entries in the future per-file-ignores = + # The following ignores have been researched and should be considered permanent + # each should be preceeded with an explanation of each of the error codes + # If other ignores are added for a specific file in the section following this, + # these will need to be added to that line as well. + + # S101: Allow the use of assert within the tests directory, since tests require it. + tests/**.py: S101 + + # The following were present during the initial implementation. + # They are expected to be fixed and unignored over time. docs/_ext/single_sourced_data.py: D400, D403, DAR101, DAR201, N817, P103, WPS110, WPS111, WPS201, WPS202, WPS210, WPS213, WPS221, WPS229, WPS231, WPS237, WPS305, WPS318, WPS323, WPS331, WPS336, WPS347, WPS407, WPS432, WPS440, WPS441, WPS453, WPS504 docs/_ext/spelling_stub_ext.py: DAR101, DAR201 docs/conf.py: WPS221, WPS226, WPS301, WPS305, WPS323, WPS420, WPS429, WPS433