Comments (5)
@smiler158 看看可以统一提供一个集成的样例
from p3c.
p3c规则是基于pmd规则上修改而来,可以直接参数pmd与jekins集成文档,将规则包换成p3c的包就可以,可参考 http://blog.csdn.net/hwhua1986/article/details/48342745 。 另插件已在云效公有云产品中集成,立即体验!https://rdc-test.aliyun.com/
from p3c.
另附,直接使用p3c-pmd包扫描示例。
java -cp p3c-pmd.jar net.sourceforge.pmd.PMD -d /usr/src -R rule/ali-comment.xml -f text
参数解释:
-d 源码目录
-R 指定规则,多个规则以,号分开
-f 报告格式,text html等。
from p3c.
@zmywly8866 尴尬,我提了个Issue,然后看到了你提的Issue。#182
@smiler158 回复说是基于pmd规则做的,那么应该是可以配置检测到Issue规则的话就停止编译。
task pmd(type: Pmd) {
description 'Run PMD'
group 'verification'
ignoreFailures = false
ruleSetFiles = files("$configDir/pmd/pmd-ruleset.xml")
ruleSets = []
source 'src'
include '**/*.java'
exclude '**/gen/**'
reports {
xml.enabled = false
html.enabled = true
xml {
destination "$reportsDir/pmd/pmd.xml"
}
html {
destination "$reportsDir/pmd/pmd.html"
}
}
}
pmd的规则类似
<?xml version="1.0"?>
<!--
~ Copyright 2015 Vincent Brison.
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="Android Application Rules"
xmlns="http://pmd.sf.net/ruleset/1.0.0"
xsi:noNamespaceSchemaLocation="http://pmd.sf.net/ruleset_xml_schema.xsd"
xsi:schemaLocation="http://pmd.sf.net/ruleset/1.0.0 http://pmd.sf.net/ruleset_xml_schema.xsd">
<description>Custom ruleset for Android application</description>
<exclude-pattern>.*/R.java</exclude-pattern>
<exclude-pattern>.*/gen/.*</exclude-pattern>
<!-- Android -->
<!-- http://pmd.sourceforge.net/pmd-4.3.0/rules/android.html -->
<rule ref="rulesets/java/android.xml"/>
<!-- Design -->
<!-- http://pmd.sourceforge.net/pmd-4.3.0/rules/design.html -->
<rule ref="rulesets/java/design.xml">
<exclude name="UncommentedEmptyMethod"/>
</rule>
<!-- Naming -->
<!-- http://pmd.sourceforge.net/pmd-4.3.0/rules/naming.html -->
<rule ref="rulesets/java/naming.xml/ShortClassName">
<properties>
<property name="minimum" value="3"/>
</properties>
</rule>
<!-- other rules ignored for brevity -->
<rule ref="rulesets/java/clone.xml" />
<rule ref="rulesets/java/finalizers.xml" />
<rule ref="rulesets/java/imports.xml">
<!-- Espresso is designed this way !-->
<exclude name="TooManyStaticImports" />
</rule>
<rule ref="rulesets/java/logging-java.xml" />
<rule ref="rulesets/java/braces.xml" />
<rule ref="rulesets/java/strings.xml" />
<rule ref="rulesets/java/basic.xml" />
<rule ref="rulesets/java/naming.xml">
<exclude name="AbstractNaming" />
<exclude name="LongVariable" />
<exclude name="ShortMethodName" />
<exclude name="ShortVariable" />
<exclude name="VariableNamingConventions" />
</rule>
</ruleset>
@smiler158 只是阿里这个插件的rules是否可以列出来呢??
from p3c.
maven下使用p3c-pmd检测不出来任何问题,使用插件是可以检测出来的
from p3c.
Related Issues (20)
- bug HOT 2
- [Idea plugin] java.lang.ArrayIndexOutOfBoundsException HOT 1
- java反射调用及泛型擦除引起的mySql索引失效
- vo、po、dto在哪用
- eclipse插件频繁报错 HOT 1
- 疑问:规约里的POJO定义与业界定义不符,并且内部有定义上的冲突。
- 没有找到可以修改 insepections问题在代码展示风格的配置 的地方
- 行代码长度超过120 不能检查出来
- Java14之后的Switch-Case新语法扫描出错 HOT 1
- idea 2022.3.2版本,报java.lang.ArrayIndexOutOfBoundsException HOT 5
- 新版IDEA 要求不要用构造方法注入 HOT 1
- 大家有什么其他的替代品吗? HOT 3
- 工程结构问题-Maven新建工程
- 请求适配idea2023.1 HOT 3
- Java开发手册(黄山版).pdf下载下来打不开,没有内容 HOT 1
- namelist.properties中的 LowerCamelCaseVariableNamingRule_WHITE_LIST 参数没有实现 HOT 1
- java.lang.ArrayIndexOutOfBoundsException HOT 2
- 建议增加diff模块或者发布历史 HOT 2
- 2023.1版本插件报错 HOT 15
- [Doc] The README file is not clear and some format was incorrect
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from p3c.