标签:checkstyle cache name build File aProject Name Checkstyle
Checkstyle是一款很棒的工具,用来发现很多编码风格的问题。还不了解的同学可以移步这里Android代码规范利器: Checkstyle查看。
但是在使用Checkstyle时,却出现了一些问题,就是file元素的name不是我们当前执行checkstyle任务的路径。
举个例子,比如
- 我们执行
./gradlew checkstyle
时项目的路径为~/Document/aProject
- 但是报告输出的file name属性为
/tmp/aProject/Commonxxxx/src/main/java/com/xxxx/core/adapter/xxxxxx.java
,基础路径为/tmp/aProject
具体的相关报告的输出结果
<?xml version="1.0" encoding="UTF-8"?> <checkstyle version="6.19"> <file name="/tmp/aProject/Commonxxxx/src/main/java/com/xxxx/core/adapter/xxxxxx.java"> <error line="26" column="37" severity="warning" message="Member name 'mHeaderViews' must match pattern '^[a-z][a-z0-9][a-zA-Z0-9]*$'." source="com.puppycrawl.tools.checkstyle.checks.naming.MemberNameCheck"/> <error line="27" column="37" severity="warning" message="Member name 'mFootViews' must match pattern '^[a-z][a-z0-9][a-zA-Z0-9]*$'." source="com.puppycrawl.tools.checkstyle.checks.naming.MemberNameCheck"/> <error line="30" column="23" severity="warning" message="Member name 'mContext' must match pattern '^[a-z][a-z0-9][a-zA-Z0-9]*$'." source="com.puppycrawl.tools.checkstyle.checks.naming.MemberNameCheck"/> <error line="62" severity="warning" message="Overload methods should not be split. Previous overloaded method located at line '52'." source="com.puppycrawl.tools.checkstyle.checks.coding.OverloadMethodsDeclarationOrderCheck"/> |
原因
原因是使用了gralde的build cache导致的。
解决方法
执行时不使用gralde build cache
./gradlew --no-build-cache checkstyle |
相关文章推荐
标签:checkstyle,
cache,
name,
build,
File,
aProject,
Name,
Checkstyle
From: https://blog.51cto.com/u_3987305/5842003