Skip to content
This repository has been archived by the owner on Dec 27, 2023. It is now read-only.
/ sonar-rules Public archive

SonarQube Custom Java Checks

Notifications You must be signed in to change notification settings

frieder/sonar-rules

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SonarQube Custom Java Checks

This project provides a few simple checks for Java to demonstrate the implementation and use of custom rules in SonarQube.

  • NullableReturnCheck - Shows an issue on INFO level to the developer suggesting to consider using java.util.Optional or io.vavr.control.Option instead of a potentially nullable return value. Implementation is done using the visitor pattern available in Sonar.
  • NullnessAnnotationCheck - Forbids the use of any nullness annotations besides those of the Checker Framework. The rule itself is marked deprecated. There is a more generic approach available that does not require a custom rule -- rule templates.
  • VavrPublicSignatureCheck - Forbid the use of vavr.io classes in public API. This includes public/protected methods used in interfaces and abstract classes.

Check the setup page to get a brief overview of how to install this plugin.

Known Issues

It seems that Sonar is not able to catch type annotations. Both the NullnessAnnotationCheck as well as the OOTB template "Track uses of disallowed classes" are not able to match the use of a forbidden annotation.

About

SonarQube Custom Java Checks

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published