Skip to content

Output error message from Detekt to stdout #187

Description

@ryanulep

Currently, when a detekt_test rule fails, the output only includes the rule name and the location of the failure. While this helps identify where the problem occurred, it does not provide visibility into what the underlying issue is, and developers need to either (a) open IntelliJ with the Detekt plugin properly configured, or (b) go to the Detekt documentation for the rule to determine the issue and appropriate fix.

Current output:

==================== Test output for //path/to/target:
NotImplementedDeclaration - [main] at src/main/kotlin/com/example/MyClass.kt:42:5 - Signature=SomeKotlinFile.kt$MyClass$TODO("Not yet implemented")
================================================================================

Better output (or equivalent) based on Java's Error Prone:

================================================================================
src/main/kotlin/com/example/MyClass.kt:42:5 — error: [NotImplementedDeclaration] The NotImplementedDeclaration should only be used when a method stub is necessary. This defers the development of the functionality of this function. Hence, the `NotImplementedDeclaration` should only serve as a temporary declaration. Before releasing, this type of declaration should be removed.
    TODO("Not yet implemented")
    ^
    (see https://detekt.dev/docs/rules/exceptions/#notimplementeddeclaration)
  Did you mean to implement this function?
================================================================================

Or for full structure:

================================================================================
<path_to_file_from_repo_root>:<line_number>:<position> — <error_level>: [Rule.RuleName] <Rule.description>
    <offending_line_of_code>
    ^
    (see <Rule.url_if_non_null>)
  Did you mean <some_potential_fix>?
================================================================================

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions