1. Logilab
  2. Untitled project
  3. pylint
  4. Pull requests

Pull requests

#39 Declined

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

  1. smontanaro

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).

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