Fork me on GitHub

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

  • Landscape provides free code metrics for open source Python projects. Pricing is available for analyzing private repositories as well.

Code metrics resources

What's next after obtaining code metrics?

How can I continuously evaluate my code with these metrics?

How can I call functions outside the HTTP requests?

What should I do to secure my web application?


Interested in a complete Full Stack Python book with detailed tutorials and example code? Sign up here and you'll get an alert email if a book is created. No other emails will be sent other than sign up confirmation.