Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.maint.python > #8270

Re: static analysis and other tools for checking Python code

From Nicolas Chauvat <nicolas.chauvat@logilab.fr>
Newsgroups linux.debian.maint.python
Subject Re: static analysis and other tools for checking Python code
Date 2016-03-04 10:30 +0100
Message-ID <r8UdA-4zt-21@gated-at.bofh.it> (permalink)
References <r85E5-1TO-1@gated-at.bofh.it> <r8fN7-l3-3@gated-at.bofh.it> <r8p06-7eU-13@gated-at.bofh.it> <r8A5e-6Bm-45@gated-at.bofh.it> <r8Q9X-1D7-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Hi,

On Fri, Mar 04, 2016 at 01:03:17PM +0800, Paul Wise wrote:
> > That would be https://pypi.python.org/pypi/PyChecker
> > 
> > Pylint has never run code from the source tree.
> 
> I wonder where I got that impression from.
> 
> What about from the module it is checking?
> 
> > "pylint <themodule>" should work fine.
> 
> Unfortunately that needs the module installed to work.
> 
> Is there any way to make it scan the source tree instead?

It *does* read the source and scan the tree.

It *does*not* import or execute the code.

That is the very first goal of pylint: "detect code smells in python
code by staticaly analyzing the syntax tree read from the source".

  $ cat foo.py
  a = b+1
  $ pylint -E foo.py
  No config file found, using default configuration
  ************* Module foo
  E:  1, 4: Undefined variable 'b' (undefined-variable)
  $ mkdir bar
  $ mv foo.py bar
  $ touch bar/__init__.py
  $ pylint -E bar/
  No config file found, using default configuration
  ************* Module bar.foo
  E:  1, 4: Undefined variable 'b' (undefined-variable)

There is even a library named https://pypi.python.org/pypi/astroid
that was extracted out of pylint to make it easier for other tools to
do type inference (and other things) on Python's Abstract Syntax
Trees.

I hope this helps making clearer what pylint can be used for. I had a
look at the README and I suppose the intro section at the top could
state the above goal with more clarity.

-- 
Nicolas Chauvat

logilab.fr - services en informatique scientifique et gestion de connaissances  

Back to linux.debian.maint.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

static analysis and other tools for checking Python code Paul Wise <pabs@debian.org> - 2016-03-02 04:30 +0100
  Re: static analysis and other tools for checking Python code Scott Kitterman <debian@kitterman.com> - 2016-03-02 05:40 +0100
    Re: static analysis and other tools for checking Python code Paul Wise <pabs@debian.org> - 2016-03-02 06:00 +0100
  Re: static analysis and other tools for checking Python code Nicolas Chauvat <nicolas.chauvat@logilab.fr> - 2016-03-02 15:20 +0100
    Re: static analysis and other tools for checking Python code Paul Wise <pabs@debian.org> - 2016-03-03 01:10 +0100
      Re: static analysis and other tools for checking Python code "Paul R. Tagliamonte" <paultag@gmail.com> - 2016-03-03 01:30 +0100
      Re: static analysis and other tools for checking Python code Nicolas Chauvat <nicolas.chauvat@logilab.fr> - 2016-03-03 13:00 +0100
        Re: static analysis and other tools for checking Python code Paul Wise <pabs@debian.org> - 2016-03-04 06:10 +0100
          Re: static analysis and other tools for checking Python code Nicolas Chauvat <nicolas.chauvat@logilab.fr> - 2016-03-04 10:30 +0100
            Re: static analysis and other tools for checking Python code Paul Wise <pabs@debian.org> - 2016-03-04 14:40 +0100
              Re: static analysis and other tools for checking Python code Nicolas Chauvat <nicolas.chauvat@logilab.fr> - 2016-03-04 16:20 +0100
                Re: static analysis and other tools for checking Python code Paul Wise <pabs@debian.org> - 2016-03-05 04:20 +0100
                Re: static analysis and other tools for checking Python code Nicolas Chauvat <nicolas.chauvat@logilab.fr> - 2016-03-05 15:10 +0100
                Re: static analysis and other tools for checking Python code Paul Wise <pabs@debian.org> - 2016-03-06 10:20 +0100
  Re: static analysis and other tools for checking Python code Paul Wise <pabs@debian.org> - 2016-03-03 01:40 +0100
    Re: static analysis and other tools for checking Python code Jeremy Stanley <fungi@yuggoth.org> - 2016-03-03 01:50 +0100
    Re: static analysis and other tools for checking Python code Daniel Stender <stender@debian.org> - 2016-03-04 15:40 +0100
      Re: static analysis and other tools for checking Python code Paul Wise <pabs@debian.org> - 2016-03-05 04:10 +0100
  Re: static analysis and other tools for checking Python code Jeremy Stanley <fungi@yuggoth.org> - 2016-03-03 01:40 +0100

csiph-web