DanielHWe / sonar-fxcop

FxCop plugin for C# or VB.NET projects
13 stars 6 forks source link

How to analyze a vbnet project? #32

Open pacolmos opened 4 years ago

pacolmos commented 4 years ago

Hi.

I have tried to analize a vbnet project, it is built succesfully, but when sensor FxCop begins, it returns: INFO: Sensor FxCop (vbnet) [fxcop] INFO: Base Dir: D:\xxxx INFO: Project key: es.xxxx:xxxx:es.xxxx:xxxx:2118A8E7-A9B3-4A5B-8364-4C4DA8676FCA INFO: Work Dir: D\xxxx\xxxx\Codigo\.sonarqube\out\.sonar\mod3 INFO: FxCop start create FxCop configuration for 'C:\Program Files (x86)\Microsoft Visual Studio 14.0\Team Tools\Static Analysis Tools\FxCop\FxCopCmd.exe' EERROR: No projects found to scan, can not generate FxCop configuration. INFO: ------------------------------------------------------------------------ INFO: EXECUTION FAILURE INFO: ------------------------------------------------------------------------ INFO: Total time: 18.210s INFO: Final Memory: 14M/50M ERROR: Error during SonarQube Scanner execution java.lang.IllegalArgumentException: No projects found to scan, can not generate FxCop configuration. at org.sonar.plugins.fxcop.FxCopProjectGenerator.getTargetFiles(FxCopProjectGenerator.java:54) at org.sonar.plugins.fxcop.FxCopProjectGenerator.generate(FxCopProjectGenerator.java:36) at org.sonar.plugins.fxcop.FxCopSensor.getTargetForSetting(FxCopSensor.java:281) at org.sonar.plugins.fxcop.FxCopSensor.executeFxCop(FxCopSensor.java:208) at org.sonar.plugins.fxcop.FxCopSensor.analyse(FxCopSensor.java:95) at org.sonar.plugins.fxcop.FxCopSensor.executeImpl(FxCopSensor.java:83) at org.sonar.plugins.fxcop.FxCopSensor.execute(FxCopSensor.java:73) at org.sonar.scanner.sensor.AbstractSensorWrapper.analyse(AbstractSensorWrapper.java:48) at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:85) at org.sonar.scanner.sensor.ModuleSensorsExecutor.lambda$execute$1(ModuleSensorsExecutor.java:59) at org.sonar.scanner.sensor.ModuleSensorsExecutor.withModuleStrategy(ModuleSensorsExecutor.java:77) at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:59) at org.sonar.scanner.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:82) at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:136) INFO: ------------------------------------------------------------------------ at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:122) at org.sonar.scanner.scan.ProjectScanContainer.scan(ProjectScanContainer.java:400) at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:395) at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:392) at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:358) at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:136) at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:122) at org.sonar.scanner.bootstrap.GlobalContainer.doAfterStart(GlobalContainer.java:141) at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:136) at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:122) at org.sonar.batch.bootstrapper.Batch.doExecute(Batch.java:73) at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:67) at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:566) 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:185) at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:137) at org.sonarsource.scanner.cli.Main.execute(Main.java:112) at org.sonarsource.scanner.cli.Main.execute(Main.java:75) at org.sonarsource.scanner.cli.Main.main(Main.java:61) ERROR: The SonarQube Scanner did not complete successfully 16:39:44.617 Post-processing failed. Exit code: 1

My SonarScanner configuration is:

<?xml version="1.0" encoding="utf-8"?>
<SonarQubeAnalysisProperties 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">
    <Property Name="sonar.cs.fxcop.fxCopCmdPath">C:\Program Files (x86)\Microsoft Visual Studio 14.0\Team Tools\Static Analysis Tools\FxCop\FxCopCmd.exe</Property>
    <Property Name="sonar.vbnet.fxcop.fxCopCmdPath">C:\Program Files (x86)\Microsoft Visual Studio 14.0\Team Tools\Static Analysis Tools\FxCop\FxCopCmd.exe</Property>

    <Property Name="sonar.cs.fxcop.slnFile">xxxx.sln</Property>
    <Property Name="sonar.vbnet.fxcop.slnFile">xxxx.sln</Property>

    <Property Name="sonar.dotnet.visualstudio.solution.file">xxxx.sln</Property>

</SonarQubeAnalysisProperties>

I have analyzed a csharp project succesfully but a vbnet project analysis fails.

I have seen that FxCopProjectGenerator.getTargetFiles() searches only csproj. Is that right?

How can I analyze vbnet projects?

Thank you very much.

DanielHWe commented 4 years ago

I think you are write, this seams to be a bug in FxCopProjectGenerator.getTargetFiles()

pacolmos commented 4 years ago

Hi.

I fixed the bug in this way:

Please, upload this changes to repository.

Thanks…. and happy New Year

DanielHWe commented 4 years ago

please make a pull request