PMD-ATPCO-RuleSet_V7.xml 3

<rule class="net.sourceforge.pmd.rules.sunsecure.ArrayIsStoredDirectly" message="The user-supplied array ‘‘{0}‘‘ is stored directly" name="ArrayIsStoredDirectly">
        <description>
Constructors and methods receiving arrays should clone objects and store the copy.
This prevents that future changes from the user affect the internal functionality.
      </description>
        <example><![CDATA[
 
public class Foo {
 private String [] x;
  public void foo (String [] param) {
      // Don‘t do this, make a copy of the array at least
      this.x=param;
  }
}
 
      ]]></example>
        <priority>3</priority> <!-- Priority 1 to 3. Changed by ATP3RXS -->
        <properties/>
    </rule>
    <rule class="net.sourceforge.pmd.rules.VariableNamingConventions" message="{0} variable {1} should begin with {2}" name="VariableNamingConventions">
        <description>
A variable naming conventions rule - customize this to your liking.  Currently, it
 checks that final variables should be all caps and non-final variables
 should not include underscores.
        </description>
        <example><![CDATA[

public class Foo {
 public static final int MY_NUM = 0;
 public String myTest = "";
 DataModule dmTest = new DataModule();
}

]]></example>
        <priority>1</priority>
        <properties>
            <property name="staticPrefix" value=""/>
            <property name="staticSuffix" value=""/>
            <property name="memberPrefix" value=""/>
            <property name="memberSuffix" value=""/>
        </properties>
    </rule>
    <rule class="net.sourceforge.pmd.rules.MethodNamingConventions" message="Method name does not begin with a lower case character." name="MethodNamingConventions">
        <description>
Method names should always begin with a lower case character, and should not contain underscores.
          </description>
        <example><![CDATA[

public class Foo {
 public void fooStuff() {
 }
}

]]></example>
        <priority>1</priority>
        <properties/>
    </rule>
    <rule class="net.sourceforge.pmd.rules.ClassNamingConventions" message="Class names should begin with an uppercase character" name="ClassNamingConventions">
        <description>
Class names should always begin with an upper case character.
      </description>
        <example><![CDATA[

public class Foo {}

]]></example>
        <priority>1</priority>
        <properties/>
    </rule>
    <rule class="net.sourceforge.pmd.rules.XPathRule" message="Avoid using dollar signs in variable/method/class/interface names" name="AvoidDollarSigns">
        <description>
Avoid using dollar signs in variable/method/class/interface names.
       </description>
        <example><![CDATA[
  
 public class Fo$o {  // yikes!
 }
  
       ]]></example>
        <priority>1</priority>
        <properties>
            <property name="xpath">
                <value><![CDATA[

//ClassOrInterfaceDeclaration[contains(@Image, ‘$‘)]
|
//VariableDeclaratorId[contains(@Image, ‘$‘)]
|
//MethodDeclarator[contains(@Image, ‘$‘)]
 
                 ]]></value>
            </property>
        </properties>
    </rule>
    <rule class="net.sourceforge.pmd.rules.XPathRule" message="The field name indicates a constant but its modifiers do not" name="SuspiciousConstantFieldName">
        <description>
A field name is all in uppercase characters, which in Sun‘s Java naming
conventions indicate a constant. However, the field is not final.
       </description>
        <example><![CDATA[
   
public class Foo {
 // this is bad, since someone could accidentally
 // do PI = 2.71828; which is actualy e
 // final double PI = 3.16; is ok
 double PI = 3.16;
}
   
       ]]></example>
        <priority>1</priority>
        <properties>
            <property name="xpath">
                <value><![CDATA[

//ClassOrInterfaceDeclaration[@Interface=‘false‘]
 /ClassOrInterfaceBody/ClassOrInterfaceBodyDeclaration/FieldDeclaration
  [@Final=‘false‘]
  [VariableDeclarator/VariableDeclaratorId[upper-case(@Image)[email protected]]]
 
                ]]></value>
            </property>
        </properties>
    </rule>
    <rule class="net.sourceforge.pmd.rules.XPathRule" message="The method name and parameter number are suspiciously close to equals(Object)" name="SuspiciousEqualsMethodName">
        <description>
The method name and parameter number are suspiciously close to
equals(Object), which may mean you are intending to override the equals(Object)
method.
        </description>
        <example><![CDATA[
       
public class Foo {
 public int equals(Object o) {
 // oops, this probably was supposed to be boolean equals
 }
 public boolean equals(String s) {
 // oops, this probably was supposed to be equals(Object)
 }
}
       
        ]]></example>
        <priority>2</priority> <!-- Priority 1 to 2. Changed by ATP3RXS -->
        <properties>
            <property name="xpath">
                <value><![CDATA[
       
//MethodDeclarator [
(
@Image = ‘equals‘
  and count(FormalParameters/*) = 1
  and not (FormalParameters/FormalParameter/Type/ReferenceType/ClassOrInterfaceType
   [@Image = ‘Object‘ or @Image = ‘java.lang.Object‘])
)
or
@Image=‘equal‘
 and count(FormalParameters/*) = 1
 and (FormalParameters/FormalParameter/Type/ReferenceType/ClassOrInterfaceType
  [@Image = ‘Object‘ or @Image = ‘java.lang.Object‘])

]
       
                    ]]></value>
            </property>
        </properties>
    </rule>
    <rule class="net.sourceforge.pmd.rules.AvoidFieldNameMatchingTypeName" message="It is somewhat confusing to have a field name matching the declaring class name" name="AvoidFieldNameMatchingTypeName">
        <description>
It is somewhat confusing to have a field name matching the declaring class name.
This proabably means that type and or field names could be more precise.
      </description>
        <example><![CDATA[

public class Foo extends Bar {
 // There‘s probably a better name for foo
 int foo;
}

]]></example>
        <priority>1</priority>
        <properties/>
    </rule>
    <rule class="net.sourceforge.pmd.rules.AvoidFieldNameMatchingMethodName" message="It is somewhat confusing to have a field name with the same name as a method" name="AvoidFieldNameMatchingMethodName">
        <description>
It is somewhat confusing to have a field name with the same name as a method.
While this is totally legal, having information (field) and actions (method) is
not clear naming.
      </description>
        <example><![CDATA[

public class Foo {
 Object bar;
 // bar is data or an action or both?
 void bar() {
 }
}

]]></example>
        <priority>1</priority>
        <properties/>
    </rule>
    <rule class="net.sourceforge.pmd.rules.AvoidNonConstructorMethodsWithClassName" message="Method {0} is not a constructor but it can be confused with one" name="AvoidNonConstructorMethodsWithClassName">
        <description>
It is very easy to confuse methods with classname with constructors. It is preferrable
to name these non-constructor methods in a different way.
      </description>
        <example><![CDATA[

public class Foo {
 public void Foo() {
  // not a constructor, just a poorly named method
 }
}

]]></example>
        <priority>1</priority>
        <properties/>
    </rule>
    <rule class="net.sourceforge.pmd.rules.XPathRule" message="Package name contains upper case characters" name="PackageCase">
        <description>
    Detects when a package definition contains upper case characters.
        </description>
        <example><![CDATA[
   
package com.MyCompany;  // <- should be lower case name
public class SomeClass {
}
   
        ]]></example>
        <priority>1</priority>
        <properties>
            <property name="xpath">
                <value><![CDATA[
                     
//PackageDeclaration/Name[lower-case(@Image)[email protected]]
                     
                  ]]></value>
            </property>
            <property name="pluginname" value="true"/>
        </properties>
    </rule>
    <rule class="net.sourceforge.pmd.rules.optimization.LocalVariableCouldBeFinal" message="Local variable could be declared final" name="LocalVariableCouldBeFinal">
        <description>
A local variable assigned only once can be declared final.
      </description>
        <example><![CDATA[
 
public class Bar {
 public void foo () {
  String a = "a"; //if a will not be assigned again it is better to do this:
  final String b = "b";
 }
}
 
      ]]></example>
        <priority>3</priority>
        <properties/>
    </rule>
    <rule class="net.sourceforge.pmd.rules.optimization.MethodArgumentCouldBeFinal" message="Parameter ‘‘{0}‘‘ is not assigned and could be declared final" name="MethodArgumentCouldBeFinal">
        <description>
A method argument that is never assigned can be declared final.
      </description>
        <example><![CDATA[
 
public void foo (String param) {
  // do stuff with param never assigning it
  // better: public void foo (final String param) {
}
 
      ]]></example>
        <priority>3</priority>
        <properties/>
    </rule>
    <rule class="net.sourceforge.pmd.rules.optimization.AvoidInstantiatingObjectsInLoops" message="Avoid instantiating new objects inside loops" name="AvoidInstantiatingObjectsInLoops">
        <description>
Detects when a new object is created inside a loop
    </description>
        <example><![CDATA[

public class Something {
  public static void main( String as[] ) { 
    for (int i = 0; i < 10; i++) {
      Foo f = new Foo(); //Avoid this whenever you can it‘s really expensive
    }
  }
}

]]></example>
        <priority>2</priority> <!-- Priority 4 to 2. Changed by ATP3RXS -->
        <properties/>
    </rule>
    <rule class="net.sourceforge.pmd.rules.XPathRule" message="Use ArrayList instead of Vector" name="UseArrayListInsteadOfVector">
        <description>
ArrayList is a much better Collection implementation than Vector.
      </description>
        <example><![CDATA[

public class SimpleTest extends TestCase {
 public void testX() {
  Collection c = new Vector();
  // This achieves the same with much better performance
  // Collection c = new ArrayList();
 }
}

]]></example>
        <priority>1</priority>
        <properties>
            <property name="xpath">
                <value><![CDATA[

//AllocationExpression
 /ClassOrInterfaceType[@Image=‘Vector‘ or @Image=‘java.util.Vector‘]

]]></value>
            </property>
        </properties>
    </rule>
    <rule class="net.sourceforge.pmd.rules.ExcessiveImports" message="A high number of imports can indicate a high degree of coupling within an object." name="ExcessiveImports">
        <description>
A high number of imports can indicate a high degree of coupling within
an object. Rule counts the number of unique imports and reports a violation
if the count is above the user defined threshold.
  </description>
        <example><![CDATA[
     
import blah.blah.Baz;
import blah.blah.Bif;
// 18 others from the same package elided
public class Foo {
 public void doWork() {}
}
     
  ]]></example>
        <priority>5</priority> <!-- Priority 4 to 5. Changed by ATP3RXS -->
        <properties>
            <property name="minimum" value="30"/>
        </properties>
    </rule>
    <rule class="net.sourceforge.pmd.rules.design.LooseCoupling" message="Avoid using implementation types like ‘‘{0}‘‘; use the interface instead" name="LooseCoupling">
        <description>
Avoid using implementation types (i.e., HashSet); use the interface (i.e, Set) instead
      </description>
        <example><![CDATA[

import java.util.*;
public class Bar {
 // Use List instead
 private ArrayList list = new ArrayList();
 // Use Set instead
 public HashSet getFoo() {
  return new HashSet();
 }
}
 
      ]]></example>
        <priority>1</priority>
        <properties/>
    </rule>
    <rule class="net.sourceforge.pmd.rules.XPathRule" message="Avoid empty catch blocks" name="EmptyCatchBlock">
        <description>
Empty Catch Block finds instances where an exception is caught,
but nothing is done.  In most circumstances, this swallows an exception
which should either be acted on or reported.
      </description>
        <example><![CDATA[
 
public void doSomething() {
  try {
    FileInputStream fis = new FileInputStream("/tmp/bugger");
  } catch (IOException ioe) {
      // not good
  }
}
 
      ]]></example>
        <priority>1</priority>
        <properties>
            <property name="xpath">
                <value><![CDATA[
   
//CatchStatement
 [count(Block/BlockStatement) = 0 and ($allowCommentedBlocks != ‘true‘ or Block/@containsComment = ‘false‘)]
 [FormalParameter/Type/ReferenceType
   /ClassOrInterfaceType[@Image != ‘InterruptedException‘ and @Image != ‘CloneNotSupportedException‘]
 ]
 
             ]]></value>
            </property>
            <property name="allowCommentedBlocks" value="false"/>
        </properties>
    </rule>
    <rule class="net.sourceforge.pmd.rules.XPathRule" message="Avoid empty ‘if‘ statements" name="EmptyIfStmt">
        <description>
Empty If Statement finds instances where a condition is checked but nothing is done about it.
    </description>
        <example><![CDATA[
   
public class Foo {
 void bar(int x) {
  if (x == 0) {
   // empty!
  }
 }
}
 
       ]]></example>
        <priority>2</priority> <!-- Priority 1 to 2. Changed by ATP3RXS -->
        <properties>
            <property name="xpath">
                <value><![CDATA[

//IfStatement/Statement
 [EmptyStatement or Block[count(*) = 0]]
 
              ]]></value>
            </property>
        </properties>
    </rule>
    <rule class="net.sourceforge.pmd.rules.UnnecessaryConversionTemporary" message="Avoid unnecessary temporaries when converting primitives to Strings" name="UnnecessaryConversionTemporary">
        <description>
Avoid unnecessary temporaries when converting primitives to Strings
      </description>
        <example><![CDATA[
 
public String convert(int x) {
  // this wastes an object
  String foo = new Integer(x).toString();
  // this is better
  return Integer.toString(x);
}
 
      ]]></example>
        <priority>1</priority>
        <properties/>
    </rule>
    <rule class="net.sourceforge.pmd.rules.XPathRule" message="Ensure you override both equals() and hashCode()" name="OverrideBothEqualsAndHashcode">
        <description>
Override both public boolean Object.equals(Object other), and public int Object.hashCode(), or override neither.  Even if you are inheriting a hashCode() from a parent class, consider implementing hashCode and explicitly delegating to your superclass.
      </description>
        <example><![CDATA[
 
// this is bad
public class Bar {
  public boolean equals(Object o) {
      // do some comparison
  }
}

// and so is this
public class Baz {
  public int hashCode() {
      // return some hash value
  }
}

// this is OK
public class Foo {
  public boolean equals(Object other) {
      // do some comparison
  }
  public int hashCode() {
      // return some hash value
  }
}
 
      ]]></example>
        <priority>1</priority>
        <properties>
            <property name="xpath">
                <value><![CDATA[

//ClassOrInterfaceDeclaration
 [@Interface=‘false‘]
 [not (ImplementsList/ClassOrInterfaceType[@Image=‘Comparable‘])]
//MethodDeclarator
[(@Image = ‘equals‘ and count(FormalParameters/*) = 1
and not(//MethodDeclarator[count(FormalParameters/*) = 0][@Image = ‘hashCode‘]))
or
(@Image=‘hashCode‘ and count(FormalParameters/*) = 0
and
not
(//MethodDeclarator
 [count(
   FormalParameters//Type/ReferenceType/ClassOrInterfaceType
    [@Image = ‘Object‘ or @Image = ‘java.lang.Object‘]) = 1]
    [@Image = ‘equals‘]))]
 
              ]]></value>
            </property>
        </properties>
    </rule>
    <rule class="net.sourceforge.pmd.rules.XPathRule" message="Avoid returning from a finally block" name="ReturnFromFinallyBlock">
        <description>
Avoid returning from a finally block - this can discard exceptions.
      </description>
        <example><![CDATA[
 
public class Bar {
 public String foo() {
  try {
   throw new Exception( "My Exception" );
  } catch (Exception e) {
   throw e;
  } finally {
   return "A. O. K."; // Very bad.
  }
 }
}

]]></example>
        <priority>1</priority>
        <properties>
            <property name="xpath">
                <value><![CDATA[

//FinallyStatement//ReturnStatement

]]></value>
            </property>
        </properties>
    </rule>
    <rule class="net.sourceforge.pmd.rules.XPathRule" message="Unnecessary final modifier in final class" name="UnnecessaryFinalModifier">
        <description>
When a class has the final modifier, all the methods are automatically final.
      </description>
        <example><![CDATA[

public final class Foo {
    // This final modifier is not necessary, since the class is final
    // and thus, all methods are final
    private final void foo() {
    }
}

]]></example>
        <priority>1</priority>
        <properties>
            <property name="xpath">
                <value><![CDATA[
   
//ClassOrInterfaceDeclaration[@Final=‘true‘ and @Interface=‘false‘]
/ClassOrInterfaceBody/ClassOrInterfaceBodyDeclaration/MethodDeclaration[@Final=‘true‘]
   
              ]]></value>
            </property>
        </properties>
    </rule>
    <rule class="net.sourceforge.pmd.rules.XPathRule" message="These nested if statements could be combined" name="CollapsibleIfStatements">
        <description>
Sometimes two ‘if‘ statements can be consolidated by separating their conditions with a boolean short-circuit operator.
      </description>
        <example><![CDATA[
 
public class Foo {
 void bar() {
  if (x) {
   if (y) {
    // do stuff
   }
  }
 }
}
 
      ]]></example>
        <priority>4</priority>
        <properties>
            <property name="xpath">
                <value><![CDATA[
               
//IfStatement[@Else=‘false‘]/Statement
 /IfStatement[@Else=‘false‘]
 |
//IfStatement[@Else=‘false‘]/Statement
 /Block[count(BlockStatement)=1]/BlockStatement
  /Statement/IfStatement[@Else=‘false‘]
            ]]></value>
            </property>
        </properties>
    </rule>
    <rule class="net.sourceforge.pmd.rules.UnusedModifier" message="Avoid modifiers which are implied by the context" name="UnusedModifier">
        <description>
 Fields in interfaces are automatically public static final, and
 methods are public abstract.
 Classes or interfaces nested in an interface are automatically public
 and static (all nested interfaces are automatically static).
 For historical reasons, modifiers which are implied by the context
 are accepted by the compiler, but are superfluous.
     </description>
        <example><![CDATA[
 
public interface Foo {
 public abstract void bar(); // both abstract and public are ignored by the compiler
 public static final int X = 0; // public, static, and final all ignored
 public static class Bar {} // public, static ignored
 public static interface Baz {} // ditto
}
public class Bar {
 public static interface Baz {} // static ignored
}
 
     ]]></example>
        <priority>8</priority>
        <properties/>
    </rule>
    <rule class="net.sourceforge.pmd.rules.XPathRule" message="Avoid importing anything from the ‘sun.*‘ packages" name="DontImportSun">
        <description>
Avoid importing anything from the ‘sun.*‘ packages.  These packages are not portable and are likely to change.
       </description>
        <example><![CDATA[

import sun.misc.foo;
public class Foo {}

]]></example>
        <priority>1</priority>
        <properties>
            <property name="xpath">
                <value><![CDATA[

//ImportDeclaration
[starts-with(Name/@Image, ‘sun.‘)]
[not(starts-with(Name/@Image, ‘sun.misc.Signal‘))]

]]></value>
            </property>
        </properties>
    </rule>
    <rule class="net.sourceforge.pmd.rules.XPathRule" message="This statement may have some unnecessary parentheses" name="UnnecessaryParentheses">
        <description>
Sometimes expressions are wrapped in unnecessary parentheses,
making them look like a function call.
      </description>
        <example><![CDATA[
  public class Foo {
      boolean bar() {
          return (true);
      }
  }
      ]]></example>
        <priority>5</priority>
        <properties>
            <property name="xpath">
                <value><![CDATA[
               
//ReturnStatement
          /Expression
           /PrimaryExpression
            /PrimaryPrefix
             /Expression[count(*)=1]
              /PrimaryExpression
              /PrimaryPrefix
            ]]></value>
            </property>
        </properties>
    </rule>
    <rule class="net.sourceforge.pmd.rules.XPathRule" message="Use explicit scoping instead of the default package private level" name="DefaultPackage">
        <description>
Use explicit scoping instead of the default package private level
        </description>
        <example><![CDATA[]]></example>
        <priority>1</priority>  <!-- Priority 4 to 1. Changed by ATP1AXR -->
        <properties>
            <property name="xpath">
                <value><![CDATA[
//ClassOrInterfaceDeclaration[@Interface=‘false‘]
/ClassOrInterfaceBody
/ClassOrInterfaceBodyDeclaration
/FieldDeclaration[@PackagePrivate=‘true‘]
| /MethodDeclaration[@PackagePrivate=‘true‘]
                ]]></value>
            </property>
        </properties>
    </rule>
    <rule class="net.sourceforge.pmd.rules.XPathRule" message="enter ‘trace‘ log message after method starts and befor ends" name="TraceLogWithinMethod">
        <description>The entry “trace” log message will be as close to the first line in the method as possible (only variable declarations used in the log call are allowed before)

The exit “trace” log message will be as close to the end of the method as possible.  The last line in functions that return void or immediately preceding the return statement for methods returning a value.
</description>
        <example><![CDATA[public void method_m(){

log.info("method starts here");
//do somthing
log.info("method ends");
}]]></example>
        <priority>3</priority>  <!-- Priority 3 to 1. Changed by ATP1AXR -->
        <properties>
            <property name="xpath">
                <value><![CDATA[//PrimaryExpression[PrimaryPrefix/Name[ends-with(@Image, ‘.debug‘)]or PrimaryPrefix/Name[ends-with(@Image, ‘.info‘)]or PrimaryPrefix/Name[ends-with(@Image, ‘.warn‘)]or PrimaryPrefix/Name[ends-with(@Image, ‘.error‘)]or PrimaryPrefix/Name[ends-with(@Image, ‘.fatal‘)]]]]></value>
            </property>
        </properties>
    </rule>
    <rule class="net.sourceforge.pmd.rules.XPathRule" message="all the letters of the constant are not capital" name="ConstantNaming">
        <description>Constant name (variables declared as final) should be in all capital letters.</description>
        <example><![CDATA[public static final String CONSTANT_NAME = null;]]></example>
        <priority>1</priority>
        <properties>
            <property name="xpath">
                <value><![CDATA[//ClassOrInterfaceDeclaration/ClassOrInterfaceBody/ClassOrInterfaceBodyDeclaration/FieldDeclaration[@Final=‘true‘][@Static=‘true‘][VariableDeclarator/VariableDeclaratorId[upper-case(@Image)[email protected]][@Image!="serialVersionUID"]]   ]]></value>
            </property>
        </properties>
    </rule>
    <rule class="net.sourceforge.pmd.rules.XPathRule" message="there is no scope is defined for the variale" name="VariableDefinition">
        <description>Variables are defined in the proper scope (as restrictive as possible)</description>
        <example><![CDATA[private int i=0;
public String name=null;
protected String str_name ="";]]></example>
        <priority>1</priority>
        <properties>
            <property name="xpath">
                <value><![CDATA[//FieldDeclaration[@Private ="false" and @Public ="false" and @Protected="false"]]]></value>
            </property>
        </properties>
    </rule>
    <rule class="net.sourceforge.pmd.rules.XPathRule" message="variable has not been initialized" name="VariableInitialization">
        <description>Variables should be initialized when they are declared unless the initial value is dependent on a computation occurring first</description>
        <example><![CDATA[public class foo{

public int i=0;

public void method_name(){

String str_name = null;

}
}
}]]></example>
        <priority>3</priority>
        <properties>
            <property name="xpath">
                <value><![CDATA[//ClassOrInterfaceDeclaration[@Interface=‘false‘]/ClassOrInterfaceBody/ClassOrInterfaceBodyDeclaration/FieldDeclaration/VariableDeclarator[count( .//.//.//VariableInitializer[@Image!=‘false‘] )=0 ]]]></value>
            </property>
        </properties>
    </rule>

时间: 2024-08-07 07:16:36

PMD-ATPCO-RuleSet_V7.xml 3的相关文章

1. PMD 使用,编译和自定义规则

一 PMD简介 PMD是一款代码静态检查工具,可以检查出很多代码中潜在的bug以及让人感到疑惑的代码,具体大家可以百度下. 二 PMD源代码下载 下载地址: https://github.com/pmd/pmd/tree/pmd/5.5.x 需要注意的是注意选择branch,一般选择最新的branch:然后可以用git clone下来,或者直接下载zip压缩包. 如下: 从上图也可以看到,pmd支持的语言有很多,java的检测那就是在pmd-java里面. 三 maven下载和环境变量配置 参考

jenkins 使用oclint 扫描 oc 代码

jenkins 环境的搭建,在这里不在赘述,下面我们写一写,如何接入oclint. OCLint是一个强大的静态代码分析工具,可以用来提高代码质量,查找潜在的bug,主要针对c,c++和Objective-c的静态分析.功能非常强大.项目地址:http://oclint.org/. 1.oclint 与 xcpretty的安装 推荐是用Homebrew 来安装,快速且节省精力,也可以选择源码安装或者release包来安装,不过需要配置环境变量的内容.使用Homebrew 安装时,需要先设置bre

iOS 持续集成

iOS 持续集成系列 - 开篇 前言 iOS 开发在经过这几年的野蛮生长之后,慢慢地趋于稳定.无论开发语言是 Objective-C 还是 Swift,工程类型是 Hybird 还是原生,开发思想是 OOP 还是函数式,随着项目逐渐变大都在面临相同的问题: 测试.发布等重复性工作占了很大一部分时间,回归成本越来越高.持续集成不可避免地被提上了日程. 本文主要阐述 iOS 下的持续集成,以目标.内容.流程.工具入手,希望可以为大家描绘一幅 iOS 持续集成的蓝图.这可能不是一篇可以让你 Step

代码静态解析PMD

在正式进入测试之前,进行一定的静态代码分析及code review对代码质量及系统提高是有帮助的,以上为数据证明 Pmd 它是一个基于静态规则集的Java源码分析器,它可以识别出潜在的如下问题:– 可能的bug——空的try/catch/finally/switch块.– 无用代码(Dead code):无用的本地变量,方法参数和私有方法.– 空的if/while语句.– 过度复杂的表达式——不必要的if语句,本来可以用while循环但是却用了for循环.– 可优化的代码:浪费性能的String

如何更好地利用Pmd、Findbugs和CheckStyle分析结果

这里列出了很多Java静态分析工具,每一种工具关注一个特定的能发挥自己特长的领域,我们可以列举一下: Pmd 它是一个基于静态规则集的Java源码分析器,它可以识别出潜在的如下问题:– 可能的bug--空的try/catch/finally/switch块.– 无用代码(Dead code):无用的本地变量,方法参数和私有方法.– 空的if/while语句.– 过度复杂的表达式--不必要的if语句,本来可以用while循环但是却用了for循环.– 可优化的代码:浪费性能的String/Strin

pmd静态代码分析

在正式进入测试之前,进行一定的静态代码分析及code review对代码质量及系统提高是有帮助的,以上为数据证明 Pmd 它是一个基于静态规则集的Java源码分析器,它可以识别出潜在的如下问题:– 可能的bug--空的try/catch/finally/switch块.– 无用代码(Dead code):无用的本地变量,方法参数和私有方法.– 空的if/while语句.– 过度复杂的表达式--不必要的if语句,本来可以用while循环但是却用了for循环.– 可优化的代码:浪费性能的String

findbugs、PMD、Checkstyle等CI插件的使用

前面介绍过Jenkins+Gerrit+Git搭建CI系统,其实在CI系统中有很多有用的插件,这些插件可以帮助开发人员发现代码中的bug或者不规范的地方.下面就介绍下CI相关的插件 FindBugs:FindBugs是一个静态分析工具,它检查类或者 JAR 文件,将字节码与一组缺陷模式进行对比以发现可能的问题.有了静态分析工具,就可以在不实际运行程序的情况对软件进行分析 PMD:PMD是一款静态代码分析工具,它能够自动检测各种潜在缺陷以及不安全或未优化的代码.PMD 通过其内置的编码规则对 Ja

代码静态分析工具--PMD,Findbugs,CheckStyle

最近学习Mybatis的官方文档,看到了[项目文档]一节有很多内容没有见过,做个笔记,理解一下. PMD 扫描Java源代码,查找潜在的问题,如: 可能的bugs,如空的try/catch/finally/switch声明 死亡的代码,没有使用的本地变量,参数和私有方法 不合标准的代码,如String/StringBuffer用法 过于复杂的表达式,如不必要的if表达式 重复的代码,拷贝.粘贴的代码 FindBugs 它用来查找Java代码中存在的bug.它使用静态分析方法标识出Java程序中上

XML文件各种bean的创建

<?xml version="1.0" encoding="UTF-8"?><beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:c="http://www.springframework.org/schema/c&q

pmd

在正式进入测试之前,进行一定的静态代码分析及code review对代码质量及系统提高是有帮助的,以上为数据证明 Pmd 它是一个基于静态规则集的Java源码分析器,它可以识别出潜在的如下问题:– 可能的bug——空的try/catch/finally/switch块.– 无用代码(Dead code):无用的本地变量,方法参数和私有方法.– 空的if/while语句.– 过度复杂的表达式——不必要的if语句,本来可以用while循环但是却用了for循环.– 可优化的代码:浪费性能的String