checkstyle

Checkstyle different rules for different files

大兔子大兔子 提交于 2019-11-27 06:01:13
问题 I have one file which contains rules for the project. I want my unit tests methods to be allowed to have underscore in their names. Like myMethod_should_call_someClass_someMehod . Currently I have one configuration, which is applied to all files in the project. My question is it possible to somehow configure checkstyle, so, for example I specify specific rules for all files that are ending with *Test.java . Currently the only solution I found is to provide SuppressionFilter and exclude all

Checkstyle “Method Not Designed For Extension” error being incorrectly issued?

我只是一个虾纸丫 提交于 2019-11-27 04:41:05
问题 I'm using Checkstyle and am getting an error about this method: public final String getAdmitCodeStatus() { return admitCodeStatus; } Here's the error I get: Method 'getAdmitCodeStatus' is not designed for extension - needs to be abstract, final, or empty. How is that method not compliant? Is there something I'm doing wrong that Checkstyle would bark at me about this method? 回答1: It looks to be caused by the DesignForExtension rule. According to the documentation: Checks that classes are

Excluding classes in Maven Checkstyle plugin reports

你离开我真会死。 提交于 2019-11-27 02:02:39
问题 I have a Maven 2 project and I want to configure my Checkstyle report plugin so that only some of my classes are analysed. I have found the maven.checkstyle.excludes property, but despite passing this as a command line parameter (using -D=maven.checkstyle.excludes=... ) I can't get it to work. I can't find anything on the Plugin documentation page. Ideally I want to be able to set this in the <configuration> section of my POM. 回答1: If this question is about Maven 2, then the property is

IntelliJ IDEA code format from checkstyle configuration

余生颓废 提交于 2019-11-27 01:41:19
I've decided to contribute to android maven plugin. They use quite specific code style format. It will take some time for me to modify IDEA code format rules to satisfy their requirements. Fortunately there is checkstyle configuration. I've already installed check-style plugin for IDEA and immediately see where my current formatting is wrong. Unfortunately I didn't find way to import checkstyle configuration into IDEA formatting rules. I'm interested if it's possible. CrazyCoder UPDATE : supported since 4.24.0 plug-in version, see here for details. Original answer from 2013: Not possible yet ,

How to generate an Eclipse formatter configuration from a checkstyle configuration?

北慕城南 提交于 2019-11-26 22:49:41
问题 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? 回答1: In Eclipse (3.6): Install Checkstyle plug-in Import stylesheet using Windows --> Preferences, General --> Checkstyle --> New. Since you have an external file, choose "external file" as the type. Right-click on your project in the Package view and select Checkstyle --> Create Formatter-Profile. Then enable the formatter for your

Problems occurred when invoking code from plug-in: “org.eclipse.jface” when using Checkstyle Plugin

亡梦爱人 提交于 2019-11-26 16:34:14
问题 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: Problems occurred when invoking code from plug-in: "org.eclipse.jface". This occurs when I click the configure button and attempt to reconfigure a specific selected check

Is there a static analysis tool like Lint or Perl::Critic for shell scripts?

自作多情 提交于 2019-11-26 15:23:48
问题 Are there any shell (specifically bash or ksh) checkers that test shell scripts for style, best practices, naming conventions, etc? (Something like Lint for C, or Perl::Critic for Perl.) I know with ksh you can do syntax checking by running ksh -n script.ksh but I was hoping for something more than just sytax checking - something that parses/analyzes the actual code? I'm probably out of luck, but I guess it doesn't hurt to ask. 回答1: The Debian and Ubuntu projects use a script checkbashisms,

IntelliJ IDEA code format from checkstyle configuration

北战南征 提交于 2019-11-26 09:44:28
问题 I\'ve decided to contribute to android maven plugin. They use quite specific code style format. It will take some time for me to modify IDEA code format rules to satisfy their requirements. Fortunately there is checkstyle configuration. I\'ve already installed check-style plugin for IDEA and immediately see where my current formatting is wrong. Unfortunately I didn\'t find way to import checkstyle configuration into IDEA formatting rules. I\'m interested if it\'s possible. 回答1: UPDATE :

How to disable a particular checkstyle rule for a particular line of code?

梦想的初衷 提交于 2019-11-26 02:27:46
问题 I have a checkstyle validation rule configured in my project, that prohibits to define class methods with more than 3 input parameters. The rule works fine for my classes, but sometimes I have to extend third-party classes, which do not obey this particular rule. Is there a possibility to instruct \"checkstyle\" that a certain method should be silently ignored? BTW, I ended up with my own wrapper of checkstyle: qulice.com (see Strict Control of Java Code Quality) 回答1: Check out the use of the