Skip to content
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

[doc] Add an example for suppressed-message #8328

Merged

Conversation

Pierre-Sassoulas
Copy link
Member

@Pierre-Sassoulas Pierre-Sassoulas commented Feb 22, 2023

Type of Changes

Type
βœ“ πŸ“œ Docs

Description

The message would not be triggered if implicit-str-concat is not activated too. I initially wanted to activate invalid-name so we follow pep8 in our examples but there's more than 50 violations right now. So 'implicit-str-concat' it is.

Refs #7897 #5953

The message would not be triggered if implicit-str-concat is not activated too.
I initially wanted to activate invalid-name so we follow pep8 in our examples
but there's more than 50 violations right now. So 'implicit-str-concat' it is.
@codecov
Copy link

codecov bot commented Feb 22, 2023

Codecov Report

Merging #8328 (573be00) into main (f54dfd1) will not change coverage.
The diff coverage is n/a.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #8328   +/-   ##
=======================================
  Coverage   95.46%   95.46%           
=======================================
  Files         177      177           
  Lines       18703    18703           
=======================================
  Hits        17855    17855           
  Misses        848      848           

@@ -0,0 +1 @@
test = ["a" "b"] # pylint: disable=implicit-str-concat # [suppressed-message]
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'd prefer to do this with a pylintrc that enables the message and then disable it here.

The enable in the running of the tests is just additional "headspace" that gets occupied when dealing with these tests.
The fact that we had so many issues with just disabling the cleaning of messages after each file shows that neither of us (or other maintainers) fully understand all the implications of the functional test runners.

Copy link
Member Author

Choose a reason for hiding this comment

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

I tried that too (and also enable in file) but I think pylintrc is the baseline that is modified by the command line argument. Not sure if it's possible.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Ah yeah, of course..

Or... A specific enable in the bad.py file? And then a disable a line later?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Oh wait, that's what you just said. That doesn't work?

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree. I tried to use disable-next to enable the suppressed message and that did not work for me

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, not sure why, I think the right order for message control should be "configuration < commande line < file directive according to scope":

$ cat a.py
# pylint: enable=invalid-name
tEsT = "apple"  # pylint: disable=invalid-name
$ pylint a.py --disable=all --enable=invalid-name,suppressed-message,astroid-error,syntax-error
************* Module a
a.py:2:0: I0020: Suppressed 'invalid-name' (from line 2) (suppressed-message)
--------------------------------------------------------------------
Your code has been rated at 10.00/10 (previous run: 10.00/10, +0.00)
$ pylint a.py --disable=all --enable=suppressed-message,astroid-error,syntax-error 
--------------------------------------------------------------------
Your code has been rated at 10.00/10 (previous run: 10.00/10, +0.00)

Clearly fixing the message control is a task that is not going to be tackled like a young ballerina by SΓ©bastien Chabal.

@DanielNoord
Copy link
Collaborator

@Pierre-Sassoulas I know this is awful, but at least it shows what the behaviour is..

@Pierre-Sassoulas
Copy link
Member Author

Hmm maybe it's due to the way "all" behave and take precedence. Definitely something to consider in #3696

@Pierre-Sassoulas
Copy link
Member Author

Let's merge this ! You'll have to approve your own change @DanielNoord πŸ˜„

@DanielNoord
Copy link
Collaborator

Something fishy is going on for sure as the second suppressed-message on the last line is for useless-suppression..

Anyway, I much prefer to keep all of these weird issues contained to one documentation example rather than affecting all other tests for it.

@Pierre-Sassoulas
Copy link
Member Author

Removing errors and pep8 smells from documentation examples is valuable in itself but this is something from another time. There's 50+ invalid-name violations currently. But we clearly have better things to do.

@Pierre-Sassoulas Pierre-Sassoulas enabled auto-merge (squash) February 22, 2023 22:22
@Pierre-Sassoulas Pierre-Sassoulas merged commit d064010 into pylint-dev:main Feb 22, 2023
@Pierre-Sassoulas Pierre-Sassoulas deleted the doc-suppressed-message branch February 24, 2023 19:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Documentation πŸ“— Skip news πŸ”‡ This change does not require a changelog entry
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants