3

I used pyflakes and pylint to statically check for any errors in my code but they are not of much use since they don't go into the the files that the input file uses. For example, if I have a typo in a function I am using from another file and these programs blissfully report no errors. At that point they become useless to me. Are there better alternatives I can use? I guess if I use eclipse it could help me weed out these typos while I am writing code itself but I am using emacs to code. Are there options/tools I can use inside of emacs may be for this? I just found a typo reported after my code runs for a few minutes.

EDIT: 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 from and it uses code from the other files listed.

For e.g. file1.py uses some functions from HelperClasses.py and I made a typo when using the name of the function. Running pyflakes on file1.py reports no errors because it does not see HelperClasses.py while analyzing file1.py

I am looking to find a tool that also looks into the other files it uses as needed.

3
  • What do you mean by "the files that the input file uses" and "a function I am using from another file". Are you using different modules and importing them? If so, you probably just need to run your static code checker on all your modules (though I don't know enough about them myself to give specifics). Commented Jan 31, 2014 at 8:30
  • @Blckknght - I clarified my question better. Any suggestions? Commented Jan 31, 2014 at 8:39
  • 1
    Well, the checker would have to differentiate between "your" other files and system libraries. I think the best would be to write a small script and traverse the entire source directory and check each file therein. Or maybe those checkers already have an option for that... Commented Jan 31, 2014 at 8:52

1 Answer 1

4

You could try flake8. I use it in Sublime as a plug-in. It also exists for Emacs.

To run flake8, just invoke it against any directory or Python module:

$ flake8 --max-complexity 12 coolproject
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.