checkstyle

how to resolve checkstyle_error.xml errors

被刻印的时光 ゝ 提交于 2019-12-12 02:12:49
问题 In my project checkstyle_error.xml shows this error Parameter role should be final. for public void setRole(String role) { but i am not getting why it should be final. And may more space and tab char related error. can any one tell me why is this. any good tutorial to find checkstyle error convention. some more errors i got are: 1. Unused @param tag for 'Integer' /** * Sets id. * @param Integer id */ public void setId(Integer id) { this.id = id; } 2. Expected @param tag for 'id

Checkstyle: Usage of ParenPad Check

半腔热情 提交于 2019-12-11 19:15:44
问题 I am new to Checkstyle though I use it mainly through the Maven Checkstyle plugin. I have a situation where I think Checkstyle lacks flexibility. It could be me, not being familiar with Checkstyle and its configuration options. The problem I have is with the ParenPad check with a token type of METHOD_CALL; I believe. In the majority of the cases I don't allow any spaces after nor before the parenthesis in a method call. e.g. object.method(arg1); Case 1 But when I am using StringBuffer or

Using ${samedir} in Checkstyle-plugins for Gradle and Eclipse

 ̄綄美尐妖づ 提交于 2019-12-11 12:16:52
问题 I use a SuppressionFilter in my checkstyle-configuration. The path to the file suppression.xml is given relative to the checkstyle-configuration, using ${samedir} (http://eclipse-cs.sourceforge.net/#!/properties). Reason: I configured eclipse to use a remote checkstyle-configuration: <module name="SuppressionFilter"> <property name="file" value="${samedir}suppress.xml"/> </module> The same checkstyle-configuration is used by my Gradle build-script. Unfortunately, the checkstyle-plugin for

Ensure that fields with specific annotations are 'private'

自作多情 提交于 2019-12-11 11:53:42
问题 Very common mistake in our code is to write @Mock Object object; @InjectMocks Subject subject; instead of @Mock private Object object; @InjectMocks private Subject subject; This prevents PMD/FindBugs/IntelliJ from issuing warning when the field becomes unused and also our code reviews are bloated with "make this field private" comments. Is there any static-analysis rule in any tool to warn when fields with specific annotations do not have expected visibility? I found Checkstyle's

No output from Checkstyle in ANT

天涯浪子 提交于 2019-12-11 11:18:18
问题 I am not using an automated build tool. Just Checkstyle 5.5 and ANT 1.8. I am trying to have Checkstyle run in my ANT script. The ANT script executes without error, but doesn't seem to call Checkstyle. I get no output except ANT reports BUILD SUCCESSFUL. Here is my ant script: <project name="ccu" xmlns:cs="antlib:com.puppycrawl.tools.checkstyle"> <target name="checkstyle" description="Generates a report of code convention violations."> <cs:checkstyle config="custom_check.xml"> <fileset dir=

Using SonarQube to distribute checkstyle for multiple projects including Suppressions for eclipse

廉价感情. 提交于 2019-12-11 06:44:45
问题 We want to use Sonar as distributor for our checkstyle configuration. This is easy with Sonar's permalinks. The problem are the suppressions. If we add the suppressions global at GeneralSettings → Java → Checkstyle like: <module name="SuppressionFilter"> <property name="file" value="someFolder/suppressed_checks.xml"/> </module> there will be the same suppressions configuration for every checkstyle configuration via the permalink. If we add the SuppressionFilter module only for the checkstyle

Checkstyle for XML, text, properties file formats

时间秒杀一切 提交于 2019-12-11 04:54:38
问题 Can checkstyle be configured to check xml, text, properties file formats. I have a requirment wherein I need to check for certain keywords in java, xml, text etc. file formats. For e.g. if in a text file the text "danger" appears, then I need to inform the user that the text danger appears in this line, please remove it. 回答1: Checkstyle has a regular expression check that can check for any keyword for you. But I don't know how to get it to check non-java files. I think a better tool for this

Automatically generated code fails CheckStyle standards (jHipster)

和自甴很熟 提交于 2019-12-11 02:58:30
问题 I've started working with jHipster on a recent project which is a tool you can use to autogenerate the full stack of a REST api application using a Spring Boot back end. Which should save a great deal of time writing boilerplate code... Unfortunately, at my work we have coding standards to adhere to in the form of a set of CheckStyle rules. Any code that does not adhere to these rules causes the build to fail. What I am experiencing at the moment is that this autogenerated code is failing the

Check Style Indentation violation - 'public' have incorrect indentation level 4, expected level should be 8

喜夏-厌秋 提交于 2019-12-11 02:57:58
问题 I am getting an checkstyle sonar violation on indendation rule (com.puppycrawl.tools.checkstyle.checks.indentation) 'public' have incorrect indentation level 4, expected level should be 8. at this line public Response getItem(@PathParam(CODE) final ProgramCode programCode, In Intelliji, Kindly suggest on how to change the indentation level to 8 回答1: Open up preferences (cmd + , on the Mac, ctrl + alt + s on Windows), and go to Editor -> Code Style -> Java. On the tabs and indents spaces you

Sonar Checkstyle import: Rule template can't be activated on a Quality profile

此生再无相见时 提交于 2019-12-11 02:36:25
问题 I'm trying to create a new quality profile with existing checkstyle ruleset but get the error message: Rule template can't be activated on a Quality profile: checkstyle:com.puppycrawl.tools.checkstyle.checks.naming.ConstantNameCheck I use the simplest ruleset example from the checkstyle officail site: <module name="Checker"> <module name="JavadocPackage"/> <module name="TreeWalker"> <module name="AvoidStarImport"/> <module name="ConstantName"/> <module name="EmptyBlock"/> </module> </module>