Druid: Make IntelliJ inspection "Use of Properties object as a Hashtable" a error

Created on 5 Jun 2019  路  7Comments  路  Source: apache/druid

90+ violations in Druid code.

Area - AutomatioStatic Analysis Contributions Welcome

Most helpful comment

There is a Gradle plugin for that: https://github.com/JetBrains/inspection-plugin

Lately, I frequently have a thought that it would be nice to move the project to Gradle because Maven builds take too long. Gradle's incremental builds are much more powerful.

All 7 comments

Hi, @leventov . Don't know if there is a way to add the Inspection check to the Maven build process? Similar to the forbidden plugin, if the code does not conform to the rules, the compilation process will fail directly.

I don't know if there is such a way. But making inspection a error makes TeamCity build to fail if there are violations, so the rule is statically enforced in the codebase.

@leventov OK, I got. It seems that it can only be checked statically by TeamCity :smile:

It would be awesome if we could figure out a way to run the inspections through Maven. That way anyone building a patch can get a preview of what CI will say without needing to use IDEA. I did a brief internet search and didn't find anything that looked useful, but it might be there with some more looking (or maybe we can use the maven exec plugin + a CLI inspection tool if it exists).

@gianm Thank you for your help in finding out if there is a workable solution. I just found a Cli tool on the official website of jetbrains. We can parse the inspection rules with the sh /Applications/IntelliJ\ IDEA.app/Contents/bin/inspect.sh /code/druid /code/druid/.idea/inspectionProfiles/Druid.xml /code/druid/inspection-results-dir -v2 -d /code/druid/core command. Finally, generate a validation report in xml format under the specified directory. So, can we use it with the exec-maven-plugin?

There is a Gradle plugin for that: https://github.com/JetBrains/inspection-plugin

Lately, I frequently have a thought that it would be nice to move the project to Gradle because Maven builds take too long. Gradle's incremental builds are much more powerful.

@gianm Thank you for your help in finding out if there is a workable solution. I just found a Cli tool on the official website of jetbrains. We can parse the inspection rules with the sh /Applications/IntelliJ\ IDEA.app/Contents/bin/inspect.sh /code/druid /code/druid/.idea/inspectionProfiles/Druid.xml /code/druid/inspection-results-dir -v2 -d /code/druid/core command. Finally, generate a validation report in xml format under the specified directory. So, can we use it with the exec-maven-plugin?

The downside is you still need to have Intellij installed and it can't be running when you run the inspection (according to their docs).

Was this page helpful?
0 / 5 - 0 ratings