代码之家  ›  专栏  ›  技术社区  ›  Samorix

分析在SonarQube上添加C#自定义规则后出错

  •  0
  • Samorix  · 技术社区  · 7 年前

    然后,我分析了几个。使用sonar scanner将cs文件放在同一目录下。但我犯了这个错误

    ERROR: Error during SonarQube Scanner execution
    java.lang.IllegalArgumentException: Custom and 3rd party Roslyn analyzers are only by MSBuild 14. Either use MSBuild 14, or disable the custom/3rd party Roslyn analyzers in your quality profile.
        at org.sonar.plugins.csharp.CSharpSensor.analyze(CSharpSensor.java:141)
        at org.sonar.plugins.csharp.CSharpSensor.executeInternal(CSharpSensor.java:112)
        at org.sonar.plugins.csharp.CSharpSensor.execute(CSharpSensor.java:79)
        at org.sonar.scanner.sensor.SensorWrapper.analyse(SensorWrapper.java:53)
        at org.sonar.scanner.phases.SensorsExecutor.executeSensor(SensorsExecutor.java:57)
        at org.sonar.scanner.phases.SensorsExecutor.execute(SensorsExecutor.java:49)
        at org.sonar.scanner.phases.AbstractPhaseExecutor.execute(AbstractPhaseExecutor.java:74)
        at org.sonar.scanner.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:175)
        at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:143)
        at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:128)
        at org.sonar.scanner.scan.ProjectScanContainer.scan(ProjectScanContainer.java:262)
        at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:257)
        at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:247)
        at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:143)
        at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:128)
        at org.sonar.scanner.task.ScanTask.execute(ScanTask.java:47)
        at org.sonar.scanner.task.TaskContainer.doAfterStart(TaskContainer.java:86)
        at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:143)
        at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:128)
        at org.sonar.scanner.bootstrap.GlobalContainer.executeTask(GlobalContainer.java:118)
        at org.sonar.batch.bootstrapper.Batch.executeTask(Batch.java:117)
        at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:63)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)
        at com.sun.proxy.$Proxy0.execute(Unknown Source)
        at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:233)
        at org.sonarsource.scanner.api.EmbeddedScanner.runAnalysis(EmbeddedScanner.java:151)
        at org.sonarsource.scanner.cli.Main.runAnalysis(Main.java:123)
        at org.sonarsource.scanner.cli.Main.execute(Main.java:77)
        at org.sonarsource.scanner.cli.Main.main(Main.java:61)
    

    一旦规则失效,我可以分析我的。cs文件正常

    SonarQube Scanner for MSBuild ,因为它需要一个完整的项目来分析,但在我的情况下, ,这就是为什么我需要使用声纳扫描仪

    我看到了 here

    有没有一个解决方案,我可以用我的新规则在声纳扫描仪下分析我的文件?

    1 回复  |  直到 7 年前
        1
  •  3
  •   Nicolas B.    7 年前

    Scanner for MSBuild 是任何分析的要求。Net代码与SonarQube。事实上,出于您已经明确的原因:

    • Roslyn是一个Microsoft框架,它在编译代码时起作用
    • 因此,基于Roslyn的分析仪需要 msbuild 处决
    • (集成了 msbuild

    由于上述原因,不可能对个人进行分析。cs文件与任何其他扫描仪。