<legend id='D8Cl8'><style id='D8Cl8'><dir id='D8Cl8'><q id='D8Cl8'></q></dir></style></legend>
        <bdo id='D8Cl8'></bdo><ul id='D8Cl8'></ul>

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

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

      Sonarqube 默认覆盖范围为 0,来自具有绝对路径的 Karma Coverage LCOV 文件

      Sonarqube default coverage to 0 from Karma Coverage LCOV file with absolute pathjs(Sonarqube 默认覆盖范围为 0,来自具有绝对路径的 Karma Coverage LCOV 文件)

      1. <small id='fgCa7'></small><noframes id='fgCa7'>

        <tfoot id='fgCa7'></tfoot>

        1. <legend id='fgCa7'><style id='fgCa7'><dir id='fgCa7'><q id='fgCa7'></q></dir></style></legend>
            <tbody id='fgCa7'></tbody>

            <bdo id='fgCa7'></bdo><ul id='fgCa7'></ul>

              <i id='fgCa7'><tr id='fgCa7'><dt id='fgCa7'><q id='fgCa7'><span id='fgCa7'><b id='fgCa7'><form id='fgCa7'><ins id='fgCa7'></ins><ul id='fgCa7'></ul><sub id='fgCa7'></sub></form><legend id='fgCa7'></legend><bdo id='fgCa7'><pre id='fgCa7'><center id='fgCa7'></center></pre></bdo></b><th id='fgCa7'></th></span></q></dt></tr></i><div id='fgCa7'><tfoot id='fgCa7'></tfoot><dl id='fgCa7'><fieldset id='fgCa7'></fieldset></dl></div>
                本文介绍了Sonarqube 默认覆盖范围为 0,来自具有绝对路径的 Karma Coverage LCOV 文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                当我的 lcov 文件中的路径是绝对路径时,Sonar 不会检索我的项目的覆盖信息.对于文件:

                Sonar does not retrieve the coverage information for my project when paths are absolute in my lcov file. For the file:

                TN:
                SF:/mnt/vg01-data01/jenkins/<jenkins.myhost.com>/jenkins_home/workspace/<job1>/src/app.js
                FN:,(anonymous_0)
                FN:,(anonymous_1)
                FNF:2
                FNH:2
                FNDA:1,(anonymous_0)
                FNDA:2,(anonymous_1)
                DA:3,1
                DA:4,1
                DA:6,1
                DA:7,1
                DA:8,1
                DA:9,1
                DA:11,1
                DA:18,1
                DA:19,1
                DA:22,2
                DA:27,1
                LF:11
                LH:11
                BRF:0
                BRH:0
                end_of_record
                ....
                

                我收到以下警告:

                ...
                05:06:27.565 INFO: Analysing [/srv/jenkins/<jenkins.myhost.com>/jenkins_home/workspace/<job1>/coverage/lcov.info]
                05:06:27.574 DEBUG: Default value of zero will be saved for file: src/app.js
                05:06:27.574 DEBUG: Because was not present in LCOV report.
                05:06:27.578 DEBUG: Default value of zero will be saved for file: src/app.spec.js
                05:06:27.578 DEBUG: Because was not present in LCOV report.
                05:06:27.579 DEBUG: Default value of zero will be saved for file: src/js/form/form.ctrl.js
                05:06:27.579 DEBUG: Because was not present in LCOV report.
                05:06:27.580 DEBUG: Default value of zero will be saved for file: src/js/form/form.module.js
                05:06:27.580 DEBUG: Because was not present in LCOV report.
                05:06:27.581 DEBUG: Default value of zero will be saved for file: src/js/success/success.ctrl.js
                
                ...
                

                但是,默认情况下,业力(和 istambul)正在生成具有绝对路径的文件.

                However, by default karma (and istambul) are generating file with absolute paths.

                如果我更改路径以使其相对,sonarqube 会正确报告覆盖范围.但是,我必须确保在向声纳报告之前始终运行lcov 补丁"脚本.

                If I change the paths to make them relative, sonarqube reports the coverage correctly. However, I must ensure a "lcov patch" script is always run before reporting to sonar.

                声纳是否支持绝对路径?其他团队正在为这个问题做些什么?这些是我正在使用的版本:

                Does sonar support absolute paths? What are other teams doing for this issue? These are the versions I am using:

                • 业力@1.3.0 &业力覆盖@1.1.1
                • 声纳 6.1 和 JavaScript 插件 2.14

                更新:我用作业中的确切文件和日志替换了我看到的文件和日志(出于安全原因,我仍然必须更改主机和作业的名称.)

                Update: I replaced the file and log I see with the exact ones from the jobs (I still must change the name of the host and job for security reasons.)

                2016 年 3 月更新:我已经向 Istambul 发送了一个拉取请求,以便能够生成具有相对路径的 lcov 文件.我希望这能解决这个问题 https://github.com/gotwarlost/istanbul/pull/771

                Update March 2016: I have sent a Pull Request to Istambul to enable to generate lcov file with relative paths. I expect this to solve this issue https://github.com/gotwarlost/istanbul/pull/771

                推荐答案

                SonarQube JavaScript 插件应该能够处理 LCOV 文件中的相对路径和绝对路径.但是,您的设置似乎不正确.您的 LCOV 文件是指给定目录中的文件路径:

                The SonarQube JavaScript plugin should be able to handle both relative and absolute paths in LCOV files. However, it seems that your setup is incorrect. Your LCOV file refers to file paths in a given directory:

                SF:/home/mrincon/work/git/promoter-app-client/src/app.js
                

                根据您的分析日志,您的分析似乎是在另一个目录中运行的:

                And based on the logs of your analysis, it seems that your analysis is run in another directory:

                Analysing [/srv/jenkins/master/jenkins_home/workspace/job1/coverage/lcov.info]
                

                也许您在一台机器上生成了 LCOV 文件并在另一台机器上运行分析...最后,SonarQube 无法将 LCOV 文件中包含的路径与被分析的文件匹配.

                Maybe you generated the LCOV file on one machine and run the analysis on another... In the end, SonarQube can't match the paths contained in the LCOV file with the files which are analysed.

                您应该:

                • 生成 LCOV 报告并从中运行 SonarQube 分析目录,
                • 或让您的 LCOV 文件仅包含相对路径.

                这篇关于Sonarqube 默认覆盖范围为 0,来自具有绝对路径的 Karma Coverage LCOV 文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                相关文档推荐

                quot;Status Code:200 OK (from ServiceWorker)quot; in Chrome Network DevTools?(“状态码:200 OK(来自 ServiceWorker)在 Chrome 网络开发工具中?)
                How to set a header for a HTTP GET request, and trigger file download?(如何为 HTTP GET 请求设置标头并触发文件下载?)
                Adding custom HTTP headers using JavaScript(使用 JavaScript 添加自定义 HTTP 标头)
                SQL Query DocumentDB in Azure Functions by an integer not working(通过整数在 Azure Functions 中 SQL 查询 DocumentDB 不起作用)
                Azure Functions [JavaScript / Node.js] - HTTP call, good practices(Azure Functions [JavaScript/Node.js] - HTTP 调用,良好实践)
                Azure Functions - Import Custom Node Module(Azure Functions - 导入自定义节点模块)
                <tfoot id='nPIbE'></tfoot>

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

                      <legend id='nPIbE'><style id='nPIbE'><dir id='nPIbE'><q id='nPIbE'></q></dir></style></legend>

                            <tbody id='nPIbE'></tbody>

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