我正在我的aspnetcore2.2项目上尝试sonarqube。
该项目使用MSbuild版本-16.1.76.45076。
当我运行官方的dotnet-sonarscanner工具版本4.6.2时,只分析CSS代码,而不分析项目中的C#、Javascript和其他代码。
使用不同的Sonarscanner工具:
我还用不同的声呐扫描仪工具进行了检查
使用的Sonarscanner工具
分析了ASPNETCORE2.0、ASPNETCORE2.1对所有C#、HTML、Javascript和CSS文件的影响
还用不同的MSBuild版本和sonarscanner工具对它们进行了测试。
已尝试CLI命令
dotnet sonarscanner begin /k:"<projectname>" /d:sonar.host.url="<sonarqserver>" /d:sonar.login="<usertoken>"
dotnet build
dotnet sonarscanner end /d:sonar.login="<usertoken>"
dotnet <pathto Sonarscanner.MSBuild.dll> begin /k:"<projectname>" /d:sonar.host.url="<sonarqserver>" /d:sonar.login="<usertoken>"
dotnet build
dotnet <pathto Sonarscanner.MSBuild.dll> end /d:sonar.login="<usertoken>"
dotnet sonarscanner begin /k:"<projectname>" /d:sonar.host.url="<sonarqserver>" /d:sonar.login="<usertoken>"
<pathto MSBuildversion.exe> build
dotnet sonarscanner end /d:sonar.login="<usertoken>"
预期的结果是
实际结果是
>
/d:sonar.verbose=true
对开始步骤进行了测试并进行了分析,这些都是从输出中观察到的关键点
文件的索引完成了,所有文件包括。cs,。cshtml(Razor页面),简化的js,简化的CSS,CSS和其他文件都在此过程中被拾取。
DEBUG: Sensors : SonarCSS Metrics -> SonarCSS Rules -> JaCoCo XML Report Importer -> C# Properties -> JavaXmlSensor -> XML Sensor.
这将启动CSS分析,默认情况下,它使用节点,-v,v8.12.0
。下面处理的节点也用于。cshtml文件。-从其余的传感器中,得到以下输出
Sensor JavaXmlSensor [java]
2 source files to be analyzed
'AnalysisFile.xml' generated metadata as test with charset 'UTF-8'
'wwwroot/XML/AnalysisFile_16-04-2019.xml' generated metadata as test with charset 'UTF-8'
Sensor JavaXmlSensor [java] (done) | time=1284ms
Sensor C# Properties [csharp]
Analyzer working directory '<ProjectDir>\.sonarqube\out\0\output-cs' contains 5 .pb file(s)
Found Roslyn issues report
Sensor C# Properties [csharp] (done) | time=15ms
Sensor C# [csharp]
No files to analyze. Skip Sensor.
Sensor C# [csharp] (done) | time=0ms
Java CPD Block Indexer' skipped because there is no related file in current project
Sensor Zero Coverage Sensor (done) | time=0ms
<filename>.cshtml generated metadata as test with charset 'UTF-8'
<filename>.cs generated metadata as test with charset 'UTF-8'
WARN: Missing blame information for the following files
WARN: * SonarQube.Analysis.xml
WARN: This may lead to missing/broken features in SonarQube
这个问题仍然存在
(注意:这些问题是在MSBuild repo的扫描器和Sonarscanner社区中提出的--Sonarscanner社区中的答案)
@ArmourShield你对S4MSB回购中这个问题的最新评论是:
I wanted to test the environment if it is right with the same tools
Created new projects for dotnetcore2.1 and dotnetcore2.2
When running the sonarq analysis it ran perfectly analyzing all the files
@邓肯·波克林顿
<?xml version="1.0" encoding="utf-8"?>
<ProjectInfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.sonarsource.com/msbuild/integration/2015/1">
<ProjectName>project</ProjectName>
<ProjectLanguage>C#</ProjectLanguage>
<ProjectType>Test</ProjectType>
<ProjectGuid>ad649366-fea7-4513-91e3-90deb56bd30c</ProjectGuid>
<FullPath>project.csproj</FullPath>
<IsExcluded>false</IsExcluded>
<AnalysisResults>
<AnalysisResult Id="FilesToAnalyze" Location=".sonarqube\out\0\FilesToAnalyze.txt" />
</AnalysisResults>
<AnalysisSettings>
<Property Name="sonar.cs.roslyn.reportFilePath">project\bin\Debug\netcoreapp2.2\project.dll.RoslynCA.json|project\bin\Debug\netcoreapp2.2\project.Views.dll.RoslynCA.json</Property>
<Property Name="sonar.cs.analyzer.projectOutPath">project\.sonarqube\out\0</Property>
</AnalysisSettings>
<Configuration>Debug</Configuration>
<Platform>AnyCPU</Platform>
<TargetFramework>netcoreapp2.2</TargetFramework>
</ProjectInfo>
sonar.projectKey=exp_test
sonar.working.directory=D:\\Work\\Experiment\\project\\.sonarqube\\out\\.sonar
sonar.projectBaseDir=project
AD649366-FEA7-4513-91E3-90DEB56BD30C.sonar.projectKey=exp_test:AD649366-FEA7-4513-91E3-90DEB56BD30C
AD649366-FEA7-4513-91E3-90DEB56BD30C.sonar.projectName=project
AD649366-FEA7-4513-91E3-90DEB56BD30C.sonar.projectBaseDir=project
AD649366-FEA7-4513-91E3-90DEB56BD30C.sonar.sourceEncoding=utf-8
AD649366-FEA7-4513-91E3-90DEB56BD30C.sonar.sources=
AD649366-FEA7-4513-91E3-90DEB56BD30C.sonar.tests=\
"project\\Areas\\Identity\\file.cs",\
"project\\Areas\\Identity\\Pages\\Account\\file.cshtml.cs",\
"project\\Areas\\Identity\\Pages\\Account\\file.cshtml.cs",\
"project\\Controllers\\file.cs",\
"project\\Controllers\\file.cs",\
"project\\Controllers\\file.cs",\
"project\\Controllers\\file.cs",\
"project\\Controllers\\file.cs",\
"project\\Controllers\\file.cs",\
"project\\Controllers\\file.cs",\
"project\\Controllers\\file.cs",\
"project\\Data\\file.cs",\
"project\\Data\\file.cs",\
"project\\Models\\file.cs",\
"project\\Models\\file.cs",\
"project\\Models\\file.cs",\
"project\\Models\\file.cs",\
"project\\Models\\file.cs",\
"project\\Models\\file.cs",\
"project\\Models\\file.cs",\
"project\\Models\\file.cs",\
"project\\Models\\file.cs",\
"project\\Models\\file.cs",\
"project\\Models\\file.cs",\
"project\\Models\\file.cs",\
"project\\Models\\file.cs",\
"project\\Models\\file.cs",\
"project\\Models\\file.cs",\
"project\\Models\\file.cs",\
"project\\Models\\file.cs",\
"project\\Models\\file.cs",\
"project\\Models\\file.cs",\
"project\\Models\\file.cs",\
"project\\Models\\file.cs",\
"project\\Models\\file.cs",\
"project\\Models\\file.cs",\
"project\\Models\\file.cs",\
"project\\Models\\file.cs",\
"project\\Models\\file.cs",\
"project\\Models\\file.cs",\
"project\\Models\\file.cs",\
"project\\Models\\file.cs",\
"project\\Models\\file.cs",\
"project\\file.cs",\
"project\\REST\\Controllers\\file.cs",\
"project\\REST\\Controllers\\file.cs",\
"project\\REST\\Controllers\\file.cs",\
"project\\REST\\UnitTests\\file.cs",\
"project\\REST\\ViewModels\\file.cs",\
"project\\REST\\ViewModels\\file.cs",\
"project\\REST\\ViewModels\\file.cs",\
"project\\file.cs",\
"project\\ViewComponents\\file.cs",\
"project\\ViewModels\\file.cs",\
"project\\ViewModels\\file.cs",\
"project\\ViewModels\\file.cs",\
"project\\ViewModels\\file.cs",\
"project\\ViewModels\\file.cs",\
"project\\obj\\Debug\\netcoreapp2.2\\project.file.cs",\
"project\\obj\\Debug\\netcoreapp2.2\\project.file.cs",\
"project\\Areas\\Identity\\Pages\\Account\\file.cshtml",\
"project\\Areas\\Identity\\Pages\\Account\\file.cshtml",\
"project\\Areas\\Identity\\Pages\\Account\\_file.cshtml",\
"project\\Areas\\Identity\\Pages\\_file.cshtml",\
"project\\Areas\\Identity\\Pages\\_file.cshtml",\
"project\\Areas\\Identity\\Pages\\_file.cshtml",\
"project\\Views\\Account\\file.cshtml",\
"project\\Views\\Audit\\file.cshtml",\
"project\\Views\\Home\\file.cshtml",\
"project\\Views\\Home\\file.cshtml",\
"project\\Views\\Home\\file.cshtml",\
"project\\Views\\Home\\file.cshtml",\
"project\\Views\\Home\\file.cshtml",\
"project\\Views\\Home\\file.cshtml",\
"project\\Views\\Home\\file.cshtml",\
"project\\Views\\Home\\file.cshtml",\
"project\\Views\\Home\\file.cshtml",\
"project\\Views\\Incident\\file.cshtml",\
"project\\Views\\Incident\\file.cshtml",\
"project\\Views\\ProfileUpload\\file.cshtml",\
"project\\Views\\ProfileUpload\\file.cshtml",\
"project\\Views\\Shared\\Components\\Profile\\file.cshtml",\
"project\\Views\\Shared\\file.cshtml",\
"project\\Views\\Shared\\_file.cshtml",\
"project\\Views\\Shared\\_file.cshtml",\
"project\\Views\\Shared\\_file.cshtml",\
"project\\Views\\UserManagement\\file.cshtml",\
"project\\Views\\UserManagement\\file.cshtml",\
"project\\Views\\UserManagement\\file.cshtml",\
"project\\Views\\UserManagement\\file.cshtml",\
"project\\Views\\UserManagement\\file.cshtml",\
"project\\Views\\UserManagement\\file.cshtml",\
"project\\Views\\XMlParse\\file.cshtml",\
"project\\Views\\XMlParse\\file.cshtml",\
"project\\Views\\XMlParse\\file.cshtml",\
"project\\Views\\XMlParse\\file.cshtml",\
"project\\Views\\XMlParse\\file.cshtml",\
"project\\Views\\XMlParse\\file.cshtml",\
"project\\Views\\_file.cshtml",\
"project\\Views\\_file.cshtml",\
"project\\wwwroot\\css\\css-chart.css",\
"project\\wwwroot\\css\\site.css",\
"project\\wwwroot\\css\\site.min.css",\
"project\\wwwroot\\css\\stylesheet.css",\
"project\\wwwroot\\favicon.ico",\
"project\\wwwroot\\images\\favicon.ico",\
"project\\wwwroot\\images\\favicon.png",\
"project\\wwwroot\\images\\landing-page-background.jpg",\
"project\\wwwroot\\images\\no-user.jpg",\
"project\\wwwroot\\images\\user.png",\
"project\\wwwroot\\images\\yondrlogo.png",\
"project\\wwwroot\\images\\yondrlogoblack.png",\
"project\\wwwroot\\images\\yongroup-main.jpg",\
"project\\wwwroot\\js\\bootstrap-material-design.min.js",\
"project\\wwwroot\\js\\chartist.min.js",\
"project\\wwwroot\\js\\jquery-ui.min.js",\
"project\\wwwroot\\js\\jquery.dataTables.min.js",\
"project\\wwwroot\\js\\jquery.min.js",\
"project\\wwwroot\\js\\material-dashboard.min.js",\
"project\\wwwroot\\js\\perfect-scrollbar.jquery.min.js",\
"project\\wwwroot\\js\\popper.min.js",\
"project\\wwwroot\\js\\site.js",\
"project\\wwwroot\\js\\site.min.js",\
"project\\wwwroot\\lib\\bootstrap\\.bower.json",\
"project\\wwwroot\\lib\\bootstrap\\dist\\css\\bootstrap-grid.css",\
"project\\wwwroot\\lib\\bootstrap\\dist\\css\\bootstrap-grid.css.map",\
"project\\wwwroot\\lib\\bootstrap\\dist\\css\\bootstrap-grid.min.css",\
"project\\wwwroot\\lib\\bootstrap\\dist\\css\\bootstrap-grid.min.css.map",\
"project\\wwwroot\\lib\\bootstrap\\dist\\css\\bootstrap-reboot.css",\
"project\\wwwroot\\lib\\bootstrap\\dist\\css\\bootstrap-reboot.css.map",\
"project\\wwwroot\\lib\\bootstrap\\dist\\css\\bootstrap-reboot.min.css",\
"project\\wwwroot\\lib\\bootstrap\\dist\\css\\bootstrap-reboot.min.css.map",\
"project\\wwwroot\\lib\\bootstrap\\dist\\css\\bootstrap-theme.css",\
"project\\wwwroot\\lib\\bootstrap\\dist\\css\\bootstrap-theme.css.map",\
"project\\wwwroot\\lib\\bootstrap\\dist\\css\\bootstrap-theme.min.css",\
"project\\wwwroot\\lib\\bootstrap\\dist\\css\\bootstrap-theme.min.css.map",\
"project\\wwwroot\\lib\\bootstrap\\dist\\css\\bootstrap.css",\
"project\\wwwroot\\lib\\bootstrap\\dist\\css\\bootstrap.css.map",\
"project\\wwwroot\\lib\\bootstrap\\dist\\css\\bootstrap.min.css",\
"project\\wwwroot\\lib\\bootstrap\\dist\\css\\bootstrap.min.css.map",\
"project\\wwwroot\\lib\\bootstrap\\dist\\fonts\\glyphicons-halflings-regular.eot",\
"project\\wwwroot\\lib\\bootstrap\\dist\\fonts\\glyphicons-halflings-regular.svg",\
"project\\wwwroot\\lib\\bootstrap\\dist\\fonts\\glyphicons-halflings-regular.ttf",\
"project\\wwwroot\\lib\\bootstrap\\dist\\fonts\\glyphicons-halflings-regular.woff",\
"project\\wwwroot\\lib\\bootstrap\\dist\\fonts\\glyphicons-halflings-regular.woff2",\
"project\\wwwroot\\lib\\bootstrap\\dist\\js\\bootstrap.bundle.js",\
"project\\wwwroot\\lib\\bootstrap\\dist\\js\\bootstrap.bundle.js.map",\
"project\\wwwroot\\lib\\bootstrap\\dist\\js\\bootstrap.bundle.min.js",\
"project\\wwwroot\\lib\\bootstrap\\dist\\js\\bootstrap.bundle.min.js.map",\
"project\\wwwroot\\lib\\bootstrap\\dist\\js\\bootstrap.js",\
"project\\wwwroot\\lib\\bootstrap\\dist\\js\\bootstrap.js.map",\
"project\\wwwroot\\lib\\bootstrap\\dist\\js\\bootstrap.min.js",\
"project\\wwwroot\\lib\\bootstrap\\dist\\js\\bootstrap.min.js.map",\
"project\\wwwroot\\lib\\bootstrap\\dist\\js\\npm.js",\
"project\\wwwroot\\lib\\bootstrap\\LICENSE",\
"project\\wwwroot\\lib\\jquery-validation-unobtrusive\\.bower.json",\
"project\\wwwroot\\lib\\jquery-validation-unobtrusive\\jquery.validate.unobtrusive.js",\
"project\\wwwroot\\lib\\jquery-validation-unobtrusive\\jquery.validate.unobtrusive.min.js",\
"project\\wwwroot\\lib\\jquery-validation-unobtrusive\\LICENSE.txt",\
"project\\wwwroot\\lib\\jquery-validation\\.bower.json",\
"project\\wwwroot\\lib\\jquery-validation\\dist\\additional-methods.js",\
"project\\wwwroot\\lib\\jquery-validation\\dist\\additional-methods.min.js",\
"project\\wwwroot\\lib\\jquery-validation\\dist\\jquery.validate.js",\
"project\\wwwroot\\lib\\jquery-validation\\dist\\jquery.validate.min.js",\
"project\\wwwroot\\lib\\jquery-validation\\LICENSE.md",\
"project\\wwwroot\\lib\\jquery\\.bower.json",\
"project\\wwwroot\\lib\\jquery\\dist\\jquery.js",\
"project\\wwwroot\\lib\\jquery\\dist\\jquery.min.js",\
"project\\wwwroot\\lib\\jquery\\dist\\jquery.min.map",\
"project\\wwwroot\\lib\\jquery\\LICENSE.txt",\
"project\\wwwroot\\swagger-ui\\style.css",\
"project\\nlog.config",\
"project\\appsettings.Development.json",\
"project\\appsettings.json",\
"project\\Connected Services\\Application Insights\\ConnectedService.json",\
"project\\Properties\\launchSettings.json",\
"project\\internalLog.txt"
AD649366-FEA7-4513-91E3-90DEB56BD30C.sonar.cs.roslyn.reportFilePath=project\\bin\\Debug\\netcoreapp2.2\\project.dll.RoslynCA.json
AD649366-FEA7-4513-91E3-90DEB56BD30C.sonar.cs.analyzer.projectOutPath=project\\.sonarqube\\out\\0
AD649366-FEA7-4513-91E3-90DEB56BD30C.sonar.cs.analyzer.projectOutPaths=\
"project\\.sonarqube\\out\\0"
AD649366-FEA7-4513-91E3-90DEB56BD30C.sonar.cs.roslyn.reportFilePaths=\
"project\\bin\\Debug\\netcoreapp2.2\\project.dll.RoslynCA.json",\
"project\\bin\\Debug\\netcoreapp2.2\\project.Views.dll.RoslynCA.json"
AD649366-FEA7-4513-91E3-90DEB56BD30C.sonar.working.directory=project\\.sonarqube\\out\\.sonar\\mod0
sonar.host.url=sonarqurl
sonar.visualstudio.enable=false
sonar.modules=AD649366-FEA7-4513-91E3-90DEB56BD30C
在这里,源文件将用于测试而不是源代码,对于新项目,它将用于源代码。
但对于当前的项目,它将进行测试
@邓肯·波克林顿
```
<!-- in .csproj -->
<PropertyGroup>
<!-- Mark the project as being a test project -->
<SonarQubeTestProject>false</SonarQubeTestProject>
</PropertyGroup>
```
如下图所示,SonarSource在11之前的Java版本中终止了对运行代码分析器的支持 我试图搜索一个完整的示例,说明如何使用Java11分析器运行bitbucket管道来执行SonarScanner分析,但目标代码使用Java11之前的版本(例如Java8),但我找不到一个。根据那个形象,应该是可能的。
问题内容: 我仅使用kibana搜索ElasticSearch,并且我有几个只能接受几个值的字段(最坏的情况,服务器名,30个不同的值)。 我确实了解分析对像这样的更大,更复杂的字段执行的操作,但是对于那些简单的小字段,我却无法理解分析/未分析字段的优点/缺点。 那么,对于“有限的一组值”字段(例如,服务器名:server [0-9] *,没有特殊字符可以打破),使用analyd和not_anal
我用cmd删除了映射 在我的配置文件中,我定义了如下索引:, 并尝试创建一个新的映射,但我得到了错误 {“error”:{“root_cause”:[{“type”:“index_not_found_exception”,“reason”:“no-this index”,“resource.type”:“index_or_alias”,“resource.id”:“logstash_log*”,“
背景: 在我的数据库表中,我有两个时间戳 当我执行“按时间戳ASC排序”时,时间戳2被认为是更大的时间戳(这是正确的)。 要求:我需要得到这些时间戳的差异(timeStamp2-timeStamp1) 我的实施: 答案应该是238ms,但返回的值是-653ms。我不确定我做错了什么。有什么建议吗?
我在android应用程序中使用Google analytics v4。安装跟踪在几天内工作正常,突然我的广播接收器没有注册。 Logcat表示:活动跟踪接收器未注册、未导出或已禁用。无法进行安装活动跟踪。看见http://goo.gl/8Rd3yj请示。 这是我在清单应用程序标记中所做的: 我定制的竞选跟踪接收器看起来像这样: 我不知道事情在哪里失控了。我在清单中只使用了一个INSTALL\u
我试图在我的网站中使用谷歌分析。我直接从谷歌分析网站复制了代码,并按照说明将其嵌入到我的超文本标记语言中。 以下是我的代码: 当我用这个脚本加载我的页面时,需要几秒钟。没有脚本,它几乎可以立即加载。这就是我如何知道问题出在Google Analytics(分析)代码中的原因。 页面最终加载后,会出现以下错误消息: 经过进一步调查,未找到的文件来自第5行的。 如何让此文件或脚本正常工作?