-
Notifications
You must be signed in to change notification settings - Fork 70
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
Issue #157: SonarQube 7.2+ support #165
Conversation
Regarding the failing CI builds:
|
@muhlba91 , thanks a lot, please resolve conflict of rebase to let easily get your sources. |
@romani rebased onto master as well as squashed commits into one. |
@muhlba91 TeamCity can't be run locally, so you will only see validation on server. It failed with the following:
It might just be a server issue. I tried re-running it. Travis import order violations look valid. You should be able to reproduce by running All CI should be green. |
Does this help any? |
@muhlba91 I peeked at the changes and I am seeing a ton of unnecessary changes that are not related to this PR. This many changes, some which should be wrong or unnecessary, will make this PR very hard to review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@romani We may need to relook at checkstyle setup in this project.
I don't understand why these changes aren't producing violations.
checkstyle-sonar-plugin/src/main/java/org/sonar/plugins/checkstyle/CheckstyleAuditListener.java
Outdated
Show resolved
Hide resolved
checkstyle-sonar-plugin/src/main/java/org/sonar/plugins/checkstyle/CheckstyleAuditListener.java
Outdated
Show resolved
Hide resolved
checkstyle-sonar-plugin/src/main/java/org/sonar/plugins/checkstyle/CheckstyleConfiguration.java
Outdated
Show resolved
Hide resolved
@rnveach i updated as far as I was able to but I couldn't figure out why the tests run through without any issue the first time on Travis (and with local execution) but the second time (after instrumentation) with the error As for the Wercker build, please update the used box so that it's at least SonarQube 7.2, otherwise it fails. |
https://github.com/checkstyle/sonar-checkstyle/blob/master/wercker.yml#L1 @muhlba91 , please send separate PR for |
@muhlba91 , please continue, |
@romani thank you. I have updated to pass the Travis builds now and merged in your branch for the update to 8.12 since I think I had to update as well (I can't remember the reason anymore, tbh). However, the build error with wercker happens due to: wercker expects the container to run as root so that it can create the pipeline directory under |
@muhlba91 As we are waiting on CI to pass, can you please fix up indentation changes in your PR. It is making it very hard to review your work to see what has really changed. Please review your changes being listed under https://github.com/checkstyle/sonar-checkstyle/pull/165/files and make corrections where a change isn't necessary. I am specifically talking about indentation changes in all the POMs. |
@rnveach done as much as possible. |
@muhlba91 , please remove extra changes, squash all in one commit, to let me review all from scratch. |
@romani changes minimized and squashed to one commit. |
Please remove upgrade to checkstyle 8.12 , it has to be done in separate update, PR already sent. Please remove extra indentation. Please move all updates for modern java style to separate commit/PR , I will merge them quickly. I am ok with improvements but not together (in the same commit) as functional change. From wercker CI:
Looks like the try to put something in our container, but previously there was root user, but now now main user is sonarqube. Investigation us required. |
Cleanup done. Regarding the indentation: those should only be within the files I actually changed and are applied by the default IntelliJ formatting. Please provide an export of your formatting config because otherwise I'd have to mess around with my entire configuration to figure out how to configure it to match yours or I'd have to open the files with a normal editor to apply the same indentation for the methods. Regarding Wercker: I mentioned this issue above. As far as I got to know from looking at Wercker (I have never heard of it until now tbh) they do not support moving this |
@romani I am not seeing anything at http://checkstyle.sourceforge.net/idea.html for disabling auto-formatting.
Even if we had a configuration to give you, not everyone uses IntelliJ as their IDE. This would always cause difference issues as one person would always force the formatting to IntelliJ and the other we do what they want as long as Checkstyle doesn't complain. I personally use Eclipse, and I have no auto-formatting turned on because of this. I can manually format specific sets of code that I am writing, but I never run anything on the whole file. I don't know IntelliJ to say how you should configure it and it doesn't seem to be documented on our site, but you will need to find a way to disable it for Checkstyle projects. I have seen other big projects encourage this too. |
@romani updated to remove indentation of methods not touched. |
I need to figure out wercker failure reason and fix it. |
this cause sonarqube webservice to fail on start. Looks like we need to CI for such testing ... |
@muhlba91 , please rebase on latest master code. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
items to improve:
<dependency> | ||
<groupId>com.puppycrawl.tools</groupId> | ||
<artifactId>checkstyle</artifactId> | ||
<version>${checkstyle.version}</version> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
historically sonar plugin required plugin jar have a conflict with sonar over guava version (sonar used very old version of guava).
That is why we have "checkstyle-all" sub project.
Doe sit become not necessary any more ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have tried excluding the checkstyle-all
subproject from all pom files and the entire plugin passes CI and manual tests on SQ 7.5 as well. Hence, I don't really see the purpose of the subproject.
Please check whether we can entirely remove it or additional changes are needed because of this.
public static final String PROPERTY_GENERATE_XML = "sonar.checkstyle.generateXml"; | ||
|
||
private static final Logger LOG = LoggerFactory.getLogger(CheckstyleConfiguration.class); | ||
|
||
private final CheckstyleProfileExporter confExporter; | ||
private final RulesProfile profile; | ||
private final Settings conf; | ||
private final org.sonar.api.config.Configuration conf; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why full name is used ?
I do not see a conflict, please use import.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
conflict is within already used com.puppycrawl.tools.checkstyle.api.Configuration
.
writer.append(filtersXml); | ||
|
||
writer.append(CLOSE_MODULE); | ||
} | ||
|
||
private boolean isSuppressWarningsEnabled() { | ||
final String filtersXml = settings.getString(CheckstyleConstants.CHECKER_FILTERS_KEY); | ||
final String filtersXml = settings.get(CheckstyleConstants.CHECKER_FILTERS_KEY) | ||
.orElse(null); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in other parts of code you fight with null
usage, but keep it here.
Please keep usage of Option as it comes from library, especially when context if this variable is very small.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have kept it in order to require the minimal change of this method. As you have said, code cleanup regarding modern Java syntax/features should be done in a separate PR, I'd see such a change as a separate task.
...style-sonar-plugin/src/main/java/org/sonar/plugins/checkstyle/CheckstyleProfileImporter.java
Outdated
Show resolved
Hide resolved
...style-sonar-plugin/src/main/java/org/sonar/plugins/checkstyle/CheckstyleRulesDefinition.java
Outdated
Show resolved
Hide resolved
...style-sonar-plugin/src/main/java/org/sonar/plugins/checkstyle/CheckstyleRulesDefinition.java
Outdated
Show resolved
Hide resolved
Please also rebase on latest master as there are conflicts. |
@muhlba91 , here is how to run your update on sonarqube 7.4 - #175 (comment), please have this update in your commit to switch circleci to 7.4. but I insist to keep compilation dependency to be 6.7 , but check it in run time on CI on 6.7 and 7.4 Please proceed with your update, we appreciate your help. CI is ready for you. |
looking forward for the new plugin! 👍 |
@romani changes done and also tested manually on SQ 7.5. Please check my comments on the 3 three open conversations of your requested changes. I have included the CircleCI changes but it doesn't seem like the CI is running for any push. Did you enable the integration for PRs? Also, I have kept compatibility with the LTS release. |
Please close this PR, and create new, it should be hooked in circleci and make sure you rebase on latest master |
Issue #157. Basic changes taken from #158, then I updated dependencies of Checkstyle and SonarQube API. I decided to only update SonarQube until 7.2 (7.3 also works) to keep compatibility with 7.2 SonarQube installations. However, I successfully tested analysis in SonarQube 7.3.
Apparently, there were quite a few API changes which meant I had to change the one or the other thing in the files and tests, which explains the huge number of changed files. In addition, I tried to clean up a few code parts using Java 8 language features.
Unfortunately, I wasn't able to get a few tests running (most likely because I wasn't really able to figure out what they are testing specifically and how to fix it) - they are now ignored:
Furthermore, I integrated the upstream Checkstyle config but I need help in fixing the last errors which correspond to the import order. I wasn't able to figure out an IntelliJ setting that made the checks happy.