FAQ Database Discussion Community


How to require tab-indentation with CheckStyle?

eclipse,tabs,indentation,checkstyle
In CheckStyle there is a module (File Tab Character) that checks that there are not tab-characters in the source code. Their rationale is: Developers should not need to configure the tab width of their text editors in order to be able to read source code. From the Apache jakarta coding...

How to activate PMD and Checkstyle in SonarQube

sonarqube,checkstyle,pmd,code-quality
I recently installed SonarQube 5. And I found that PMD and Checkstyle was not installed. I installed both of them via the update center. but I didnt find a way to activate them in the analyze of the projects. Please help...

Checkstyle eclipse plugin: error cannot initialize module TreeWalker Token “WILDCARD_TYPE”

java,eclipse,eclipse-plugin,checkstyle
I have a problem with eclipse checkstyle plugin, i just installed this one and when i execute checkstyle-configuration with sun_checkstyle(eclipse) on java file, i have this error: cannot initialize module TreeWalker - Token "WILDCARD_TYPE" was not found in Acceptable tokens list in check com.pupp[email protected]2261fbd cannot initialize module TreeWalker - Token...

How to make Checkstyle ignore missing JavaDoc whenever there is a specific annotation

java,checkstyle
I want to customize the Checkstyle JavadocVariable rule, so that it does not complain about a field that is has a @FindBy annotation. class Demo{ @FindBy(id = "new-button") public WebElement createButton; //<- no JavaDoc required because it is a field "injected" by selenium public String otherField; //<- complain about missing...

Checkstyle validation fail when needs multiple lines

regex,eclipse,checkstyle
I need to perform a validation rule on eclipse checkstyle, after a key { of method and before end key } should have a empty line, example: public void wrongMethod() { System.out.println("wrong method"); } correct public void correctMethod() { System.out.println("correct method"); } I try to use a RegexpMultiline in checkstyle...

mvn checkstyle:checkstyle uses wrong configuration when using reporting

java,maven,checkstyle
Im facing the following problem. I have set up my checkstyle with the following configuration: <reporting> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-checkstyle-plugin</artifactId> <version>${checkstyle.plugin.version}</version> <inherited/> <configuration> <configLocation>${basedir}/checkstyle.xml</configLocation> <includeTestSourceDirectory>true</includeTestSourceDirectory>...

Eclipse Checkstyle - unable to parse configuration stream

java,xml,eclipse,checkstyle
Trying to add suppressions.xml to my checkstyle. However I am not able to pick the Workspace-Path to my suppressions.xml File. <module name="SuppressionFiler"> <property name="file" value="${workspace_loc}/com.test.checkstyle/conf/suppressions.xml"/> </module> I always get an Error with: Error running builder 'Checkstyle Builder' on project 'Checkstyle_Test'. unable to parse configuration stream - Property ${workspace_loc} has not...

How to specify relative path to checkstyle config in root project in gradle 2.2+

gradle,checkstyle
I have the following project structure: project checkstyle checkstyle.xml subproject1 ... subproject2 ... build.gradle My configuration for checkstyle in the build.gradle is as follows: allprojects { apply plugin: 'checkstyle' checkstyle { configFile = 'checkstyle/checkstyle.xml' as File } } When I was using gradle 2.1, build worked OK. After upgrading to...

How to compile project with Google Checkstyle rules with gradle?

java,gradle,checkstyle
I am trying to use Google checkstyle configuration (https://github.com/checkstyle/checkstyle/blob/master/src/main/resources/google_checks.xml) but I am constantly getting an error on gradle check: Unable to create a Checker: cannot initialize module TreeWalker - Unable to instantiate EmptyCatchBlock I used Gradle to build the project. Below is my gradle.build. apply plugin: 'java' apply plugin: 'idea'...

Eclipse Checkstyle Plugin installed but not visible

eclipse,eclipse-plugin,checkstyle
I have installed the plugin checkstyle 6.2.0 in Eclipse Java EE Kepler 4.3.2 , but I am not able to see the Checkstyle option under Windows -> Preferences. Checkstyle is getting displayed in the installed software list. What could be the reason?...

Shortcut key in Eclipse to fix Checkstyle warnings “Parameter xxx should be final”

java,eclipse,checkstyle
Is there any shortcut key to fix all the issues shown with the warning Parameter xxx should be final? In my application the same warning is shown 134 times. See the below code: @Override public void onSuccess(Object result) { // Parameter result should be final } Is there any shortcut...

Maven checkstyle error : Expected @param tag for ''

java,maven,generics,checkstyle
I have following method with generic types, but when I run maven checkstyle(maven-checkstyle-plugin, 2.121) it kept gives me Expected @param tag for '<T>' error message during maven build. How do I get over with this? /** * Read in specified type of object from request body. * @param request The...

How do I configure checkstyle to flag Javadoc exception @throws comments that shouldn't be there?

java,checkstyle
During refactoring, a lot of the methods in the app I'm working on have had declared exceptions removed. Unfortunately while refactoring, the Javadoc was often ignored and the exception Javadoc @throws comment still exists. How can I get checkstyle to flag this up? I can't see any obvious configuration option....

Show warning if method description is missing

java,eclipse,intellij-idea,checkstyle
In our code base, i see a lot of methods like there: /** * @param tagID * @param startDate * @param endDate * @param estimated * @return * @throws ServerException */ List<String> generateMaster(int tagID, Date date) throws ServerException, BusinessException; Though there is a javadoc present, the description of method is...

Check for double white-space in class declaration

java,checkstyle
How can checkstyle warn about class declarations like this: public static class VERSION { public static int SDK_INT = 20; } There is a double-white space before VERSION, but checkstyle should warn about this, as it should be only one....

Can I get checkstyle to run when I press the Run Android Application button in Android Studio

android,gradle,checkstyle
I have a gradle file that includes checkstyle like so apply plugin: 'checkstyle' check.dependsOn 'checkstyle' task checkstyle(type: Checkstyle) { configFile file("${project.rootDir}/config/checkstyle/xdesign_checkstyle_auto.xml") source 'src' include '**/*.java' exclude '**/gen/**' reports { xml.enabled = true } classpath = files() } In this I have a task called checkstyle where I run the checkstyle...

Check Comments/Javadoc number of words with Checkstyle

java,comments,javadoc,checkstyle
Is it possible to set up a checkstyle rule that will count the number of words from a commment and then shows a problem if the number of words is under a defined limit. I searched on the checkstyle Javadoc properties, but did not found something useful. For Example: /**...