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)
- 数组下标越界 HOT 1
- 提几条日常编码时的想法供参考
- 2023.2版本插件报错 HOT 11
- 有没有web的开发手册开发规范
- 规约中有关前后端接口日期时间传递的约定是在挖大坑 HOT 8
- URL Broker 指的是什么
- beta版本试用,增加了对Record类的检测,优化了Switch中default块的判断 HOT 2
- How to add a new rule HOT 69
- stream和enum的格式化能不能优化下
- idea 2023.1.5版本安装规约插件代码规约失效 HOT 1
- How can I use my custom rule which is similar to defined rule? HOT 1
- LockShouldWithTryFinallyRule规则不生效
- 请问下这个插件是没更新了吗? HOT 3
- 类名使用 UpperCamelCase 风格,但以下情形例外:DO / / BO / / DTO / VO / AO / PO / UID 等。这个规则不生效。
- P3C的阿里巴巴网址无法拉取包了 HOT 2
- 这个插件是否已经不维护了
- Gitlab集成P3C检查,如何只对增量代码做检查 HOT 3
- 实时检测功能开启后不生效 HOT 1
- 实时检测功能开启后不生效
- java.lang.ArrayIndexOutOfBoundsException HOT 2
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.