Skip to content
This repository has been archived by the owner on Jan 6, 2024. It is now read-only.

Can i make custom rule for 'sonar-kotlin'? #140

Open
Py0zz1 opened this issue Jun 3, 2021 · 4 comments
Open

Can i make custom rule for 'sonar-kotlin'? #140

Py0zz1 opened this issue Jun 3, 2021 · 4 comments

Comments

@Py0zz1
Copy link

Py0zz1 commented Jun 3, 2021

I can create detekt custom rules, but it seems that you cannot create custom rules for sonar-kotlin(sonarqube plugin).
If you can make a custom rule for sonar-kotlin, could you tell me the related data?

@cortinico
Copy link
Member

This has been previously tackled in #1 and #78

The tl;dr is: currently is not that easy. You would have to include a dependency in the pom.xml file of your custom rules and rebuild sonar-kotlin from source with this extra dependency.

@Py0zz1
Copy link
Author

Py0zz1 commented Jun 7, 2021

Hi cortinico.

I want to define custom rule in 'sonar-kotlin' and use it in 'sonarqube'.

May I know the procedure for this?
Here's what I think.

  1. Define custom rules in detekt (like this: https://detekt.github).io/detekt/extensions.html)
  2. Set detekt with custom rules as sonar-kotlin dependency library
  3. Additional work on sonar-kotlin ~~

@cortinico
Copy link
Member

May I know the procedure for this?

What you wrote is essentially correct:

  1. Define a detekt custom rule & create the artifact for it
  2. Fork sonar-kotlin
  3. Add a dependency inside the pom.xml https://github.com/detekt/sonar-kotlin/blob/master/pom.xml to your custom rule
  4. Rebuild your local fork of sonar-kotlin from source

@Py0zz1
Copy link
Author

Py0zz1 commented Jun 7, 2021

I got it. thank you!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants