Skip to content

Generate # credo:disable* comments and find unneeded ones #1237

@dmarcoux

Description

@dmarcoux

Hi,

I'm introducing Credo in a fairly large project. As a starting point to get us going, I ignore a lot of Credo issues with one of the inline config comments. I generated those with the help of Claude Code. It's somewhat slow, but it works well most of the time. It did happen though that some of the comments it generated were wrong. I had to manually review a lot of files to ensure no comment is superfluous.

So with this in mind, it got me thinking. Would it be possible for Credo to generate those # credo:disable* comments?

I worked a lot with Ruby and this reminds me of RuboCop, a linter for Ruby. It has this feature where you generate the RuboCop configuration and it automatically ignores all offenses it finds. This is a great developer experience and it's super easy to get started this way. Here's a quote from RuboCop's docs on that feature:

If you have a code base with an overwhelming amount of offenses, it can be a good idea to use rubocop --auto-gen-config, which creates .rubocop_todo.yml and adds inherit_from: .rubocop_todo.yml in your .rubocop.yml. The generated file .rubocop_todo.yml contains configuration to disable cops that currently detect an offense in the code by changing the configuration for the cop, excluding the offending files, or disabling the cop altogether once a file count limit has been reached.

As for finding unneeded # credo:disable* comments, I have to make another parallel to RuboCop... sorry I worked in Ruby for many years. It has this nice check where it detects unneeded disable comments. Is this possible in Credo? I haven't found something about this.

Sorry for the wall of text, let me know if I wasn't clear.

Thank you for your work on Credo.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions