Skip to content

feat: add support for cognitive complexity analysis in Java #238

@askpt

Description

@askpt

Summary

Add support for analyzing and displaying Cognitive Complexity metrics for Java files using the Visual Studio Code extension.

Motivation

Java is one of the most popular languages in modern software development. Supporting Java will significantly broaden the reach and applicability of this extension, enabling teams to measure cognitive complexity across polyglot codebases.

Acceptance Criteria

  • Cognitive Complexity analysis is available for Java files (.java).
  • Analysis aligns with SonarSource's Cognitive Complexity specification as applied to Java syntax.
  • CodeLens overlays show complexity scores above each function/method in Java files, using familiar color coding (green/yellow/red) based on user-configured thresholds.
  • Configuration options (thresholds, enabling/disabling CodeLens, etc.) are updated to allow/disable Java analysis, as done for other supported languages.
  • Automated tests verify the accuracy of Java complexity analysis logic.

Out of Scope

  • Non-Java language changes not directly required for enabling Java support.

Additional Notes

  • Implementation should utilize a language parser such as Tree-sitter or equivalent to enable accurate metric calculation for Java code, mirroring techniques and abstractions used for C# and Go analyzers.
  • Be mindful of Java-specific language constructs (lambdas, nested classes, anonymous classes, etc.).

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions