【发布时间】:2015-09-21 11:00:41
【问题描述】:
这可能看起来像重复的问题,但我已经发布了声纳规则合规建议的代码示例。使用 SonarQube 评估以下突出显示的代码时,会导致 squid:S1948 违反规则。
结果,
为什么它显示违反合规代码仍然是一个谜,请澄清。
更新
即使使用sonar.java.binaries 也无法解决瞬态或可序列化问题
声纳扫描成功但抛出类加载器警告:
08:26:44.984 INFO - Java bytecode scan...
08:26:44.992 WARN - Class 'dummyserial/Address' is not accessible through the C
lassLoader.
08:26:44.993 WARN - Class 'dummyserial/Person' is not accessible through the Cl
assLoader.
08:26:44.993 WARN - Class 'dummyserial/Address' is not accessible through the C
lassLoader.
08:26:44.994 WARN - Class 'dummyserial/Person' is not accessible through the Cl
assLoader.
08:26:44.994 WARN - Class 'dummyserial/Address' is not accessible through the C
lassLoader.
08:26:44.997 WARN - Class 'dummyserial/Person' is not accessible through the Cl
assLoader.
08:26:44.998 INFO - Java bytecode scan done: 14 ms
【问题讨论】:
-
地址类是什么样的?
-
你是如何定义地址类的?您是否为分析提供了字节码? (您的分析是使用 maven 还是 sonar runner 运行的?如果是后者,您是否使用
sonar.java.binaries提供了 .class 文件?) -
@benzonico,我将 Person 和 Address 作为单独的 java 文件,使用 sonar.sources=src 通过声纳运行器进行扫描。
-
-
@benzonico,sonar.java.binaries 不走运
标签: java serialization sonarqube