Python – Python’s recursive code inspector

Python’s recursive code inspector… here is a solution to the problem.

Python’s recursive code inspector

I use pyflakes and pylint to statically check my code for any errors, but they aren’t of much use because they don’t go into the files used by the input file. For example, if there is a typo in a function I use in another file, these programs will happily report that there are no errors. That’s when they became useless to me. Can I use a better alternative? I guess if I use eclipse, it helps me eliminate these spelling mistakes when writing code myself but writing code with emacs. Are there options/tools that I can use in emacs that might be for this? A few minutes after my code was running, I found that a typo was reported.

EDIT: What to clarify here is the code directory structure-

src/
  driver.py
  .DB/
    DBHelper.py
  Analyze/
    file1.py
    file2.py
  Helper/
    HelperClasses.py

driver.py is where the code runs, and it uses code from the other files listed.

For example file1.py used some functions in HelperClasses.py and I made a typo when using the function name. Running pyflakes on file1.py does not report any errors because it does not see HelperClasses.py when analyzing file1.py

I’m looking for a tool that can also see the other files it uses if you want.

Solution

You can try flake8. I use it as a plugin in Sublime. It also applies to Emacs.

To run flake8, simply call it against any directory or Python module:

$ flake8 --max-complexity 12 coolproject

Related Problems and Solutions