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

Breaking down C0111(Missing Docstring) into multiple "Convention" messages #2036

Merged
merged 4 commits into from
Sep 10, 2019

Conversation

Pierre-Sassoulas
Copy link
Member

This is an incomplete pull request in order to see more easily what needs to be changed in order to implement #1164 after a long period of inactivity.

Copy link
Contributor

@AWhetter AWhetter left a comment

Choose a reason for hiding this comment

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

This is a great change. I love the idea!
It's not something to address in this pull request, but perhaps in the future we can split out an extra message for magic methods and another for nested classes or functions. I think there will be times that people will want to turn those messages off especially, but still get messages for everything else.

I've made a few small comments but there's nothing major. It would be great to get them fixed before merging but it's not a problem if they don't get fixed.
Also the tests should now be fixed so hopefully they'll pass if you make a change to this pull request.

pylint/checkers/base.py Outdated Show resolved Hide resolved
pylint/checkers/base.py Outdated Show resolved Hide resolved
pylint/checkers/base.py Outdated Show resolved Hide resolved
pylint/utils.py Outdated Show resolved Hide resolved
pylint/utils.py Outdated Show resolved Hide resolved
pylint/utils.py Outdated Show resolved Hide resolved
Pierre-Sassoulas added a commit to Pierre-Sassoulas/pylint that referenced this pull request May 6, 2018
Following the review of pull-request pylint-dev#2036 by Ashley Whetter.

See pylint-dev#2036
@Pierre-Sassoulas
Copy link
Member Author

Pierre-Sassoulas commented May 6, 2018

@AWhetter thank you for reviewing and approving the changes. I fixed the spelling in the github interface. I coded that a long time ago and had the same reflexion than you when seeing the "ime" naming, it definitely needs a refactor. So I'll make the other change too, but only when I have an IDE and git available.

Regarding the tests, they're not passing because the refactor required in order to have multiple old messages with the same name is not done yet :)

Pierre-Sassoulas added a commit to Pierre-Sassoulas/pylint that referenced this pull request May 7, 2018
Following the review of pull-request pylint-dev#2036 by Ashley Whetter.

See pylint-dev#2036
Pierre-Sassoulas added a commit to Pierre-Sassoulas/pylint that referenced this pull request May 7, 2018
to _raise_duplicate_symbol and _raise_duplicate_msg_id
Following the review of pull-request pylint-dev#2036 by Ashley Whetter.
Pierre-Sassoulas added a commit to Pierre-Sassoulas/pylint that referenced this pull request May 7, 2018
Following the review of pull-request pylint-dev#2036 by Ashley Whetter.
Copy link
Contributor

@PCManticore PCManticore left a comment

Choose a reason for hiding this comment

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

Thanks @Pierre-Sassoulas This looks great! I left a couple of small comments, but nothing that's related to the logic, which looks straightforward. Also if you can, please also add a description in the What's New document for this release, 2.0 rst, which can go a bit more in depth on what we did here (split the missing-docstring, mention the fact that the old disable/enable can still work with missing-docstring and mention the new added messages`

pylint/utils.py Outdated Show resolved Hide resolved
pylint/utils.py Outdated Show resolved Hide resolved
pylint/utils.py Outdated Show resolved Hide resolved
pylint/utils.py Outdated Show resolved Hide resolved
pylint/utils.py Outdated Show resolved Hide resolved
pylint/utils.py Outdated Show resolved Hide resolved
pylint/checkers/base.py Outdated Show resolved Hide resolved
@Pierre-Sassoulas
Copy link
Member Author

Pierre-Sassoulas commented May 9, 2018

There is a function, called "MessageStore.check_message_id(msgid)" (~= line 850 in utils.py). It is used outside of MessageStore a dozen of times. It return a MessageDefinition instance when you give a msgid and raise an error if there is no corresponding message for the msgid. It does not check anything. So I think it should actually be called "get_message_from_msgid(msgid)". Can I refactore this or did I miss something?

@PCManticore
Copy link
Contributor

PCManticore commented May 9, 2018 via email

Pierre-Sassoulas added a commit to Pierre-Sassoulas/pylint that referenced this pull request May 10, 2018
Create a function to get message definitions list from a checker.
Create a function for checking checker consistency
Create a function in order to register a MessageDefinition

Corrected following the review of pull-request pylint-dev#2036 by Ashley Whetter and PCManticore.
Pierre-Sassoulas added a commit to Pierre-Sassoulas/pylint that referenced this pull request May 10, 2018
Use of f-strings in Python 3. Updated the docstrings with spinx syntax.
Rename variable to be clearer and use @staticmethoc when possible.

Following review of pylint-dev#2036
Pierre-Sassoulas added a commit to Pierre-Sassoulas/pylint that referenced this pull request May 10, 2018
Create a function to get message definitions list from a checker.
Create a function for checking checker consistency
Create a function in order to register a MessageDefinition

Corrected following the review of pull-request pylint-dev#2036 by Ashley Whetter and PCManticore.
Pierre-Sassoulas added a commit to Pierre-Sassoulas/pylint that referenced this pull request May 10, 2018
Use of f-strings in Python 3. Updated the docstrings with spinx syntax.
Rename variable to be clearer and use @staticmethoc when possible.

Following review of pylint-dev#2036
PCManticore pushed a commit that referenced this pull request May 10, 2018
Create a function to get message definitions list from a checker.
Create a function for checking checker consistency
Create a function in order to register a MessageDefinition

Corrected following the review of pull-request #2036 by Ashley Whetter and PCManticore.
PCManticore pushed a commit that referenced this pull request May 10, 2018
Use of f-strings in Python 3. Updated the docstrings with spinx syntax.
Rename variable to be clearer and use @staticmethoc when possible.

Following review of #2036
Pierre-Sassoulas added a commit to Pierre-Sassoulas/pylint that referenced this pull request May 10, 2018
Fixed spelling in C0112 to C0116 messages following the review
of pull-request pylint-dev#2036 by Ashley Whetter.
@Pierre-Sassoulas
Copy link
Member Author

Pierre-Sassoulas commented May 10, 2018

Regarding the refactor in MessageStore. Let's take an example :

   'W1235': (
        'Child 1', 'child-one', 'Child one description.',
        {'old_names': [('W1234', 'mother')]}
    ),
    'W1236': (
        'Child 2', 'child-two', 'Child two description',
        {'old_names': [('W1234', 'mother')]}
    )

Right now this raises an error and what I think is stored in MessagesStore is this:

message = {
W1235 : # message_definition_for W1235,
W1236: # message_definition_for W1236,
}

alternate_name = {
W1234: W1235,
# W1234: W1236, Impossible
}

I have a feeling that we could construct a message for the old name and link it for every child symbol/msgid :

message = {
W1235 : # message_definition_for W1235,
W1236: # message_definition_for W1236,
}

alternate_name = {
W1234 : # message_definition_for W1234
}

But I don't know how to construct the mother message for W1234 in this case. Do we take W1235 message definition ? W1236 ? Something new ?

So the other way would be to make a (very big?) refactor to permit MessagesStore to return a list of message definitions :

message = {
W1235 : # [message_definition_for W1235],
W1236: # [message_definition_for W1236],
W1234 : # [message_definition_for W1235, message_definition_for W1236],
}

Or maybe a list only if its an alternate name :

message = {
W1235 : # message_definition_for W1235,
W1236: # message_definition_for W1236,
}

alternate_name = {
W1234 : # [message_definition_for W1235, message_definition_for W1236],
}

Any thoughts @PCManticore ?

Pierre-Sassoulas added a commit to Pierre-Sassoulas/pylint that referenced this pull request May 10, 2018
Fixed spelling in C0112 to C0116 messages following the review
of pull-request pylint-dev#2036 by Ashley Whetter.
Pierre-Sassoulas added a commit to Pierre-Sassoulas/pylint that referenced this pull request Jun 20, 2019
Fixed spelling in C0112 to C0116 messages following the review
of pull-request pylint-dev#2036 by Ashley Whetter.
Pierre-Sassoulas added a commit to Pierre-Sassoulas/pylint that referenced this pull request Jun 20, 2019
Fixed spelling in C0112 to C0116 messages following the review
of pull-request pylint-dev#2036 by Ashley Whetter.
Pierre-Sassoulas added a commit to Pierre-Sassoulas/pylint that referenced this pull request Aug 4, 2019
Also fixed spelling in C0112 to C0116 messages following the review
of pull-request pylint-dev#2036 by Ashley Whetter.

See also pylint-dev#2075, pylint-dev#2077, pylint-dev#2262, pylint-dev#2654, pylint-dev#2805, pylint-dev#2809, pylint-dev#2844, pylint-dev#2992
and pylint-dev#3013 for full historical context.
@Pierre-Sassoulas
Copy link
Member Author

Pierre-Sassoulas commented Aug 4, 2019

@PCManticore This is ready for review but everything will be easier if we first resolve the smaller chunks. This MR is based upon #3021, #3041, #2992, and #3013, let's merge them first (in this order).

@coveralls
Copy link

Coverage Status

Coverage increased (+0.05%) to 90.033% when pulling f1bbf64 on Pierre-Sassoulas:master into 41c9522 on PyCQA:master.

2 similar comments
@coveralls
Copy link

Coverage Status

Coverage increased (+0.05%) to 90.033% when pulling f1bbf64 on Pierre-Sassoulas:master into 41c9522 on PyCQA:master.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.05%) to 90.033% when pulling f1bbf64 on Pierre-Sassoulas:master into 41c9522 on PyCQA:master.

@coveralls
Copy link

coveralls commented Aug 4, 2019

Coverage Status

Coverage decreased (-0.02%) to 90.034% when pulling 44fbb52 on Pierre-Sassoulas:master into ae81e3b on PyCQA:master.

Pierre-Sassoulas added a commit to Pierre-Sassoulas/pylint that referenced this pull request Aug 19, 2019
Also fixed spelling in C0112 to C0116 messages following the review
of pull-request pylint-dev#2036 by Ashley Whetter.

See also pylint-dev#2075, pylint-dev#2077, pylint-dev#2262, pylint-dev#2654, pylint-dev#2805, pylint-dev#2809, pylint-dev#2844, pylint-dev#2992
and pylint-dev#3013 for full historical context.
@AWhetter AWhetter self-requested a review September 7, 2019 21:24
Pierre-Sassoulas added a commit to Pierre-Sassoulas/pylint that referenced this pull request Sep 10, 2019
Also fixed spelling in C0112 to C0116 messages following the review
of pull-request pylint-dev#2036 by Ashley Whetter.

See also pylint-dev#2075, pylint-dev#2077, pylint-dev#2262, pylint-dev#2654, pylint-dev#2805, pylint-dev#2809, pylint-dev#2844, pylint-dev#2992
and pylint-dev#3013 for full historical context.
@Pierre-Sassoulas
Copy link
Member Author

@PCManticore this is the final merge request for #1164. In hindsight it looks like I could have chosen an easier first issue :)

Copy link
Contributor

@PCManticore PCManticore left a comment

Choose a reason for hiding this comment

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

@Pierre-Sassoulas Alright, this is ready! Thank you so much for the effort you put into getting this change in. 🙇 It took a tremendous amount of effort and refactoring to get to this point, and I appreciate your work and enthusiasm in making these three separate checks a reality.

@PCManticore PCManticore merged commit d54c88a into pylint-dev:master Sep 10, 2019
PCManticore pushed a commit that referenced this pull request Sep 10, 2019
Also fixed spelling in C0112 to C0116 messages following the review
of pull-request #2036 by Ashley Whetter.

See also #2075, #2077, #2262, #2654, #2805, #2809, #2844, #2992
and #3013 for full historical context.
noahp added a commit to noahp/diff_cover that referenced this pull request Oct 17, 2019
Output text for missing function/module docstring was modified here:
pylint-dev/pylint#2036

Update this test to handle it.
Bachmann1234 pushed a commit to Bachmann1234/diff_cover that referenced this pull request Oct 18, 2019
Output text for missing function/module docstring was modified here:
pylint-dev/pylint#2036

Update this test to handle it.
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.

None yet

4 participants