Pull requests

#39 Open
Repository
smontanaro
Branch
definedattrs
Repository
logilab
Branch
default

Add check to see that attributes defined within a class's methods are used within the class

Bitbucket cannot automatically merge this request.

The commits that make up this pull request have been removed.

Bitbucket cannot automatically merge this request due to conflicts.

Review the conflicts on the Overview tab. You can then either decline the request or merge it manually on your local system using the following commands:

hg update default
hg pull -r definedattrs https://bitbucket.org/smontanaro/pylint
hg merge definedattrs
hg commit -m 'Merged in smontanaro/pylint/definedattrs (pull request #39)'
Author
  1. smontanaro
Reviewers
Description

From the commit message:

Add a method to check that defined instance attributes are used within the class where they are defined. One can argue (and I'm sure people will) that there is no particular reason that a class should use the attributes it defines. It can clearly only define an attribute for use as part of the public API. In practice though, I think most instance attributes defined in a class will be used somewhere within the class.

Common reasons for attributes to be defined but not used include simple typos as well as refactoring mistakes (not removing attributes which are no longer needed, for instance).

  • Learn about pull requests

Comments (7)

      1. Claudiu Popa

        Solving the conflicts should be the first action. Right now we are mostly using symbolic names and it would be great if you could use them instead of numeric ids.

        1. smontanaro author

          Alas, it seems I have forgotten everything I ever knew about Mercurial. I have a repo. Can you explain to me how to sync it with the current default?

          Also, what do you mean by "symbolic names"?

          1. Claudiu Popa

            The symbolic name would be defined-attribute-not-accessed. Thus, instead of using W0234, you could use that instead, which provides more meaning. To sync with the default, you have to do a couple of things. If you have a Pylint fork, you can update it from its page. There's a link there with a description like this "Your fork is X commit behind. Click here to update" or something like this. After that:

            hg update definedattrs
            hg pull -u
            hg merge default
            # solve conflicts
            hg commit
            hg push
            
            hg update