/code-complexity-plugin

Plugin for Intellij IDEA to calculate complexity for your code right into the editor. Works for Java and Kotlin

Primary LanguageKotlin

Code Complexity plugin for IDEA

Build Version Downloads

This plugin calculates code complexity metric right in the editor and shows the complexity in the hint next to the method/class. It's based on the Cognitive Complexity metric proposed by G. Ann Campbell in Cognitive Complexity - A new way of measuring understandability.

Works with Java, Kotlin, and Python.


Example hints

Installation

  • Using IDE built-in plugin system:

    Settings/Preferences > Plugins > Marketplace > Search for "code-complexity-plugin" > Install Plugin

  • Manually:

    Download the latest release and install it manually using Settings/Preferences > Plugins > ⚙️ > Install plugin from disk...

Score

I chose 8 points as a medium complexity method and use it as 100%. This means that all the methods above 100% are good candidates for splitting/improving. The formula is: percentage = points / 8 * 100

Release

  • Update version in gradle.propertied
  • Update version and description in CHANGELOG.md
  • Run ./gradlew publishPlugin
  • Push to repo with the proper tag

Plugin based on the IntelliJ Platform Plugin Template.