Changes between Version 34 and Version 35 of GSoC/2014/TestingFrameworkForGRASS


Ignore:
Timestamp:
Jun 4, 2014, 8:46:05 PM (10 years ago)
Author:
wenzeslaus
Comment:

list of static analysis tools for Python

Legend:

Unmodified
Added
Removed
Modified
  • GSoC/2014/TestingFrameworkForGRASS

    v34 v35  
    234234Concerning static source code analysis, it seems that it is better to do it separately because it depends more on source code files or, in case of Python, modules and packages while tests seems to have their own structure. Also static source code analysis is not related to testing itself, although it is, for sure, part of quality assurance. However, it must be noted that some part of analysis can be one test case as suggested by [http://pep8.readthedocs.org/en/latest/advanced.html#automated-tests pep8 documentation] (test fails if code style requirements are not fulfilled). This could integrate `pep8` with testing framework in an elegant way but it would require each `testsuite` to explicitly request this check.
    235235
     236For the static analysis of Python code, there is several tools commonly (i.e. in repositories of Linux distributions) available, most notably pep8, Pylint, and Flake8. Table of tools and their features (June 2014):
     237
     238|| tool || focus || HTML report || imports modules ||
     239|| [https://pypi.python.org/pypi/pep8 pep8] || style ([http://legacy.python.org/dev/peps/pep-0008/ PEP8]) || no || no ||
     240|| [http://www.pylint.org/ Pylint] || errors and style || yes || [http://docs.pylint.org/faq.html#why-does-pychecker-catch-problems-with-imports-that-pylint-doesn-t no] ||
     241|| [http://pychecker.sourceforge.net/ PyChecker] || errors || || yes ||
     242|| [https://pypi.python.org/pypi/pyflakes PyFlakes] || errors || || ||
     243|| [https://pypi.python.org/pypi/mccabe McCabe complexity checker] || code [http://en.wikipedia.org/wiki/Cyclomatic_complexity cyclomatic complexity] || ||
     244|| [https://pypi.python.org/pypi/flake8 Flake8] || combines !PyFlakes, pep8, and mccabe || yes || ||
     245
    236246The determining code coverage of the tests must be done during testing. Speaking about Python, some more advanced testing frameworks includes code coverage tools in them, namely [http://nedbatchelder.com/code/coverage/ coverage]. Since `unittest` does not include `coverage`, GRASS will have to incorporate `coverage` into its testing framework. The basic usage is rather simple. If we consider that all is running in one Python process, we can just put the following (rather messy) code into some module which will be loaded before the tests will start (the main invoking script would be of course the best place):
    237247{{{