gpt4 book ai didi

c# - Sonar 异常 : Unknown metric: temp-method-lines

转载 作者:太空宇宙 更新时间:2023-11-03 13:47:38 25 4
gpt4 key购买 nike

我花了好几个小时寻找答案,但我还没有找到任何解决方案。

我正在为 C# 项目运行 Sonar ,我使用 Sonar 3.4 和 sonar-runner 2.0 以及 C# 插件:

  • sonar-csharp-core-plugin-1.4
  • sonar-csharp-fxcop-plugin-1.4
  • sonar-csharp-gallio-plugin-1.4
  • sonar-csharp-gendarme-plugin-1.4
  • sonar-csharp-ndeps-plugin-1.4
  • sonar-csharp-squid-plugin-1.4
  • sonar-csharp-stylecop-plugin-1.4

在通过 sonar-runner 运行分析后我得到了那个异常

    Exception in thread "main" org.sonar.runner.RunnerException: org.sonar.api.utils.SonarException: Fail to decorate 'org.sonar.api.resources.File@243e2c21[key=ApplicationName.cs,dir=,filename=ApplicationName.cs,language=C#]'        at org.sonar.runner.Runner.delegateExecution(Runner.java:288)        at org.sonar.runner.Runner.execute(Runner.java:151)        at org.sonar.runner.Main.execute(Main.java:84)        at org.sonar.runner.Main.main(Main.java:56)    Caused by: org.sonar.api.utils.SonarException: Fail to      decorate'org.sonar.api.resources.File@243e2c21[key=ApplicationName.cs,dir=,filename=ApplicationName.cs,language=C#]'        at org.sonar.batch.phases.DecoratorsExecutor.executeDecorator(DecoratorsExecutor.java:84)        at org.sonar.batch.phases.DecoratorsExecutor.decorateResource(DecoratorsExecutor.java:70)        at org.sonar.batch.phases.DecoratorsExecutor.decorateResource(DecoratorsExecutor.java:63)        at org.sonar.batch.phases.DecoratorsExecutor.decorateResource(DecoratorsExecutor.java:63)        at org.sonar.batch.phases.DecoratorsExecutor.execute(DecoratorsExecutor.java:55)        at org.sonar.batch.phases.Phases.execute(Phases.java:92)        at org.sonar.batch.bootstrap.ProjectModule.doStart(ProjectModule.java:129)        at org.sonar.batch.bootstrap.Module.start(Module.java:68)        at org.sonar.batch.bootstrap.BatchModule.analyze(BatchModule.java:147)        at org.sonar.batch.bootstrap.BatchModule.analyze(BatchModule.java:141)        at org.sonar.batch.bootstrap.BatchModule.doStart(BatchModule.java:136)        at org.sonar.batch.bootstrap.Module.start(Module.java:68)        at org.sonar.batch.bootstrap.BootstrapModule.doStart(BootstrapModule.java:83)        at org.sonar.batch.bootstrap.Module.start(Module.java:68)        at org.sonar.batch.Batch.execute(Batch.java:106)        at org.sonar.runner.internal.batch.Launcher.executeBatch(Launcher.java:6        at org.sonar.runner.internal.batch.Launcher.execute(Launcher.java:61)        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)        at java.lang.reflect.Method.invoke(Method.java:601)        at org.sonar.runner.Runner.delegateExecution(Runner.java:285)        ... 3 more    Caused by: org.sonar.api.utils.SonarException: Unknown metric: temp-method-lines        at org.sonar.batch.index.DefaultIndex.addMeasure(DefaultIndex.java:184)        at org.sonar.batch.DefaultDecoratorContext.saveMeasure(DefaultDecoratorContext.java:111)        at org.sonar.plugins.uselesscodetracker.decorator.TempMethodLinesDecorator.computeDistributionFromChildren(TempMethodLinesDecorator.java:58)        at org.sonar.plugins.uselesscodetracker.decorator.TempMethodLinesDecorator.decorate(TempMethodLinesDecorator.java:49)        at org.sonar.batch.phases.DecoratorsExecutor.executeDecorator(DecoratorsExecutor.java:79)        ... 24 more

最佳答案

我不知道这个“temp-method-lines”指标是什么,从没听说过...

请安装最新版本的 .NET 和 C# 插件生态系统:version 2.0 .此外,请确保卸载任何其他可能带来此未知指标的插件(可能是您编写的自定义插件??)。

请升级到 Sonar 3.4.1,因为 3.4 版存在严重错误。

关于c# - Sonar 异常 : Unknown metric: temp-method-lines,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14752976/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com