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

devon formatter not having same values like Sonar plugin #136

Open
rhobolic opened this issue Feb 18, 2022 · 4 comments
Open

devon formatter not having same values like Sonar plugin #136

rhobolic opened this issue Feb 18, 2022 · 4 comments

Comments

@rhobolic
Copy link

If I'm using the devon ide (devon4j) without touching everything I get issues in Sonar though I use the devon sonar plugin also without changes.

Problem description:
As an example here is to take the checkstyle rule which is also part of devon java profile "Intendation". When I look into the profile I see the following configuration.
image
But if I look into the formatter in the ide there is the following configuration
image
Therefore Sonar is throwing an issue. There are also other issues like "Import order" or "Line length"

Expectation
Devon ide, devon formatter and devon sonar plugin have the same values and work out of the box without throwing issues.

@rhobolic rhobolic added the bug label Feb 18, 2022
@hohwille
Copy link
Member

hohwille commented Jun 10, 2022

@rhobolic thanks for reporting this bug.
Indeed this is very odd and kind of frustrating.
I am not sure why this happened. Indentation in devonfw has been 2 white spaces from the very beginning (even in oasp4j).
After all the default rules and especially the whitespace rules for checkstyle are defined here:

<key>com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck</key>

As we can see the parameters are simply wrong:

I will simply change this and set the indentation to 2 instead of 4.

BTW:

If I'm using the devon ide (devon4j) without touching everything I get issues in Sonar though I use the devon sonar plugin also without changes.

As a lot of people seemed to get confused with devonfw artifacts here are some hints to match them properly:

@hohwille
Copy link
Member

hohwille commented Jun 10, 2022

For the record: There are several very picky checkstyle rules active in our config that should also be discussed:

  • JavadocTagContinuationIndentationCheck - is that really something to verify and address on the level of SonarQube. Eclipse might format this different from IntelliJ and in the end it does not matter at all for real quality so discussing about things like this is pure waste.
  • CyclomaticComplexityCheck with a max of 10 might also be kind of dangerous. While in general this is not such a bad idea, the metric is defined in a very stupid way and some case statements or if cascades can easily cause a complexity higher than 10. If this results in developers splitting the code that belongs perfectly together into separate methods just at some random point only for the sane of the rule the quality will not increase but decrease.

There might be more in this regard. I can do some testing on this and file a new issue for it if applicable...

@hohwille
Copy link
Member

I assume that this issue is fixed and can be closed. However, my tests are currently blocked by #141.

@hohwille
Copy link
Member

Another interesting fact is that the file that I initially created came from here and is still present:
https://github.com/devonfw/ide-settings/blob/master/sonarqube/profiles/Devon-Java.xml

It has correct indentation configured and lots of other differences.
So something went wrong when PR #56 was implemented.

@hohwille hohwille added this to the release:2022.04.001 milestone Jul 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants