checkstyle

Share specific PMD rulesets across multi module maven project

坚强是说给别人听的谎言 提交于 2019-12-01 04:42:38
问题 I'm trying to share the same pmd configuration across all my submodules. I'm looking for the best way to achieve that I thought that I could place it in the parent project, like I did it for checkstyle plugin Parent pom.xml <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-checkstyle-plugin</artifactId> <version>2.9.1</version> <configuration> <configLocation>/src/main/config/checkstyle.xml</configLocation> </configuration> </plugin> <plugin> <groupId

Getting remote config file for SonarLint if online, using local if offline

和自甴很熟 提交于 2019-12-01 00:38:50
Current My company is currently using checkstyle and findbugs scripts to measure their code quality. I am the one to imigrate those settings into a new SonarQube driven environment. I came to a point when I started wondering, if it was possible, to look the remote config settings of the running SonarQube server up and update the local settings accordingly. Right now, with checkstyle and findbugs it is like this: 1) someone changes the config xml file and uploads it to the server 2) the same person informs via email, that he changed the file and all others need to download it 3) The others

Is there a way to force Checkstyle to ignore particular warning in the source code? [duplicate]

雨燕双飞 提交于 2019-11-30 23:22:47
问题 This question already has answers here : How to disable a particular checkstyle rule for a particular line of code? (7 answers) Closed 5 years ago . PMD has a way to ignore particular warning with //NOPMD comment inside Java source file. Does Checkstyle have similar option? 回答1: Yes, look at the SuppressionCommentFilter and SuppressWithNearbyCommentFilter options. 来源: https://stackoverflow.com/questions/1704430/is-there-a-way-to-force-checkstyle-to-ignore-particular-warning-in-the-source-co

Where can I find the OFFICIAL Java Coding/Style Standards? [closed]

三世轮回 提交于 2019-11-30 23:09:08
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 2 years ago . I use CheckStyle plugin for Eclipse and it does a wonderful job. I would like to know if there an official Code/Style standard (and there should be!) out there by Sun/Oracle... The ones I am finding are so out-dated, they don't even include any Java 1.6 specific syntax, etc... Here is what I found so far: http:/

Java google checkstyle Maven

不问归期 提交于 2019-11-30 17:47:03
I'm trying to configure my Maven project to use google java check style with the following configuration: google_checks.xml: https://github.com/checkstyle/checkstyle/blob/master/src/main/resources/google_checks.xml pom.xml <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-checkstyle-plugin</artifactId> <version>2.17</version> <executions> <execution> <id>checkstyle</id> <phase>validate</phase> <goals> <goal>check</goal> </goals> </execution> </executions> <configuration> <configLocation>google_checks.xml</configLocation> <encoding>UTF-8</encoding>

Why are protected variables not allowed by default in Checkstyle?

倖福魔咒の 提交于 2019-11-30 16:49:35
I get a lot of warnings in eclipse like these: Variable 'myVariable' must be private and have accessor methods. I think I get them because I didn't set protectedAllowed manually to true in eclipse. But why is it set to false by default? Shouldn't I use protected attributes? home Theoretically, protected attributes (variables) are an anti-pattern in object-oriented languages. If only subclasses need to access member attributes of its superclass, define the attributes themselves as private and create protected accessor methods (getter and setter). This approach applies the concept of

how to stop maven build using checkstyle

ε祈祈猫儿з 提交于 2019-11-30 13:27:41
I am new to maven and checkstyle so please be polite:). I've managed to use maven with checkstyle plugin and I can create reports on my code. But what I want really to have is that I can stop the build process of maven if there are any errors on style check. So far my pom.xml looks like below: <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.company.app</groupId> <artifactId>my-app</artifactId>

[sonarqube的使用] sonarqube安装

纵然是瞬间 提交于 2019-11-30 12:55:22
一 . SonarQube代码质量检查工具简介 Sonar (SonarQube)是一个开源平台,用于管理源代码的质量 Sonar 不只是一个质量数据报告工具,更是代码质量管理平台 支持Java, C#, C/C++, PL/SQL, Cobol, JavaScrip, Groovy 等等二十几种编程语言的代码质量管理与检测。 Sonar可以从以下七个维度检测代码质量,而作为开发人员至少需要处理前5种代码质量问题。 不遵循代码标准 sonar可以通过PMD,CheckStyle,Findbugs等等代码规则检测工具规范代码编写。 潜在的缺陷 sonar可以通过PMD,CheckStyle,Findbugs等等代码规则检测工具检 测出潜在的缺陷。 糟糕的复杂度分布 文件、类、方法等,如果复杂度过高将难以改变,这会使得开发人员 难以理解它们, 且如果没有自动化的单元测试,对于程 序中的任何组件的改变都将可能导致需要全面的回归测试。 重复 显然程序中包含大量复制粘贴的代码是质量低下的,sonar可以展示 源码中重复严重的地方。 注释不足或者过多 没有注释将使代码可读性变差,特别是当不可避免地出现人员变动 时,程序的可读性将大幅下降 而过多的注释又会使得开发人员将精力过多地花费在阅读注释上,亦违背初衷。 缺乏单元测试 sonar可以很方便地统计并展示单元测试覆盖率。 糟糕的设计

maven 生成javadoc常见

落爺英雄遲暮 提交于 2019-11-30 10:27:26
1 乱码问题 2自定义标签 <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-javadoc-plugin</artifactId> <version>${maven_javadoc_version}</version> <configuration> <aggregate>true</aggregate> <tags> <tag> <name>checkstyle</name> <placement>a</placement> <head>略过checkstyle规则</head> </tag> </tags> </configuration> <executions> <execution> <id>attach-javadoc</id> <goals> <goal>jar</goal> </goals> <phase>compile</phase> </execution> </executions> </plugin> 属性 说明 name 标签名 placement 标签适用的位置 head 前置提示 该三个参数和用使用generate javadoc 生成时,第三步添加自定义标签基本一致 其添加方式如下: -tag Date:a:"生成日期" -tag Desc:a:"功能描述"

How to generate Checkstyle reports?

大城市里の小女人 提交于 2019-11-30 09:23:47
问题 I have a checkstyle report as xml file and want to generate a html report which lists what kind of errors occurred how many times and in which files they occurred. Something like this example. Is there a tool to do that? 回答1: If you are using mvn to do this, mvn checkstyle:checkstyle will generate an xml format report, or with the option -Dcheckstyle.output.format=plain just plain text. Both of these will only list the errors and won't give any summary. The summary html file is found in the