detekt / detekt-intellij-plugin

detekt plugin for IntelliJ
https://plugins.jetbrains.com/plugin/10761-detekt
Apache License 2.0
290 stars 39 forks source link

Feature request: Provide an ability to select older detekt version to make formatting rules backwards compatible #497

Open sachin-tripactions opened 8 months ago

sachin-tripactions commented 8 months ago

Currently there is no way to match detekt version between the one used in gradle dependencies and the plugin. This matters because the formatting rules (ktlint) used in plugin is always latest while the codebase might be using an older version based on the given compatibility table: https://detekt.dev/docs/introduction/compatibility/#tool-versions. Workaround we have been doing is to manually download an older version of plugin based on the release notes which is not very intuitive.

Requesting a feature where you get to choose detekt version (or formatting rules version specifically) which would somewhat look like this:

Screenshot 2023-10-30 at 10 22 28 PM
arturbosch commented 8 months ago

Related to https://github.com/detekt/detekt-intellij-plugin/issues/125.

Hm, if the plugin would not bundle the formatting jar I think your usecase could be solved by choosing the formatting jar a s a plugin jar.

I wonder if it is possible to bundle an extra jar in the plugin zip and load it on demand but not on startup of the plugin. Like an implicit plugin jar when the Enable formatting option is chosen.

sachin-tripactions commented 8 months ago

your usecase could be solved by choosing the formatting jar a s a plugin jar

I tried this but it breaks the plugin completely somehow. Meaning, no issues gets detected on the fly if I choose a suitable formatting jar in plugin jars manually. This could be a bug.

arturbosch commented 8 months ago

your usecase could be solved by choosing the formatting jar a s a plugin jar

I tried this but it breaks the plugin completely somehow. Meaning, no issues gets detected on the fly if I choose a suitable formatting jar in plugin jars manually. This could be a bug.

Just to be sure, you forked the plugin, removed the formatting dependency and added the formatting jar as a plugin jar?

As the detekt plugin bundles the formatting jar by default, there could be some class conflicts if you just try to add another formatting jar version.