Checking Requirements
Fulfil the Contributing Requirements๐
Run mvn verify
before Submitting Changes to check if your change
meets the project's requirements regarding code style and quality.
GitHub Actions (automated code check on GitHub) will also verify these requirements when you open the pull request.
If any requirements are not met, mvn verify
will fail with this log message:
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
Failed to execute goal
. Here's a guide how to fix any requirement violations:
Visit the PMD Page for general info.
PMD mainly checks for code smells. PMD's errors look like this:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-pmd-plugin:3.14.0:check (default) on project betonquest: You have 1 PMD violation.
[INFO] PMD Failure: org.betonquest.betonquest.BetonQuest:143 Rule:AvoidLiteralsInIfCondition Priority:3 Avoid using Literals in Conditional Statements.
AvoidLiteralsInIfCondition
in the search bar and click on the rule.
You will get a detailed description about what is wrong.
If you still don't know how to solve it, ask the developers on Discord for help with PMD.
Visit the SpotBugs Page for general info.
SpotBugs searches for additional problems, most of them are potential bugs. SpotBugs' errors look like this:
Failed to execute goal com.github.spotbugs:spotbugs-maven-plugin:4.2.2:check (default) on project betonquest: failed with 1 bugs and 0 errors
[ERROR] Medium: Null passed for non-null parameter of org.betonquest.betonquest.utils.PlayerConverter.getPlayer(String) in org.betonquest.betonquest.BetonQuest.condition(String, ConditionID) [org.betonquest.betonquest.BetonQuest, org.betonquest.betonquest.BetonQuest] Method invoked at BetonQuest.java:[line 349]Known null at BetonQuest.java:[line 344] NP_NULL_PARAM_DEREF
NP_NULL_PARAM_DEREF
at the end of the line you can simply search it on the
SpotBugs page.
If you have problems solving these kinds of issues you can ask on our Discord for help with SpotBugs.
Visit the CheckStyle Page for general info.
CheckStyle checks the code formatting and style. We have only configured two checks.
The first check is the import order, and the second check is that you do not use star imports,
excepting some junit imports.
There is only a basic check for the imports, and it looks like this:
[ERROR] src/main/java/org/betonquest/betonquest/BetonQuest.java:[16,1] (imports) ImportOrder: Wrong order for 'edu.umd.cs.findbugs.annotations.SuppressFBWarnings' import.
In the above error you can find e.g.
ImportOrder
and you can search on the
CheckStyle page for it.
If you need help solving an issue here, you can also ask us on our Discord for help with CheckStyle.
Visit the EditorConfig Page for general info.
EditorConfig it natively supported by many IDEs and editors.
It checks for some really basic formatting like brackets, line endings, indention and some more.
EditorConfig violations look like this:
[ERROR] There are .editorconfig violations. You may want to run
[ERROR] mvn editorconfig:format
[ERROR] to fix them automagically.
[ERROR] src\main\java\org\betonquest\betonquest\BetonQuest.java@284,54: Delete 5 characters - violates trim_trailing_whitespace = true, reported by org.ec4j.linters.TextLinter
mvn editorconfig:format
or use an IDE that support EditorConfig.