-
-
Notifications
You must be signed in to change notification settings - Fork 310
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create "warn only" functionality in flake8. - [closed] #1183
Comments
In GitLab by @scolby33 on May 28, 2018, 18:48 If the general consensus on this approach is okay, I will proceed to documentation. Otherwise, I'm open to thoughts on my work! |
In GitLab by @scolby33 on Oct 21, 2018, 24:15 added 23 commits
|
In GitLab by @codecov on Oct 21, 2018, 24:16 Codecov Report
@@ Coverage Diff @@
## master #238 +/- ##
==========================================
- Coverage 80.21% 80.09% -0.12%
==========================================
Files 25 25
Lines 2355 2381 +26
Branches 390 394 +4
==========================================
+ Hits 1889 1907 +18
- Misses 385 389 +4
- Partials 81 85 +4
Continue to review full report at Codecov.
|
In GitLab by @scolby33 on Oct 21, 2018, 24:19 changed the description |
In GitLab by @scolby33 on Oct 21, 2018, 24:26 Rebased to resolve conflicts. |
In GitLab by @scolby33 on Apr 15, 2019, 11:05 added 137 commits
|
In GitLab by @scolby33 on Apr 15, 2019, 11:06 Rebased again to resolve conflicts. |
In GitLab by @asottile on Apr 15, 2019, 11:12 I'm biased against warning noise, especially in linters. You ~could already do this without needing an option by using |
In GitLab by @scolby33 on Apr 15, 2019, 11:25 That's true and I hadn't considered it before. In my notional I kinda hated this until I had to type out my example here and realized it's not so bad if I actually use variables of some form; originally I worried about keeping the lists in the two commands in sync. As a counterpoint to avoiding warning noise, this is only opt-in warning noise. My intention for use of this feature was in adding flake8 to an old codebase. Warn on everything until it passes, then start failing, thus preventing the whole test suite from turning red and allowing incremental improvements. Perhaps this is misguided and the approach should be to enable all the warnings you'd want and start checking on a file-by-file basis instead of warning-by-warning? Anyway, I think this is potentially useful and it would solve a pain point I've encountered before. However, if it is not in the cards to be added, let's close this merge request and also #332. If there's a relevant portion of the documentation to add the (One thing I realized as I typed this last part, the This was longer than I expected it to be. Let me know what you think! |
In GitLab by @asottile on Apr 15, 2019, 11:40 Actually, even better than |
In GitLab by @jcgoble3 on Apr 15, 2019, 11:47 See issue #332. Part of the idea of this is that a single CI run can simultaneously fail on actual problems, while nagging about known code smells without failing on them until people find time to fix them. Currently doing this requires two CI jobs, one for actual failures and one with |
In GitLab by @jcgoble3 on Apr 15, 2019, 11:49 And the alternative to a second CI job now is to just straight skip and ignore all the known code smells, which only hides them and accumulates technical debt. |
In GitLab by @asottile on Apr 15, 2019, 12:34 Couldn't you have a single CI job which just calls two things? (think: tox environment with two commands in it) [testenv:flake8]
commands =
flake8 --select=...
flake8 --select=... --exit-zero |
In GitLab by @jcgoble3 on Apr 15, 2019, 18:19 That would work in theory, but is there a way to maintain the two lists simultaneously in a config file (other than as explicit arguments to a command)? I prefer to set all options in config files and invoke testing commands with as few arguments as possible (preferably none at all) for easier maintenance and easier integration with my IDE. With Visual Studio Code, relying on config files means that I can change just the config file and it is immediately picked up by both Code and my CI, while editing command line arguments requires editing two files, specifically the CI config and the workspace settings, violating the "single source of truth" principle. Since both lists are being passed to |
In GitLab by @asottile on Apr 15, 2019, 20:50 I'm not convinced the complexity is worth it -- there's already a way to do what you want -- yeah it takes two commands, but enabling this (in my opinion anti-feature of warning noise) is not worth it. tox is a config file that could have a single source of truth, can you point your editor at that? Or even a shell script? |
In GitLab by @jcgoble3 on Apr 15, 2019, 21:14
Strictly opt-in warning noise. Those that don't use it shouldn't see any change. Only those that want the noise will get the noise. And given the concept of nagging people until code smells get fixed, I'd argue that the noise is a good thing.
For unit tests, of course. However, Code has a separate mechanism for linting. The linting mechanism does not support arbitrary shell commands; it expects to invoke one of a small number of known linters, such as flake8, exactly once and get an output list (possibly empty) of warnings and errors, which is then parsed to identify and highlight those problems directly in the editor. Command-line arguments, if any, to the linter invocation must be configured separately as a variable within the user or workspace settings. Hence my desire to avoid any and all arguments, keeping everything in one place (such as a tox config file), and to be able to call a bare The two-invocation concept fails in two ways: it limits what I have access to inside Code (which cannot accumulate notes from multiple linter runs), and forces me to use command-line arguments since both commands use different values for the same argument ( I would imagine that if this is merged and released, the Python extension for Code would eventually grow a checkbox option to enable/disable highlighting of the "nag" items (assuming it is possible to parse them as such, or possible to programmatically turn them off), so they can be ignored while working on more important things and enabled when fixing them. I would probably file the feature request for that myself. |
In GitLab by @asottile on Apr 15, 2019, 21:22
From experience, warning noise causes developers to ignore the entire output instead which is way worse. It also creates fatigue with the tool in general Can you customize the command the VS Code extension runs? I see no reason you can't have your own And again, I get that you want your convenience, but we're weighing your convenience against the maintenance cost of one of the more complex parts of flake8 -- furthering the combinatorial explosion of Not to even begin to mention the user experience here -- there's no differentiation in the output into what's fatal vs warning. |
In GitLab by @sigmavirus24 on Apr 16, 2019, 08:19
I've done this in the past with
And adding this would be "Things that are shown but don't cause errors causing genuine confusion about what needs to be fixed versus what should be fixed versus something else". While I accept that y'all think this serves a purpose in a particularly useful way, I have to say that I really don't want the added complexity in here for the users of Flake8. And I haven't even looked at what this does to the codebase so I won't comment on the complexity it introduces there. |
In GitLab by @scolby33 on Apr 16, 2019, 09:09 This thread has been a goldmine for learning options--I had never looked at As for the codebase complexity, I can't say I'm thrilled about how I added the functionality, which is a vote against merging this that I totally understand. |
In GitLab by @asottile on Jun 14, 2019, 11:13 Thanks again for the discussion and PR -- given the resolution above and the existing approaches to accomplish the same goals I'm going to close this |
In GitLab by @asottile on Jun 14, 2019, 11:13 closed |
In GitLab by @con-f-use on Sep 5, 2019, 13:41 Suggestion: put the summary of this thread in the FAQ. I'd also say that the |
In GitLab by @scolby33 on May 28, 2018, 18:40
Merges add-warning-functionality -> master
Add the
--warn-only
and--extend-warn-only
options analogous to the--ignore
and--extend-ignore
options.Extend the
checker
andstyle_guide
to make use of the new "warn only"options.
See issue #424
Edit: see issue #332 as well
The text was updated successfully, but these errors were encountered: