I use checkstyle to analyze my code. A useful rule is PackageHtml, that checks, if a package contains a Javadoc-description. But with newer java-version it's recommended to use package-info.java instead of package.html. Problem is, checkstyle ignores the package-info.java and reports a rule violation. How can checkstyle be configured to ...
We are introducing static analysis tools into the build system for our Java product. We are using Maven2 so Checkstyle and PMD integration come for free. However it looks like there is a large overlap in functionality between these two tools, in terms of enforcing basic style rules.
Is there a benefit from utilizing both of these? I don...
I have a checkstyle suppression filter setup (e.g. ignore magic numbers in unit test code).
The suppression xml file resides in the same folder as the checkstyle xml file. However, where this file actually is varies:
on my windows dev box it is in d:\dev\shared\checkstyle\config
on the Linux CI server it will be in /root/repo/shared/che...
We are using CheckStyle to enforce our style standards. One of the style rules we opted to include was the NeedBraces module.
NeedBraces specifies that every block type statement (such as if, else, for) must have opening and closing curly braces. However, as far as I can tell it isn't working entirely correctly.
This example will tri...
Based on this question it appears that the default template for CheckStyle will allow if else ladders to separate the if and else with a line break.
Meaning I would like this code to be flagged as a violation:
if (true)
{
System.out.println("20");
}
else
if (true)
{
System.out.println("30");
}
Is there a Ch...
Hi,
i have a project which has as maven dependency a jar file which includes a xml file where i stored my rules for checkstyle. I thought it would be ok to just use this configuration:
<configLocation>mycheckstyle.xml</configLocation>. My understanding is that the file should be searched on the classpath and my jar file is a Maven depen...
I'm now working with code that looks like this
public String getName(User user) {
user.setSth(...);
return user.getName();
}
I think it's bad practice to change objects passed as parameters. Is there a tool that detects that kind of code? I looked at findbugs, pmd and checkstyle, but could not find any check for this.
P.S....
For example, not to build queries by string manipulation, and the like.
...
For the last months I've been slowly improved the Eclipse automated PDE build process for our application.
The first thing I tried was automating the test cases. The next step was some scripting code to generate an installer automatically, for both linux and windows.
Now I want to add some static code analysis reports to the process. ...
I use in a project checkstyle and I have defined a SuppressionFilter in my checkstyle-configuration. I use Apache ant to make automatic builds via Continuous Integration.
My problems comes from the following situation: I don't want to fill to much files into the project-basedir, so the checkstyle.xml and the suppressions.xml are both in...
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.
...
Hi guys,
I am trying to use the eclipse-cs plugin on Rational Software Architect 7.0.0.4.
I recently uninstalled the older beta2 version and installed beta3. The plug-in itself works as was previously configured. But whenever I attempt to re-configure the check rules via Windows->Preferences->Checkstyle, I get the following error:
Pro...
I am using NetBeans 6.5. For CheckStyle, I have downloaded and installed the nbcheckstyle.nbm plugin. I am able to use CheckStyle with this plugin.
I want to configure the rules to be checked. I am not able to do it as it is an .nbm file. Any suggestion on how to configures the rules?
Thanks
...
(I know this is a sort of lazy question, but it's oddly hard to search for...especially since checkstyle does so much, and Google search results are littered with checkstyle reports.)
Can someone tell me which checkstyle check reports "+ should be on a new line" when splitting long strings over multiple lines in Java?
On an aside, thi...
I have a checkstyle configuration XML file and want to automatically generate an Eclipse formatter configuration from this. Is there any tool that can do this?
...
I'm working with a maven (jar) Project in Netbeans(Windows), which creates Checkstyle Reports with the maven checkstyle Plugin.
No Matter what i do, i always get the message: File does not end with a newline. for Java Class Files.
What can i do/configure in either Netbeans (Formatter) or for the checkstyle plugin to get rid of the Mess...
I'm doing an override for a third party class and I want to suppress all checks for it (since I'm only keeping it around until the patch is accepted).
Is there a way to suppress all checks for a file?
I tried using "*" but that fails.
...
Got this error today while trying to build a project with checkstyle. This works for other people in my office but I would rather not reinstall Eclipse yet again. Any idea what this error actually means?
Errors occurred during the build.
Errors running builder 'Checkstyle Builder' on project 'myproject'.
cannot initialize module Tree...
The testers on my project want a unique HTML ID on every page element to make their automated testing easier.
It's hard for me to remember to do this, because I don't need the IDs for development. How can I ensure that I don't forget?
I thought maybe something like Checkstyle could tell me, or even the "inspections" in IntelliJ - but ...
I am coding a method that returns whether a given character is valid, which looks like this: -
private static boolean isValid(char c) {
return c == '.' || c == ',' || c == '+' || c == '/' || c == ';' || c == ':';
}
Check style flagged this up as the boolean complexity is too great (5 when it should be no more than 3). My developme...