2011-04-23 2 views
9

을 무시하지 : 내 클래스 중 하나에서Checkstyle SuppressionCommentFilter 나는 이런 식으로 뭔가 보이는 checkstyle.xml이 지정된 규칙

<module name="Checker"> 
    .... 

    <module name="SuppressionCommentFilter"> 
     <property name="offCommentFormat" value="CSOFF\: ([\w\|]+)"/> 
     <property name="onCommentFormat" value="CSON\: ([\w\|]+)"/> 
     <property name="checkFormat" value="$1"/> 
    </module> 

    <module name="TreeWalker"> 
     <module name="LineLength"> 
      <property name="max" value="200"/> 
     </module> 
     .... 
    </module> 
</module> 

을, 나는 한 줄 이상 200 자 이상이 있고 그 주위에 다음을 넣어 :

// CSOFF: LineLength 
... 
// CSON: LineLength 

그러나 문제의 라인은 checkstyle의 일부로 무시되지 않습니다.

<build> 
    <plugins> 
     <plugin> 
      <groupId>org.apache.maven.plugins</groupId> 
      <artifactId>maven-checkstyle-plugin</artifactId> 
      <version>2.6</version> 
      <configuration> 
       <configLocation>checkstyle.xml</configLocation> 
      </configuration> 
     </plugin> 
    </plugins> 
</build> 

및 실행이 :

나는 pom.xml 파일에 다음 지정한

mvn checkstyle:checkstyle 
+0

mvn checkstyle을 수행하면 어떻게됩니까? checkstyle : checkstyle? – sbridges

답변

25

당신이 documented로 FileContentsHolder을 구성 했습니까?

<module name="TreeWalker"> 
    ... 
    <module name="FileContentsHolder"/> 
    ... 
</module> 
+0

막연하지만 작동합니다! – StarWind0

관련 문제