Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[request] Add capability to configure in-code instead of YAML #1041

Open
Tracked by #1694
Starlight220 opened this issue Aug 31, 2021 · 5 comments
Open
Tracked by #1694

[request] Add capability to configure in-code instead of YAML #1041

Starlight220 opened this issue Aug 31, 2021 · 5 comments
Assignees
Labels
question Further information is requested

Comments

@Starlight220
Copy link

This could be used primarily for integration with spotless.

@petertrr
Copy link
Member

Hi @Starlight220 , thanks for your feedback! What exactly do you mean by in-code configuration? Diktat already has an integration with spotless, which accepts yaml configuration. What is your use case for programmatic alternative?

@petertrr petertrr added the question Further information is requested label Aug 31, 2021
@Starlight220
Copy link
Author

Instead of splitting the configuration to the YAML file, having all the format config in one place (the gradle script) would be nice. From the user side, it would either be a map (similar to userData in the ktlint Spotless integration) or properties (which can be backed by the map in the impl).

For configuring of a lot of inspections a separate config file would be better, but in cases where only a few inspections are configured, it'll be much more efficient.

Is this a wanted feature?

@orchestr7
Copy link
Member

orchestr7 commented Aug 31, 2021

@Starlight220 several notes about configuration:

  1. I would actually like to support TOML configuration format together with YAML. So diktat would check which one is provided.
  2. your idea sounds very interesting, but is difficult to implement as we would need to support these configurations (we have many of them) in a gradle config.

I think we should focus on this task, but with a medium priority

@orchestr7 orchestr7 modified the milestone: 1.0.0 Aug 31, 2021
@orchestr7
Copy link
Member

orchestr7 commented Aug 31, 2021

Actually we even have a special generated class called WarningNames.kt. It contains all generated names of warnings.
We can use it to cover this scenario.

In gradle plugin we would have something like this:

config {
    WarningNames.PACKAGE_NAME_MISSING {
        enabled = false,        
    }
}

@orchestr7 orchestr7 pinned this issue Aug 31, 2021
@orchestr7 orchestr7 unpinned this issue Apr 27, 2022
@nulls nulls self-assigned this Sep 20, 2023
@nulls
Copy link
Member

nulls commented Sep 20, 2023

it's duplicated by #1694

@nulls nulls mentioned this issue Nov 30, 2023
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants