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 for a monthly email with Full Stack Python tutorials. No spam ever.

Sponsored By

Rollbar logo

Fix errors in your Python code before your users see them by monitoring with Rollbar.


Mapbox logo.

Easily build maps, search and navigation into your Python applications with Mapbox.


Scout logo

Scout monitors the performance of your Python apps, identifying slow queries, memory bloat, and more. Free during Tech Preview.


Real Python logo

Upgrade your Python skills by reading Real Python's awesome programming email newsletter.

Full Stack Python

Full Stack Python is an open book that explains concepts in plain language and provides helpful resources for those topics.
Updates via newsletter, Twitter & Facebook.

Matt Makai 2012-2018