我正在嘗試整合Sonar進行代碼審查和分析。我在TYPO3工作,所以我增加了以下規則rules.xml
聲納沒有顯示使用自定義規則的違規行爲?
<?xml version="1.0" encoding="ISO-8859-1"?>
<rules>
<rule key="TYPO3.Commenting.FunctionDocComment.TagIndenst"
priority="MAJOR">
<category name="Maintainability" />
<name>Tag comment incorrectly indented</name>
<configKey>TAG_INDENT</configKey>
<description>@category tag comment incorrectly indented</description>
</rule>
<rule
key="TYPO3.Commenting.NoAuthorAnnotationInFunctionDocComment.AuthorAnnotation"
priority="MAJOR">
<category name="Maintainability" />
<name>NoAuthorAnnotationInFunctionDocComment</name>
<configKey>TAG_INDENT</configKey>
<description>@category tag comment incorrectly indented</description>
</rule>
<rule key="TYPO3.Commenting.ValidCommentIndent.ValidCommentIndent"
priority="MAJOR">
<category name="Maintainability" />
<name>ValidCommentIndent</name>
<configKey>T_COMMENT</configKey>
<description>@category tag comment incorrectly indented</description>
</rule>
<rule key="TYPO3.Commenting.ValidCommentLineLength.ValidCommentLineLength"
priority="MAJOR">
<category name="Maintainability" />
<name>ValidCommentLineLength</name>
<configKey>T_COMMENT, T_DOC_COMMENT</configKey>
<description>@category</description>
</rule>
<rule key="TYPO3.Commenting.ValidCommentLineLength.ValidCommentLineLength"
priority="MAJOR">
<category name="Maintainability" />
<name>ValidCommentLineLength</name>
<configKey>T_COMMENT, T_DOC_COMMENT</configKey>
<description>@category</description>
</rule>
<rule key="TYPO3.ControlStructures.AlignedBreakStatement.AlignedBreakStatement"
priority="MAJOR">
<category name="Maintainability" />
<name>AlignedBreakStatement</name>
<configKey>T_BREAK,</configKey>
<description>@category</description>
</rule>
<rule key="TYPO3.ControlStructures.DisallowEachInLoopCondition.DisallowEachInLoopCondition"
priority="MAJOR">
<category name="Maintainability" />
<name>DisallowEachInLoopCondition</name>
<configKey>T_WHILE,</configKey>
<description>@category</description>
</rule>
<rule key="TYPO3.ControlStructures.DisallowElseIfConstruct.DisallowElseIfConstruct"
priority="MAJOR">
<category name="Maintainability" />
<name>DisallowElseIfConstruct</name>
<configKey>T_WHILE,</configKey>
<description>@category</description>
</rule>
<rule key="TYPO3.ControlStructures.ValidBreakStatementsInSwitches.ValidBreakStatementsInSwitches"
priority="MAJOR">
<category name="Maintainability" />
<name>ValidBreakStatementsInSwitches</name>
<configKey>T_BREAK,</configKey>
<description>@category</description>
</rule>
<rule key="TYPO3.ControlStructures.ValidDefaultStatementsInSwitches.ValidDefaultStatementsInSwitches"
priority="MAJOR">
<category name="Maintainability" />
<name>ValidDefaultStatementsInSwitches</name>
<configKey>T_SWITCH,</configKey>
<description>@category</description>
</rule>
<rule key="TYPO3.Debug.DebugCode.DebugCode"
priority="MAJOR">
<category name="Maintainability" />
<name>DebugCode</name>
<configKey>T_STRING, T_COMMENT,</configKey>
<description>@category</description>
</rule>
<rule key="TYPO3.Files.EncodingUtf8.EncodingUtf8"
priority="MAJOR">
<category name="Maintainability" />
<name>EncodingUtf8</name>
<configKey>T_OPEN_TAG</configKey>
<description>@category</description>
</rule>
<rule key="TYPO3.Files.IncludingFile.IncludingFile"
priority="MAJOR">
<category name="Maintainability" />
<name>IncludingFile</name>
<configKey>T_INCLUDE_ONCE, T_REQUIRE, T_INCLUDE</configKey>
<description>@category</description>
</rule>
<rule key="TYPO3.Files.LowercasedFilename.LowercasedFilename"
priority="MAJOR">
<category name="Maintainability" />
<name>LowercasedFilename</name>
<configKey>T_OPEN_TAG</configKey>
<description>@category</description>
</rule>
<rule key="TYPO3.Files.OneClassPerFile.OneClassPerFile"
priority="MAJOR">
<category name="Maintainability" />
<name>OneClassPerFile</name>
<configKey>T_CLASS</configKey>
<description>@category</description>
</rule>
<rule key="TYPO3.Files.OneInterfacePerFile.OneInterfacePerFile"
priority="MAJOR">
<category name="Maintainability" />
<name>OneInterfacePerFile</name>
<configKey>T_INTERFACE</configKey>
<description>@category</description>
</rule>
<rule key="TYPO3.NamingConventions.ValidFunctionName.ValidFunctionName"
priority="MAJOR">
<category name="Maintainability" />
<name>ValidFunctionName</name>
<configKey>T_FUNCTION</configKey>
<description>@category</description>
</rule>
<rule key="TYPO3.NamingConventions.ValidVariableName.ValidVariableName"
priority="MAJOR">
<category name="Maintainability" />
<name>ValidVariableName</name>
<configKey></configKey>
<description>@category</description>
</rule>
<rule key="TYPO3.PHP.CharacterAfterPHPClosingTag.CharacterAfterPHPClosingTag"
priority="MAJOR">
<category name="Maintainability" />
<name>CharacterAfterPHPClosingTag</name>
<configKey>T_CLOSE_TAG</configKey>
<description>@category</description>
</rule>
<rule key="TYPO3.PHP.CharacterBeforePHPOpeningTag.CharacterBeforePHPOpeningTag"
priority="MAJOR">
<category name="Maintainability" />
<name>CharacterBeforePHPOpeningTag</name>
<configKey>T_OPEN_TAG</configKey>
<description>@category</description>
</rule>
</rules>
當代碼分析我不能夠得到任何形式的侵犯,請大家幫忙???
@ Fabric-Sonar團隊:是的,我只啓用了那些通過均值添加的規則。看看我們想要開發一個帶有聲納的審查系統,它可以檢查typo3項目。當我檢查這個/opt/lampp/htdocs/test/.sonar/target/logs/codesniffer.xml那裏我可以看到違規。但不是在儀表板.. – Siva
好吧,我已經刪除了相同的,並重新啓動聲納。但對我來說沒有違規。當我檢查日誌它的顯示是這樣的 2013.01.18 14:47:14 INFO org.sonar.INFO註冊規則[phppmd_rules/php]完成:129 ms 2013.01.18 14:47:14 INFO org.sonar.INFO註冊規則[php_codesniffer_rules/php] ... 2013.01.18 14:47:14 INFO org.sonar.INFO 607規則 – Siva
查看「.sonar/target/logs/codesniffer.xml」文件並檢查錯誤返回以檢查您的「 ... 」標籤是否設置正確。 –