Code Metrics

Code metrics can be produced by static code analysis tools to determine complexity and non-standard practices.

Why are code metrics important?

Code metrics allow developers to find problematic codebase areas that may need refactoring. In addition, some metrics such as technical debt assist developers in communicating to non-technical audiences why issues with a system are occurring.

Open source code metrics projects

  • Radon is a tool for obtaining raw metrics on line counts, Cyclomatic Complexity, Halstead metrics and maintainability metrics.

  • Pylint contains checkers for PEP8 code style compliance, design, exceptions and many other source code analysis tools.

  • PyFlakes parses source files for errors and reports on them.

  • Pyntch is a static code analyzer that attempts to detect runtime errors. It does not perform code style checking.

Hosted code metrics services

  • Coveralls shows code coverage from test suites and other metrics to help developers improve the quality of their code.

Code metrics resources

What's next after obtaining code metrics?

I've built a Python web app, now how do I deploy it?

Can I automate testing and deployments for my app?

I want to learn more about app users via web analytics.

Sign up here to receive a monthly email with major updates to this site, tutorials and discount codes for Python books.

Matt Makai 2012-2017