dousui7410 2014-02-05 14:15
浏览 122

使用声纳PHP插件,PHP CodeSniffer的存储库“标准”在哪里?

I have installed SonarQube™ and the PHP Plugin.

I want to add a new CodeSniffer rule, like it's indicated in http://docs.codehaus.org/display/SONAR/PHP+Custom+Coding+Rules.

However, I can't find the location of the "Standard" repository wich contains existing rules (PEAR, Squiz, Generic...). So I don't know where I have to add my new file corresponding to the xml rule I have defined in the sonar settings.

Maybe I've missed something but I looked in every folder in the PHP plugin and didn't find this "Standard" folder. I even extracted content from the .jar files of the plugin and even looked in the rest of my disk in case of the code sniffer repository were somewhere else.

Can you help me ?

Thanks.

  • 写回答

3条回答 默认 最新

  • dragon4808 2014-02-05 16:16
    关注

    The standard folder belongs to PHP_CodeSniffer not to SonorCube. Its located inside the PHP_Codesniffer installation (which depends on how you installed PHP_CodeSniffer on your machine). If you found it the Standards folder is located under

    PHP_CodeSniffer/CodeSniffer/Standards/
    

    My guess is that you want execute a rule inside SonarCube. I don't know SonarCube but I am sure you need to configure the path to PHP_CodeSniffer somewhere. After done that its like it says in the docu:

    <?xml version="1.0" encoding="UTF-8"?>
    <rules>
    
      <rule key="PEAR.Commenting.FileComment.TagIndent" priority="MAJOR">
        <!-- name, configKey, description are mandatory -->
        <name>Tag comment incorrectly indented</name>
        <configKey>TAG_INDENT</configKey>
        <description>@category tag comment incorrectly indented</description>
      </rule>
    
      <rule key="...>
        ...
      </rule>
    
    </rules>
    

    With:

           PEAR           Commenting         FileComment                   TagIndent
    <standard_folder>.<sniff_subfolder>.<sniff_file_without_sniff_suffix>.<error_name>
    

    The way to go is:

    1. Install PHP_Codesniffer (via Composer, Pear or plain from Github) [1]
    2. Set the path to PHP_Codesniffer inside SonarCube
    3. Configure the rules

    [1] https://github.com/squizlabs/PHP_CodeSniffer

    评论

报告相同问题?

悬赏问题

  • ¥15 用windows做服务的同志有吗
  • ¥60 求一个简单的网页(标签-安全|关键词-上传)
  • ¥35 lstm时间序列共享单车预测,loss值优化,参数优化算法
  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图