Questions tagged [checkstyle]

Checkstyle is a static analysis tool for checking compliance of Java code to standards. It can be configured with various sets of coding standards. It is integrated in various other tools, such as IDEs (like Eclipse, NetBeans or IntelliJ), Maven, Gradle, or the continuous inspection platform SonarQube.

checkstyle
357 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
2 votes
1 answer
947 views

What is the exact Google Java Format version used by CheckStyle 9.3?

I use Checkstyle 9.3 (because I'm still using JDK 8). I'm wondering what is the exact Google Java Format version used by that Checkstyle version? I'm referring to the following file: https://github....
Jonathan Poulin's user avatar
2 votes
1 answer
2k views

How to supress checkstyle HideUtilityClassConstructor rule for classes with main method?

I want to suppress 'HideUtilityClassConstructor' rule the for classes that have main method. That look like this: import org.springframework.boot.SpringApplication; import org.springframework.boot....
Yurii Bondarenko's user avatar
2 votes
1 answer
430 views

View checstyle XML results from Azure DevOps pipeline

I have a pipeline in Azure DevOps that generated checkstyle report as an artifact in XML format. I'm looking for ways how to show the results of the checkstyle run like we are showing test results on ...
AnnaL's user avatar
  • 121
2 votes
0 answers
28 views

Can I re-use Checkstyle formats?

Imagine a hypothetical Checkstyle pattern where I want to enforce that all parameters are prefixed with param. Then I would end up with something like this: <module name="CatchParameterName&...
TTT's user avatar
  • 6,705
2 votes
0 answers
58 views

Checkstyle module/property to control the alignment of the Javadoc at-clauses

Is there any Checkstyle module/property to control the alignment of the Javadoc at-clauses? I would like to check the existing at-clauses which are aligned to the same column, to fix them to be left-...
y.luis.rojo's user avatar
  • 1,813
2 votes
1 answer
2k views

Exception during Checkstyle scan in Intellij

I installed Checkstyle-Idea plugin, imported the checkstyle file and ran the scan using my rule from the dropdown. I was greeted with the exception below: Unexpected Exception Caught The scan failed ...
intoTHEwild's user avatar
2 votes
0 answers
795 views

How to implement checkstyle to spock testing?

I have added checkstyle.xml file in my spring boot project. it`s checking my java files but not working for groovy files. I want spock test files to be checked. I have added test file path in gradle ...
Rasul Jafarov's user avatar
2 votes
0 answers
64 views

Enforcing parameter position in java methods using style checker

We have a use case where data is partitioned by a partitionId and this partitionId is used in multiple places. From the code readability, it will be much more easier if this partitionId is the first ...
user401445's user avatar
  • 1,014
2 votes
0 answers
431 views

Intellij IDEA import checkstyle scheme doesn't work properly

I am currently configuring checkstyle for my Intellij IDEA and found out that when I import checkstyle config for my code style (Editor/Code Style/Import Scheme/CheckStyle Configuration) the config ...
dvelopp's user avatar
  • 4,235
2 votes
0 answers
239 views

Can I set failures threshold for gradle checkstyle plugin?

To mandate developers to fix their checkstyle issues, I'd like to change ignoreFailures = true to a threshold, and I will decrease the threshold gradually. Ideally it should be something like a ratio ...
Leon's user avatar
  • 3,204
2 votes
1 answer
133 views

PMD/Checkstyle reports during compilation Gradle

I am trying to generate PMD and Checkstyle reports during the compileJava and compileTestJava tasks in my gradle build. By default, the PMD and Checkstyle plugins only report bugs during the check and ...
NPC 1821622's user avatar
2 votes
1 answer
4k views

CheckStyle: JavaDoc <p> Separator Violations

I have the following JavaDoc, with a <p> separator but (1) no blank lines and (2) the text after <p> continues on the next line, all of which is normal. /** * Fetches a list of Org beans ...
gene b.'s user avatar
  • 11.3k
2 votes
0 answers
4k views

Unable to create Root Module: config {...config/strict_checkstyle.xml}, classpath {null}

We have a Gradle script that runs Checkstyle: apply plugin: 'checkstyle' checkstyle { configFile rootProject.file('config/strict_checkstyle.xml') ignoreFailures false showViolations true ...
tir38's user avatar
  • 10.1k
2 votes
1 answer
1k views

maven checkstyle plugin creates an output file and fails checking it

I have a question regarding the maven checkstyle plugin. The problem is that it creates an output file and fails because that file does end with new line (which the plugin is supposed to check for): [...
user3208049's user avatar
2 votes
1 answer
2k views

Indentation checkstyle error on array initializer argument

I'm having an issue when defining an annotation that contains array initializer. The error is '}' has incorrect indentation level 0, expected level should be 8.[IndentationCheck] about this line: ...
David Barda's user avatar
  • 1,000
2 votes
1 answer
5k views

Location for `checkstyle-suppressions.xml`?

On git push heroku master, I am getting this error: Unable to find suppressions file at location: etc/config/checkstyle-suppressions.xml: Could not find resource 'etc/config/checkstyle-suppressions....
VikR's user avatar
  • 4,944
2 votes
0 answers
327 views

Parse Shellcheck output in Eclipse problems view

I'm working on a mixed language integration project involving copious amounts of Bash. We use Eclipse as our IDE due to its tight integration with our SCM (not Git). I have successfully configured a ...
Chris's user avatar
  • 414
2 votes
0 answers
282 views

How to miss Checkstyle rule for final variables?

I have a next rule in my checkstyle.xml : <module name="MemberNameCheck"> <!-- Validates non-static members against the supplied expression. --> <metadata name=...
Michael Abyzov's user avatar
2 votes
0 answers
864 views

How to Skip Checkstyle Analysis for few lines of code in SonarQube

As part of SonarQube checkstyle analysis, we need to skip few lines of code from being analysed. In the java code, we are using this format: //CHECKSTYLE:OFF .... .... //CHECKSTYLE:ON So, ...
Ron Thomas's user avatar
2 votes
1 answer
1k views

Maven Checkstyle not working

I have the following modules set in my checkstyle.xml under the TreeWalker module <module name="NestedIfDepth"> <property name="max" value="3" /> </module> <module name="...
Ayan Pal's user avatar
  • 125
2 votes
0 answers
108 views

SuppressionFilter in checkstyle.xml read by Codacy?

Are SuppressionFilters in checkstyle.xml are followed by Codacy? <module name="SuppressionFilter"> <property name="file" value="checkstyle-suppressions.xml"/> </module> So ...
Gayan Weerakutti's user avatar
2 votes
1 answer
517 views

Override some modules in a checkstyle file

There is a checkstyle rules xml file that is published company-wide. Some of the rules in that file do not conform to standards deployed by our team. I want to override certain checks by writing my ...
Aki008's user avatar
  • 403
2 votes
1 answer
91 views

What is Advanced module tab in Eclipse checkstyle plugin used for?

I am studying about checkstyle and eclipsecs plugin. When I create new "check" (by open new module), i noticed that they have Advanced tab with some strange features inside: id, comments, tokens (...
user2280005's user avatar
2 votes
0 answers
291 views

Same code format with intelliji than with maven

Currently in my project, we format the code by using intelliji. Is there a way to configure maven checkstyle so it check the same rules than intelliji use?
sab's user avatar
  • 4,720
2 votes
1 answer
373 views

Checkstyle indentation without specifying "size"

I'm using Checkstyle to do some audits on code submitted by students in a university programming class. I want to confirm that the code has consistent indentation, but I don't want to impose the ...
jthurman's user avatar
  • 465
2 votes
1 answer
763 views

Replacing Deprecated Gradle LoggingManager.setLevel() for Checkstyle

I use the Checkstyle plugin in my Gradle build. Checkstyle produces too much output when Gradle is run with the -info flag. I asked for help with this in this question and the solution was to add ...
Adam's user avatar
  • 682
2 votes
0 answers
1k views

Codestyle / formatter to automatically split/wrap strings in Eclipse when surpassing a certain length

I know we have this question from 2008 and this question from 2012, both stating we can just hit enter in a long String, and it will automatically put a "newline indent + " in between. But since we ...
Kevin Cruijssen's user avatar
2 votes
0 answers
519 views

Maven Checkstyle plugin on Travis CI ignores source directories

I have a project on GitHub, that builds on Travis CI. It was running more or less fine until today. I updated configuration and now it uses different paths. I integrated Delombok with my build and ...
Rafał Wrzeszcz's user avatar
2 votes
1 answer
1k views

Checkstyle config file from dependency jar

I am trying to apply the checkstyle plugin to my gradle project. The configuration of which is in a seperate, shared jar dependency: project.apply plugin: StaticAnalysisPlugin class ...
75inchpianist's user avatar
2 votes
1 answer
2k views

How to use checkstyle:check in a multi module project

I'm trying to use Maven Checkstyle plugin in a multi module project. The default setting for <sourceDirectories> (where the plugin to start looking for code) is ${project.compileSourceRoots}. ...
Mr Baloon's user avatar
  • 2,746
2 votes
1 answer
2k views

Can't configure Checkstyle in Maven multimodule project

I'm working with Java multimodule project in Eclipse. And I have to configure Checkstyle to my Maven build and fail the build in case of any violations. I've found the recomendation on this site to ...
Luchnik's user avatar
  • 1,077
2 votes
1 answer
2k views

Getting issue in checkstyle plugin in gradle script

Below is my gradle script and I am trying to use checkstyle plugin but I am getting some issue while using it. apply plugin: 'java' apply plugin: 'jacoco' apply plugin: 'findbugs' apply plugin: 'pmd' ...
unknown's user avatar
  • 1,865
2 votes
1 answer
195 views

How does maven checkstyle plugin work for both building and reporting?

I'm using this dependency: <dependency> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-checkstyle-plugin</artifactId> <...
user2951267's user avatar
2 votes
1 answer
363 views

Can the maven checkstyle plugin be used to make sure that test classes have timeout rules?

The maven documentation doesn't seem to cover this: Is it possible to enforce rules for all classes (such as that all classes should have a log property defined), or for just specific classes (all ...
blueberryfields's user avatar
2 votes
0 answers
118 views

CheckStyle warning unable to recognize exceptions like ServletException, HibernateException

I'm working on cleaning up my code by adding checkstyle warning configurations for my project. In this process, I added a module name RedundantThrows in sun_checks.xml. I see the following warnings, ...
Geetha Lavanya's user avatar
2 votes
0 answers
202 views

Eclipse checkstyle plugin - Can I customize my .xml to apply different max value checks for java files?

Is it possible to customize my .xml file(s) in Eclipse Kepler to accomplish the task I've outlined below? If yes, then how is it done? Here is my specific example scenario to help provide context. ...
HeIsIdeus's user avatar
2 votes
0 answers
213 views

Updating a sonar quality profile programmatically

I created a sonar plugin, which extends the sonar checkstyle plugin by adding more custom made checkstyle checks. The plugin also creates a new quality profile with all my rules, when I restart the ...
Steffen's user avatar
  • 31
2 votes
0 answers
301 views

Jenkins: Email checkstyle report

I have configured Jenkins to generate Checkstyle report. Now I want to get email of this report on regular basis say every week. How to configure Jenkinsto email this report
Dhruv's user avatar
  • 10.5k
2 votes
1 answer
373 views

Applying rule on file name with checkstyle?

I am using Checkstyle via the Eclipse plugin Eclipse-cs. I want to force my HTML files to use a specific pattern for the name. I want my all HTML files to use this convention for naming: test-...
emilly's user avatar
  • 10.3k
2 votes
0 answers
668 views

FindBugs non-transient non-serlizable error for XMLGregorianCalendar and class relies on internal api classes

I'm using FindBugs 2.0.2. While validating my project with findbugs i'm getting following errors: In class com.vo.Account Field com.vo.Account.startDat Actual type javax.xml.datatype....
nag's user avatar
  • 31
2 votes
1 answer
335 views

SQE plugin on Java EE project

Upon importing a Java EE project, I can't seem to find any annotations regarding Code Quality. The option "Run All Quality Tools", "Run Findbugs", "Run Checkstyle" are disabled. Is the SQE plugin not ...
nathan's user avatar
  • 9,336
2 votes
0 answers
121 views

Make warning in Checkstyle if field is non private and does not have annotation

Is there any way to make warning with Checkstyle if field is non private and it do not have one of annotations? i.e.: public class Foo { private String mBoo; // this is OK public String mBad; ...
MAGx2's user avatar
  • 3,169
2 votes
0 answers
674 views

Including Checkstyle suppressions in SonarQube Checkstyle Permalink to use in Eclipse

I want to use Sonar's Checkstyle configuration in our Eclipse environment for on-compile-time analysis of our rules. Therefore I've already included the permalink of Sonar's quality profile in Eclipse ...
Alexander B's user avatar
  • 1,023
2 votes
1 answer
1k views

scalastyle producing empty output

I've been working on adding scalastyle to my scala project to check for potential problems in the code. But I keep getting empty results in the scalastyle-result xml file. I've followed the steps ...
static0886's user avatar
2 votes
1 answer
860 views

Unable to run more than one plugins in gradle

I have configured pmd, checkstyle and findbugs plugins in gradle.build file as i want to maintain the quality the codeline. Part of my build.gradle property is: task wrapper(type: Wrapper) { ...
Here to Learn.'s user avatar
2 votes
1 answer
585 views

Use checkstyle configuration from plugin when generating eclipse files from maven

I have a common artifact where I store build-tools configuration files, e.g. checkstyle, pmd etc. I can access the files and everything works as expected when I run from the console. The ...
Mathias Åhsberg's user avatar
2 votes
0 answers
213 views

Best way to synchronize eclipse developer environment and integration environment?

Working on a large project which has spawned a new "side" project. Not quite a child of the first, more like a plugin of substantial size. For various reasons we have decided to develop this new ...
S73417H's user avatar
  • 2,661
2 votes
0 answers
131 views

Custom AuditListener integration with eclipse-cs

I've written a custom AuditListener that works fine when run from the command line using maven, but when trying with checkstyle inside eclipse I get the following error message - "cannot initalize ...
Ed Cresswell's user avatar
2 votes
1 answer
1k views

Suppressionfilter doesn't work in checkstyle config file

Can anybody say why suppression filter doesn't work? It still generates javadoc errors for Candidate_ file. checkstyle.xml `... <module name="SuppressionFilter"> <property name="...
Shikarn-O's user avatar
  • 3,367
2 votes
1 answer
656 views

SonarQube CRLF detection using checkstyle rules

After migrating maven-checkstyle-plugin to SonarQube, I face some oddity how line feeds and tab chars are transfered. Back in my Maven build I had the following substantial rules: <module name="...
Robert Heine's user avatar
  • 1,830

1
2
3 4 5
8