<small id='YiDCk'></small><noframes id='YiDCk'>

        • <bdo id='YiDCk'></bdo><ul id='YiDCk'></ul>
      1. <legend id='YiDCk'><style id='YiDCk'><dir id='YiDCk'><q id='YiDCk'></q></dir></style></legend>
        <tfoot id='YiDCk'></tfoot>
        <i id='YiDCk'><tr id='YiDCk'><dt id='YiDCk'><q id='YiDCk'><span id='YiDCk'><b id='YiDCk'><form id='YiDCk'><ins id='YiDCk'></ins><ul id='YiDCk'></ul><sub id='YiDCk'></sub></form><legend id='YiDCk'></legend><bdo id='YiDCk'><pre id='YiDCk'><center id='YiDCk'></center></pre></bdo></b><th id='YiDCk'></th></span></q></dt></tr></i><div id='YiDCk'><tfoot id='YiDCk'></tfoot><dl id='YiDCk'><fieldset id='YiDCk'></fieldset></dl></div>

        使用 Lint 和 SonarQube 分析 Android 项目

        Analyzing Android Project with Lint and SonarQube(使用 Lint 和 SonarQube 分析 Android 项目)

        <small id='LgkqE'></small><noframes id='LgkqE'>

        <i id='LgkqE'><tr id='LgkqE'><dt id='LgkqE'><q id='LgkqE'><span id='LgkqE'><b id='LgkqE'><form id='LgkqE'><ins id='LgkqE'></ins><ul id='LgkqE'></ul><sub id='LgkqE'></sub></form><legend id='LgkqE'></legend><bdo id='LgkqE'><pre id='LgkqE'><center id='LgkqE'></center></pre></bdo></b><th id='LgkqE'></th></span></q></dt></tr></i><div id='LgkqE'><tfoot id='LgkqE'></tfoot><dl id='LgkqE'><fieldset id='LgkqE'></fieldset></dl></div>
        <legend id='LgkqE'><style id='LgkqE'><dir id='LgkqE'><q id='LgkqE'></q></dir></style></legend>
            <tfoot id='LgkqE'></tfoot>
              <bdo id='LgkqE'></bdo><ul id='LgkqE'></ul>
                    <tbody id='LgkqE'></tbody>
                • 本文介绍了使用 Lint 和 SonarQube 分析 Android 项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我真的有一个溢出",试图让这些东西一起工作.我按照这里的说明进行操作:http://docs.sonarqube.org/display/PLUG/Android+Lint+插件,最后得到了一个安装了 Android Lint 插件 1.1 的 SonarQube 5.1.1 服务器.然后我将我的多模块 Gradle 构建配置为与 SonarQube 插件一起使用:请参阅下面根配置中的代码片段.

                  I really got an 'overflow' trying to make these things to work together. I followed instruction from here: http://docs.sonarqube.org/display/PLUG/Android+Lint+Plugin and finally got a SonarQube 5.1.1 server with Android Lint plugin 1.1 installed. Then I configured my multi-module Gradle build to work with SonarQube plugin: see code fragment from root config below.

                  plugins {
                      id 'org.sonarqube' version '1.0'
                  }
                  
                  sonarqube {
                      properties {
                  
                          property 'sonar.host.url', 'sonarqube-server:9000'
                          property 'sonar.jdbc.url', 'jdbc:mysql://sonarqube-db:3306/sonar?useUnicode=true&amp;characterEncoding=utf8'
                          property 'sonar.jdbc.driverClassName', 'com.mysql.jdbc.Driver'
                          property 'sonar.jdbc.username', 'sonar'
                          property 'sonar.jdbc.password', 'sonar'
                          property 'sonar.sourceEncoding', 'UTF-8'
                          property 'sonar.login', 'admin'
                          property 'sonar.password', 'admin'
                  
                          property 'sonar.profile', 'Android Lint'
                  
                          property 'sonar.import_unknown_files', true
                          property 'sonar.android.lint.report', 'build/outputs/lint-results.xml'
                      }
                  }
                  

                  然后我运行 lint sonarqubetask 来执行分析.结果,我收到了大量关于retrolambda"项目的 Lint 错误(java.lang.UnsupportedOperationException: Unknown ASTNode child: LambdaExpression),这很正常,并且 lint-results.xml每个模块的 (随附 HTML 版本)文件,其中包含对发现的问题的描述.报告称发现了 8 个错误和 434 个警告.但是当 sonarqube 插件尝试将结果上传到 SonarQube 服务器时出现问题.日志中充满了无法找到文件"和无法找到规则"消息.当处理结束时,我的项目在 SonarQube 服务器上没有报告任何问题.

                  And after that I ran lint sonarqubetask to execute the analysis. As a result I got a bulk of Lint errors regarding 'retrolambda' project (java.lang.UnsupportedOperationException: Unknown ASTNode child: LambdaExpression), which is quite normal, and lint-results.xml (accompanied with HTML version) files per each module containing descriptions of issues discovered. The report said that there were 8 errors and 434 warnings found. But things went wrong when sonarqube plugin tried to upload the results to SonarQube server. The log was full of 'Unable to find file' and 'Unable to find rule' messages. And when the processing was over, then there were no issues reported for my project on SonarQube server.

                  我想知道,出了什么问题?我检查了路径,所有文件都在那里.我查看了所有可以进行的讨论,似乎我的配置是正确的,而且我做的一切都是正确的.有没有人有任何线索,我错过了什么以及需要检查什么?欢迎任何建议或想法.

                  And I am wondering, what did went wrong? I checked the paths, and all files were there. I looked through all discussions I could reach, and it seems like my config is correct and I do everything right. Does anybody have any clue, what I missed and what needs to be checked? Any suggestions or ideas are welcome.

                  如果有一种方法可以使用外部 SonarQube Runner 导入 lint 数据,我也会很高兴,因为这个工具似乎比 Gradle 插件更可预测和更稳定.

                  I will be also happy if there is a way to import lint data using external SonarQube Runner, since this tool seems to be more predictable and stable then a Gradle plugin.

                  推荐答案

                  我在一个多模块 android 项目上取得了成功.由于完整的构建文件占用太多空间,我只在此处显示相关部分.

                  I had success with a multimodule android project. Since the complete build files take too much space I show the relevant parts here only.

                  在父项目的build.gradle我设置:

                  buildscript {
                      ...
                      dependencies { classpath 'com.android.tools.build:gradle:1.5.0'
                      ...
                  }
                  plugins { id "org.sonarqube" version "1.1" }
                  

                  在我设置的应用项目(和任何其他子项目)中:

                  In the app project (and any other children) I set:

                  sonarqube {
                      properties {
                          property "sonar.profile", "Android Lint"
                          property "sonar.sources", "./src/main/java"
                      }
                  }
                  

                  这是 SonarQube 插件开始分析项目的最低设置.

                  That was the minimum setup for SonarQube plugin to start analyzing the projects.

                  这篇关于使用 Lint 和 SonarQube 分析 Android 项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Slf4j LoggerFactory.getLogger and sonarqube(Slf4j LoggerFactory.getLogger 和 sonarqube)
                  Security - Array is stored directly(安全性 - 数组直接存储)
                  SonarQube quot;Class Not Foundquot; during Main AST Scan(SonarQube“找不到类在主 AST 扫描期间)
                  Integrate Spock#39;s test with Sonar(将 Spock 的测试与声纳集成)
                  How do I make Hudson/Jenkins fail if Sonar thresholds are breached?(如果违反声纳阈值,我如何让 Hudson/Jenkins 失败?)
                  automatically add curly brackets to all if/else/for/while etc. in a java code-base(自动将大括号添加到 java 代码库中的所有 if/else/for/while 等)
                  <legend id='1rFnD'><style id='1rFnD'><dir id='1rFnD'><q id='1rFnD'></q></dir></style></legend>
                  • <bdo id='1rFnD'></bdo><ul id='1rFnD'></ul>

                          <tfoot id='1rFnD'></tfoot>
                          <i id='1rFnD'><tr id='1rFnD'><dt id='1rFnD'><q id='1rFnD'><span id='1rFnD'><b id='1rFnD'><form id='1rFnD'><ins id='1rFnD'></ins><ul id='1rFnD'></ul><sub id='1rFnD'></sub></form><legend id='1rFnD'></legend><bdo id='1rFnD'><pre id='1rFnD'><center id='1rFnD'></center></pre></bdo></b><th id='1rFnD'></th></span></q></dt></tr></i><div id='1rFnD'><tfoot id='1rFnD'></tfoot><dl id='1rFnD'><fieldset id='1rFnD'></fieldset></dl></div>

                          <small id='1rFnD'></small><noframes id='1rFnD'>

                              <tbody id='1rFnD'></tbody>