] > Re: [Python-projects] [ANN] pylint 0.8.1 (Logilab.org)

Email Re: [Python-projects] [ANN] pylint 0.8.1

to
subject
Re: [Python-projects] [ANN] pylint 0.8.1
date
2005/11/07 18:25
Re: [Python-projects] [ANN] pylint 0.8.1

Bonjour Sylvain,

Thanks for this new release!

I already have some patches to the new version.
(Actually, I kept them ready, but against an older version).

I'm sorry I don't know how to produce a correct patch file, so I
give here the lines that I modified.


1- "Unused imports" reports too many things, when using "import *".
   I know I should not write code like this, but hey,
   that's another warning...

   in module checkers/variables.py, in leave_module():
            ...
            if isinstance(stmt, astng.Import) or (
                isinstance(stmt, astng.From) and stmt.modname != '
__future__'
                and stmt.names[0][0] != '*'):
                self.add_message('W0611', args=name, node=stmt)
            ...

2- Add the module name on Wildcard imports :
   in module checkers/imports.py:
    ...
    'W0401': ('Wildcard import %r',
    ....
                self.add_message('W0401', args=basename, node=node)
    ...

3- Correct the "relative import" warning:
   the warning should occur only when absolute import gives a result
   diffrerent than the relative import.

   in logilab.common.modutils, in is_relative():

    ...
    if not isdir(from_file):
        from_file = dirname(from_file)

    try:
        rel_module = find_module(modname.split('.')[0], [from_file])
    except ImportError:
        # Relative module could not be found
        return False

    try:
        abs_module = find_module(modname.split('.')[0], None)
    except ImportError:
        # Absolute module does not exist in sys.path
        # Future python will fail loading the module
        return True

    if abs_module[1:] == rel_module[1:]:
        # absolute and relative modules are the same.
        return False
    else:
        # absolute and relative modules are different!
        # Future python will load the wrong module!
        return True


Also, I found that pressing Ctrl-C doesn't always quit pylint with a
KeyboardInterrupt, but instead continues the program.
I'll try to find if there is a bare "except:" statement which eats
all exceptions... KeyboardInterrupt and SystemExit should not be
caught.

Bravo again for your good tool,

--
Amaury Forgeot d'Arc
Ubix Development
www.ubitrade.com