Giter Site home page Giter Site logo

cnescatlab / sonar-icode-cnes-plugin Goto Github PK

View Code? Open in Web Editor NEW
18.0 7.0 11.0 2.65 MB

Add capability to analyze Fortran & Shell in SonarQube through i-Code CNES.

License: GNU General Public License v3.0

Java 87.42% Fortran 12.58%
i-code-cnes sonarqube-plugin sonarqube shell fortran fortran77 fortran90 ksh

sonar-icode-cnes-plugin's Introduction

sonar-icode-cnes-plugin

Build Status SonarQube Quality Gate SonarQube Bugs SonarQube Coverage SonarQube Technical Debt

SonarQube plugin for the code analysis tool: i-Code CNES.

SonarQube is an open platform to manage code quality. This plugin adds the ability to check Fortran (77 & 90) with i-Code or import pre-existing results of i-Code.

This plugin is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.

You can get i-Code CNES on GitHub: cnescatlab/i-CodeCNES.

Quickstart

  • Setup a SonarQube instance.
  • [Optional] Install i-Code command line application as described in official documentation.
  • Install sonaricode-*.jar in <SONARQUBE_HOME>/extensions/plugins/.
  • [Optional] Run i-Code manually or configure auto-launch in plugin configuration.
  • Run an analysis with sonar-scanner, maven, gradle, msbuild, etc.

Run i-Code automatically

This SonarQube plugin is now able to run automatically an embedded version of i-Code. If you do not specify properties to run i-Code manually or from a specific version, embedded version of i-Code will be executed.

Here is the compatibility matrix of the plugin:

sonaricode version embedded i-Code version supported SonarQube version supported languages
< 2.0.0 none 6.7.x Fortran / Shell
2.0.0 4.0.0 7.9 -> 8.2 Fortran / Shell
2.0.1 4.0.0 7.9 -> 8.2 Fortran / Shell
2.0.2 4.1.0 7.9 -> 8.2 Fortran / Shell
2.0.3 4.1.2 7.9 -> 8.2 Fortran / Shell
3.0.0 4.1.0 7.9 -> 8.2 Fortran
3.0.1 4.1.2 7.9 -> 8.2 Fortran
3.1.0 4.1.2 7.9 -> 9.9 Fortran
3.1.1 4.1.2 7.9 -> 9.9 Fortran

Run i-Code manually

If you need help to run i-Code please refer to the official user manual or i-Code issue tracker.

Run a specific i-Code version through sonaricode plugin

If embedded version of i-Code does not match your need, you can set the execution of another installed version of i-Code through the following properties:

  • sonar.icode.launch: Activate autolaunch for i-Code if true. Default: false.
  • sonar.icode.path: Define i-Code CNES executable path to auto-launch it on analysis. Default: ${HOME}/icode-cnes/icode.exe.

Other plugin's properties

  • sonar.icode.f77.file.suffixes: List of suffixes for F77 files to analyze. Default: .f,.f77,.for,.fpp,.ftn,.F,.F77,.FOR,.FPP,.FTN.
  • sonar.icode.f90.file.suffixes: List of suffixes for F90 files to analyze. Default: .f90,.F90.
  • sonar.icode.reports.path: Path to the i-Code reports. Multiple path can be provided. Default: result.res.

Features

  • Fortran 77 analysis
  • Fortran 90 analysis
  • Import i-Code results

Get i-Code help

Use icode -h to get the following help about i-Code:

usage: icode [<FILE> [...]] [-c <arg>] [-e] [-f <arg>] [-h] [-l] [-o <arg>] [-p <arg>] [-q <arg>] [-r] [-x <arg>]
Analyze F77 & F90 code to find defects & bugs.

 -c,--checked-languages <arg>        Comma separated list of languages checked during analysis. All by default.
 -e,--exporters                      Display all available exporters.
 -f,--export-format <arg>            Set the format for result file. Default format is XML.
 -h,--help                           Display this message.
 -l,--languages                      Display all available languages.
 -o,--output <arg>                   Set the name for result file. Results are displayed in standard output by default.
 -p,--export-parameters <arg>        Comma separated list of parameters for the export. Format is:
                                     key1=value1,key2=value2,key3=value3. Default values depend on the chosen export plugin.
 -q,--list-export-parameters <arg>   Display all available parameters for the given export.
 -r,--rules                          Display all available rules.
 -x,--excluded-rules <arg>           Comma separated list of rules id to exclude from analysis. None by default.

Please report issues at https://github.com/leqcnescatlabual/i-CodeCNES/issues

How to contribute

If you experienced a problem with the plugin please open an issue. Inside this issue please explain us how to reproduce this issue and paste the log.

If you want to do a PR, please put inside of it the reason of this pull request. If this pull request fix an issue please insert the number of the issue or explain inside of the PR how to reproduce this issue.

All details are available in CONTRIBUTING.

Feedback and Support

Bugs and Feature requests: https://github.com/cnescatlab/sonar-icode-cnes-plugin/issues

License

Licensed under the GNU General Public License, Version 3.0

sonar-icode-cnes-plugin's People

Contributors

at-nicolasmetivier avatar begarco avatar cfranccyrille avatar clemshubs avatar dev31520 avatar diegorodriguez31 avatar dupuisa avatar louisjdmartin avatar zaroastre avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

sonar-icode-cnes-plugin's Issues

sonaricode properties must be editable at project level

Expected behavior

sonaricode properties must be editable at project level.

Actual behavior

sonaricode properties are only editable at general level.

Steps to reproduce behavior

Try to edit a property for a specific project.

Detection version

1.1.0

Sonar scanner with icode plugis gives JRE error

Before posting a new question, please read the documentation](https://github.com/lequal/i-CodeCNES/wiki) and check existing issues

Describe what you need to know

I would like to analyze shell scripts in my project using this plugin with the integration of sonarqube to gitlab. I have installed the plugin from marketplace as well as tried using the command line (/extensions/plugins). When I commit a code change to the git repository, the sonarscanner analyzes other languages in the project but with shell scripts, I am encountering the below error. Note: The sonarserver is running on an EC2 instance launched from the bitnami AMI. Is there anything that I am missing or done incorrectly?

Screenshots & log

ERROR: Caused by: fr/cnes/sonar/plugins/icode/ICodePlugin has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0

User environment

Software versions

  • OS: linux-debian-10-x86_64
  • Java version: openjdk version "11.0.9.1" 2020-11-04 LTS
    OpenJDK Runtime Environment (build 11.0.9.1+1-LTS)
  • i-Code version: 2.0.2
  • Sonarqube version: 8.6.0.39681-0

Error with COM.NAME.Homonymy and crash the execution.

Hello... thanks for the help...

Describe what you need to know

I have configured some analyzes and they are giving the errors, presented in the attached log, apparently due to a rule, which I have deactivated in the profile assigned to the project but it does still fail.

Screenshots & log

User environment

Please complete the following information.

  • OS: windows 10 for the proyect , Linux (Centos) for Sonarqube
  • Java version: 8
  • SonarQube: 6.7
  • Plugin version: [ 2.0.1]

Additional context

03:11:52 03:11:52.863 INFO: ------------------------------------------------------------------------
03:11:52 03:11:52.863 INFO: EXECUTION FAILURE
03:11:52 03:11:52.863 INFO: ------------------------------------------------------------------------
03:11:52 03:11:52.863 INFO: Total time: 15.731s
03:11:53 03:11:53.001 INFO: Final Memory: 426M/1602M
03:11:53 03:11:53.001 INFO: ------------------------------------------------------------------------
03:11:53 03:11:53.001 ERROR: Error during SonarScanner execution
03:11:53 java.lang.IndexOutOfBoundsException: Index: -1, Size: 1
03:11:53 at java.util.LinkedList.checkElementIndex(Unknown Source)
03:11:53 at java.util.LinkedList.get(Unknown Source)
03:11:53 at fr.cnes.icode.fortran90.rules.COMNAMEHomonymy.run(COMNAMEHomonymy.java:1477)
03:11:53 at fr.cnes.icode.Analyzer.stableCheck(Analyzer.java:224)
03:11:53 at fr.cnes.sonar.plugins.icode.check.ICodeSensor.executeEmbeddedICode(ICodeSensor.java:189)
03:11:53 at fr.cnes.sonar.plugins.icode.check.ICodeSensor.execute(ICodeSensor.java:110)
03:11:53 at org.sonar.scanner.sensor.SensorWrapper.analyse(SensorWrapper.java:53)
03:11:53 at org.sonar.scanner.phases.SensorsExecutor.executeSensor(SensorsExecutor.java:88)
03:11:53 at org.sonar.scanner.phases.SensorsExecutor.execute(SensorsExecutor.java:82)
03:11:53 at org.sonar.scanner.phases.SensorsExecutor.execute(SensorsExecutor.java:68)
03:11:53 at org.sonar.scanner.phases.AbstractPhaseExecutor.execute(AbstractPhaseExecutor.java:88)
03:11:53 at org.sonar.scanner.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:177)
03:11:53 at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:135)
03:11:53 at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:121)
03:11:53 at org.sonar.scanner.scan.ProjectScanContainer.scan(ProjectScanContainer.java:291)
03:11:53 at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:286)
03:11:53 at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:264)
03:11:53 at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:135)
03:11:53 at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:121)
03:11:53 at org.sonar.scanner.task.ScanTask.execute(ScanTask.java:48)
03:11:53 at org.sonar.scanner.task.TaskContainer.doAfterStart(TaskContainer.java:84)
03:11:53 at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:135)
03:11:53 at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:121)
03:11:53 at org.sonar.scanner.bootstrap.GlobalContainer.executeTask(GlobalContainer.java:121)
03:11:53 at org.sonar.batch.bootstrapper.Batch.doExecuteTask(Batch.java:116)
03:11:53 at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:71)
03:11:53 at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46)
03:11:53 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
03:11:53 at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
03:11:53 at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
03:11:53 at java.lang.reflect.Method.invoke(Unknown Source)
03:11:53 at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)
03:11:53 at com.sun.proxy.$Proxy0.execute(Unknown Source)
03:11:53 at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:189)
03:11:53 at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:138)
03:11:53 at org.sonarsource.scanner.cli.Main.execute(Main.java:112)
03:11:53 at org.sonarsource.scanner.cli.Main.execute(Main.java:75)
03:11:53 at org.sonarsource.scanner.cli.Main.main(Main.java:61)
03:11:53 WARN: Unable to locate 'report-task.txt' in the workspace. Did the SonarScanner succeed?
03:11:53 ERROR: SonarQube scanner exited with non-zero code: 1
03:11:54 Finished: FAILURE

SonarQube analysis crashes when i-Code crashes

Describe the bug
Internal errors in i-Code checker make the analysis crash.

To reproduce
Run the SonarQube analysis on a file containing a known source of bug and with which i-Code throws exceptions.

Expected behavior
The plugin should:

  • log i-Code error
  • save a "parsing error" in SonarQube

Screenshots & log

10:37:49 INFO: Sensor fr.cnes.sonar.plugins.icode.check.ICodeSensor [sonaricode]
10:37:50 INFO: Reflections took 182 ms to scan 12 urls, producing 27 keys and 243 values
10:37:50 INFO: Reflections took 118 ms to scan 12 urls, producing 27 keys and 243 values
10:37:50 INFO: Reflections took 125 ms to scan 12 urls, producing 27 keys and 243 values
10:37:50 INFO: Reflections took 106 ms to scan 12 urls, producing 27 keys and 243 values
10:37:50 INFO: Reflections took 103 ms to scan 12 urls, producing 27 keys and 243 values
10:37:50 INFO: Reflections took 137 ms to scan 12 urls, producing 27 keys and 243 values
10:37:50 INFO: Reflections took 107 ms to scan 12 urls, producing 27 keys and 243 values
10:37:51 INFO: Reflections took 107 ms to scan 12 urls, producing 27 keys and 243 values
10:37:51 INFO: Reflections took 102 ms to scan 12 urls, producing 27 keys and 243 values
10:37:51 INFO: Reflections took 123 ms to scan 12 urls, producing 27 keys and 243 values
10:37:51 INFO: Reflections took 132 ms to scan 12 urls, producing 27 keys and 243 values
10:38:00 INFO: ------------------------------------------------------------------------
10:38:00 INFO: EXECUTION FAILURE
10:38:00 INFO: ------------------------------------------------------------------------
10:38:00 INFO: Total time: 14.485s
10:38:00 INFO: Final Memory: 419M/1185M
10:38:00 INFO: ------------------------------------------------------------------------
10:38:00 ERROR: Error during SonarQube Scanner execution
10:38:00 ERROR: Index: -1, Size: 1
10:38:00 ERROR:
10:38:00 ERROR: Re-run SonarQube Scanner using the -X switch to enable full debug logging.
10:38:00 WARN: Unable to locate 'report-task.txt' in the workspace. Did the SonarScanner succedeed?
10:38:00 ERROR: SonarQube scanner exited with non-zero code: 1
10:38:03 Finished: FAILURE

User environment (please complete the following information):

  • OS: Ubuntu
  • Java version: 11
  • i-Code version: 4.0.0
  • Plugin version: 2.0.1

Nesting metric seems missing

Describe the bug

A clear and concise description of what the bug is.
There are no more nesting metrics in Measure.

To reproduce

Steps to reproduce the behavior.

  1. Go to 'Measure'
  2. Click on 'Size'
  3. See there is no 'Nesting' metric

Expected behavior

A clear and concise description of what you expected to happen.
Metric 'Nesting' should be displayed in Size category.

Screenshots & log

If applicable, add screenshots to help explain your problem. Then, append SonarQube and i-Code log and do not forget to obfuscate them.
image

User environment

Please complete the following information.

  • OS: CentOS 7
  • Java version: 11
  • i-Code version: 3.2.0
  • Plugin version: 2.0.2

Additional context

Add any other context about the problem here.

Question about recursive analysis...

First of all, thanks for the plugin ... I have installed it and I have successfully performed analysis of a source directory ... but I cannot configure it for recursive analysis of a directory with two subdir´s and several inside with the sources

The plugin should support i-Code custom plugins

Is your feature request related to a problem? Please describe.
When using custom i-Code plugin for SonarQube, it is impossible to execute an i-Code custom plugin.

Describe the solution you'd like
The plugin for SonarQube should support call of custom i-Code plugins to run them on demand..

Describe alternatives you've considered
none

Additional context
none

Dead links on the README

There are some dead links in the README (at least the links to the icode installation and user manual).

Issue in auto-launch and results show in Sonarqube

Hi, I'm Carlos Mazo from EUMETSAT, colleague of Jordi Duatis, we talk today via email. Im trying to use the plugin for Sonarqube following the guide but I'm not succeeding. Could you give me some help, or examples please?

Thanks a lot!

Expected behavior

Being able to see analysis results in SonarQube
Being able to auto-launch Fortran analysis

Actual behavior

The plugin seems correctly loaded in Sonarqube, as I can see the Quality Profiles in the website.
Can't see analysis results in Sonarqube, when having results extracted manually (by executing the icode analyzer manually) following the plugin user manual
Can't get analysis results from auto-launch analysis, just getting some header of the results like the following:

<?xml version="1.0" encoding="UTF-8"?> <analysisProject analysisProjectName="Unknown" analysisProjectVersion="1.0.0"> <analysisInformations analysisConfigurationId="analysis1" analysisDate="2019-02-11" author="i-Code CNES Analyzer" /> </analysisProject>

Steps to reproduce behavior

Follow plugin documentation (probably I misunderstood something)

Detection version

1.1.0

Enhance comment's metrics accuracy

Expected behavior

Number of comment lines must be exact.

Actual behavior

Number of comment lines is not exact because of the computation is based on i-Code CommentRatio.
Waiting for i-Code 3.1.0.

Steps to reproduce behavior

Launch i-Code.

Detection version

1.0.0-alpha

Add new rules from i-Code 3.1.0

Expected behavior

sonaricode 1.1.0 should fully support i-Code 3.1.0 and its new rules.

Actual behavior

Supported rules are those of i-Code 3.0.1.

Detection version

1.0.2

Please improve documentation related to Java 11 requirements

Is your feature request related to a problem? Please describe.**

Upgrading the plugin to v2.0.2 causes analysis failures with SonarQube scanners older than version 4.0 because the plugin is compiled with Java 11 and the v3.x of the SonarQube Scanner has a v1.8 embedded JRE.

Describe the solution you'd like

Update the documentation and release notes to indicate that a Java 11 JRE is required to use the plugin, not just that the plugin supports Java 11.

Describe alternatives you've considered

A clear and concise description of any alternative solutions or features you've considered.

Additional context

Add any other context or screenshots about the feature request here.

Sensor should activate on file extensions from settings, not always the default one

Describe the bug

A clear and concise description of what the bug is.

Until now, sensor is activate if it detects default extensions files.

Expected behavior

A clear and concise description of what you expected to happen.

Sensor should be activated on detection of file extensions from settings.

Screenshots & log

If applicable, add screenshots to help explain your problem. Then, append SonarQube and i-Code log and do not forget to obfuscate them.

https://github.com/lequal/sonar-icode-cnes-plugin/blob/6fbf688e6de79c662f6df16af547e76d19b72f00/src/main/java/fr/cnes/sonar/plugins/icode/check/ICodeSensor.java#L74

User environment

Please complete the following information.

  • OS: Linux
  • Java version: 11
  • i-Code version: 4.1.0
  • Plugin version: 2.0.2

Rules related to metrics not available in standard configuration

Is your feature request related to a problem? Please describe.**

Since release 3.0, iCode provide rules related to metrics such as "SH.MET.LineOfCode, SH.MET.RatioComment, SH.MET.Nesting, SH.MET.ComplexitySimplified".

However, these rules are not provided by the Sonar plugin (see file "sonar-icode-cnes-plugin / src / main / resources / rules / icode-shell-rules.xml").

Describe the solution you'd like

Please, do provide plugin with all rules available.

Describe alternatives you've considered

Provide a way in order to add these rule (update of icode-shell-rules.xml ?).

Additional context

Thanx

The plugin should support template rules

Is your feature request related to a problem? Please describe.
When using custom i-Code plugins, it is impossible to import the results in SonarQube.

Describe the solution you'd like
The plugin should support template rules to allow the user to add custom results coming from custom i-Code plugins or from other tool exporting results in i-Code format.

Describe alternatives you've considered
none

Additional context
none

i-Code CNES auto-launch

Expected behavior

User should be able to choose to autolaunch i-Code CNES on analysis.

Actual behavior

User has to run i-Code CNES by himself before using sonar icode

Steps to reproduce behavior

/

Detection version

1.0.2

Navigation problems occur when changing tab in tabbed pane

Expected behavior

One clic allow to change the selected tab.

Actual behavior

For the first change you need to click two time on a tab.
For the second change we are automatically redirected to the first tab.
Then, it's ok.

Steps to reproduce behavior

  • Set following settings:
    • extension for result files: .res
    • source files' suffixes : *.f,*.f77,*.f90,*.sh,*.F,*.F77,*.F90
    • results folder : .
  • Create a quality profile containing all rules and set it as default
  • Execute sonar scanner in APSQ-005 : APSQ-005.zip
  • Go on metrics view
  • Try to go on another tab
  • Try again

Detection version

  • Plugin version: V0
  • SonarQube version: 6.7.1

Errored metrics

Expected behavior

Metrics reported in the view must reflect what i-Code analysis report.

Actual behavior

Only metrics on functions are reported and no metrics on global file are reused (anoying for script language like shell).

Steps to reproduce behavior

  • Set following settings:
    • extension for result files: .res
    • source files' suffixes : *.f,*.f77,*.f90,*.sh,*.F,*.F77,*.F90
    • results folder : .
  • Create a quality profile containing all rules and set it as default
  • Execute sonar scanner in APSQ-005 : APSQ-005.zip
  • Go on metrics page
  • Compare with i-Code results

Detection version

  • Plugin version: V0
  • SonarQube version: 6.7.1

Fortran rules should have a description

Expected behavior

Fortran rules should have a description.

Actual behavior

Fortran rules do not have a description.

Steps to reproduce behavior

See rules list.

Detection version

1.0.1

"Java heap space" error in Fortran calltrace without any fortran code to analyze

Hello

My sonar-scanner analysis fails with "Java heap space" with F90 or F77 in the calltrace while there's no fortran at all in my code.

Our IT recently upgraded to sonarqube 7.9.5, and I had to upgrade my sonar-scanner from 3.2.0.1227 to 4.5.0.2216 to get it to work (Java was too old in sonar-scanner 3.2). First I got the following backtrace (full log at the end of https://ci.inria.fr/hwloc/job/extended/job/master/285/execution/node/418/log/)

12:35:44.178 ERROR: Error during SonarScanner execution
java.lang.OutOfMemoryError: Java heap space
	at fr.cnes.icode.fortran90.rules.F90DATAConstantFloat.zzUnpackCMap(F90DATAConstantFloat.java:364)
	at fr.cnes.icode.fortran90.rules.F90DATAConstantFloat.<clinit>(F90DATAConstantFloat.java:77)
	at java.base/java.lang.Class.forName0(Native Method)
	at java.base/java.lang.Class.forName(Unknown Source)
	at fr.cnes.icode.data.xml.XmlHandler.classFromString(XmlHandler.java:87)
	at fr.cnes.icode.data.xml.XmlHandler.unmarshal(XmlHandler.java:53)
	at fr.cnes.icode.data.CheckersDefinition.addFromResources(CheckersDefinition.java:108)
	at fr.cnes.icode.fortran90.rules.Fortran90RulesDefinition.define(Fortran90RulesDefinition.java:27)
	at fr.cnes.icode.data.CheckersDefinition.list(CheckersDefinition.java:45)
	at fr.cnes.icode.services.checkers.CheckerService.getCheckers(CheckerService.java:60)
	at fr.cnes.icode.services.checkers.CheckerService.getCheckers(CheckerService.java:166)
	at fr.cnes.icode.Analyzer.stableCheck(Analyzer.java:91)
	at fr.cnes.sonar.plugins.icode.check.ICodeSensor.executeEmbeddedICode(ICodeSensor.java:187)
	at fr.cnes.sonar.plugins.icode.check.ICodeSensor.execute(ICodeSensor.java:109)
	at org.sonar.scanner.sensor.AbstractSensorWrapper.analyse(AbstractSensorWrapper.java:48)

This is running in a VM with 2GB of RAM so I added -Xmx1800m and got a slightly different failure (full log at the end of https://ci.inria.fr/hwloc/job/extended/job/master/286/execution/node/430/log/)

java.lang.OutOfMemoryError: Java heap space
	at fr.cnes.icode.fortran77.rules.F77ERROpenRead.zzUnpackCMap(F77ERROpenRead.java:431)
	at fr.cnes.icode.fortran77.rules.F77ERROpenRead.<clinit>(F77ERROpenRead.java:76)
	at java.base/java.lang.Class.forName0(Native Method)
	at java.base/java.lang.Class.forName(Unknown Source)
	at fr.cnes.icode.data.xml.XmlHandler.classFromString(XmlHandler.java:87)
	at fr.cnes.icode.data.xml.XmlHandler.unmarshal(XmlHandler.java:53)
	at fr.cnes.icode.data.CheckersDefinition.addFromResources(CheckersDefinition.java:108)
	at fr.cnes.icode.fortran77.rules.Fortran77RulesDefinition.define(Fortran77RulesDefinition.java:27)
	at fr.cnes.icode.data.CheckersDefinition.list(CheckersDefinition.java:45)
	at fr.cnes.icode.services.checkers.CheckerService.getCheckers(CheckerService.java:60)
	at fr.cnes.icode.services.checkers.CheckerService.getCheckers(CheckerService.java:166)
	at fr.cnes.icode.Analyzer.stableCheck(Analyzer.java:91)
	at fr.cnes.sonar.plugins.icode.check.ICodeSensor.executeEmbeddedICode(ICodeSensor.java:187)
	at fr.cnes.sonar.plugins.icode.check.ICodeSensor.execute(ICodeSensor.java:109)
	at org.sonar.scanner.sensor.AbstractSensorWrapper.analyse(AbstractSensorWrapper.java:48)

It looks like further increasing -Xmx helps but I can't allocate the entire VM RAM to Java, or other things will start slowing down or failing.

Since we had no clue what was going on with Fortran, we tried disabling icode shell script analysis too (with sonar.icode.shell.file.suffixes=.noshell) and this helps too. But this seems totally unrelated, I shouldn't need to disable shell checks to avoid Fortran issues :/

Is it expected to see those F90/F77 calls in the calltrace even when there is no Fortran code to analyze? Is this some static initialization that occurs before sonar-scanner finds out there's no Fortran code to analyze?
Are these allocations indeed big? It looks like there are XML files containing F77 and F90 rules, are those big, which could explain the issue?

Problem with icode.bat in windows

Describe what you need to know

i tried to use the icode.bat included in the .zip of the i-code cnes 4.1.0 and it give me this error, from Jenkins....

ERROR: Cannot run program "K:/Repositories/_icode/icode.bat": CreateProcess error=206, El nombre del archivo o la extensión es demasiado largo

Screenshots & log

@Rem i-Code CNES Startup Script for Windows
@Rem
@Rem Required ENV vars:
@Rem JAVA_HOME - location of a JDK home dir

@echo off

set ERROR_CODE=0

@Rem set local scope for the variables with windows NT shell
@SETLOCAL

set "scriptdir=%dp0"
if #%scriptdir:
-1%# == ## set scriptdir=%scriptdir:~0,-1%
set "ICODE_HOME=%scriptdir%"

@Rem ==== START VALIDATION ====
@Rem *** JAVA EXEC VALIDATION ***

if not "%JAVA_HOME%" == "" goto foundJavaHome

for %%i in (java.exe) do set JAVA_EXEC=%%~$PATH:i

if not "%JAVA_EXEC%" == "" (
set JAVA_EXEC="%JAVA_EXEC%"
goto OkJava
)

if not "%JAVA_EXEC%" == "" goto OkJava

echo.
echo ERROR: JAVA_HOME not found in your environment, and no Java
echo executable present in the PATH.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation, or add "java.exe" to the PATH
echo.
goto error

:foundJavaHome
if EXIST "%JAVA_HOME%\bin\java.exe" goto foundJavaExeFromJavaHome

echo.
echo ERROR: JAVA_HOME exists but does not point to a valid Java home
echo folder. No "\bin\java.exe" file can be found there.
echo.
goto error

:foundJavaExeFromJavaHome
set JAVA_EXEC="%JAVA_HOME%\bin\java.exe"

:OkJava
goto run

@Rem ==== START RUN ====
:run

set PROJECT_HOME=%CD%

@Rem remove trailing backslash, see https://groups.google.com/d/msg/sonarqube/wi7u-CyV_tc/3u9UKRmABQAJ
IF %PROJECT_HOME:~-1% == \ SET PROJECT_HOME=%PROJECT_HOME:~0,-1%

%JAVA_EXEC% -Djava.awt.headless=true -XX:-UseGCOverheadLimit -Xms1024M -Xmx1024M -cp %ICODE_HOME%*;%ICODE_HOME%\plugins* fr.cnes.icode.application.ICodeApplication %*
if ERRORLEVEL 1 goto error
goto end

:error
set ERROR_CODE=1

@Rem ==== END EXECUTION ====

:end
@Rem set local scope for the variables with windows NT shell
@endlocal & set ERROR_CODE=%ERROR_CODE%

@Rem see http://code-bear.com/bearlog/2007/06/01/getting-the-exit-code-from-a-batch-file-that-is-run-from-a-python-program/
goto exit

:returncode
exit /B %1

:exit
call :returncode %ERROR_CODE%

User environment

Please complete the following information.

  • OS: Windows 10]
  • Java version: [11]
  • i-Code version: [4.1.0]
  • Plugin version: [e.g. 2.0.2]

Additional context

Add any other context about the problem here.

Nesting metric should be in 'Size' category

Expected behavior

Nesting metric should not be in a new metrics category but in an existing one: in 'Size' for example.

Actual behavior

Nesting metric is in i-Code category.

Steps to reproduce behavior

See Measures view.

Detection version

1.0.1

Large projects crash analysis

Before posting a new question, please read the documentation](https://github.com/lequal/i-CodeCNES/wiki) and check existing issues

Describe what you need to know

When I try to analyze a large project over 1 million lines in SonarQube 7.9 I get a 504 Timeout after a short period of time. I am able to analyze smaller projects fine but the larger projects timeout. Is there some configuration I need to change for this to complete?

Screenshots & log

If applicable, add screenshots to help explain your problem. Then, append i-Code log and do not forget to obfuscate them.

User environment

Please complete the following information.

  • OS: Windows Server 2016
  • Java version: 1.8
  • i-Code version: [e.g. 3.1.0] 2.0.2
  • Plugin version: [e.g. 2.0.0] 3.2.2

Additional context

Add any other context about the problem here.

Delete useless language tags

Expected behavior

Language field should be sufficient to known to which language a rule is relative to.

Actual behavior

There are also tag 'f77', 'f90' ... in addition to language field.

Steps to reproduce behavior

See rules list.

Detection version

1.0.1

Errors appear in sonar-scanner log

Expected behavior

Sonar-scanner execution must be free of errors.

Actual behavior

Some errors appear during sonar-scanner analysis:

ERROR: Unexpected report analysis end element:analysisFile
ERROR: Unexpected report analysis end element:result
ERROR: Unexpected report analysis end element:result
ERROR: Unexpected report analysis end element:result
ERROR: Unexpected report analysis end element:result

Steps to reproduce behavior

  • Set following settings:
    • extension for result files: .res
    • source files' suffixes : *.f,*.f77,*.f90,*.sh,*.F,*.F77,*.F90
    • results folder : .
  • Create a quality profile containing all rules and set it as default
  • Execute sonar scanner in APSQ-005 : APSQ-005.zip

Detection version

  • Plugin version: V0
  • SonarQube version: 6.7.1

Unable to scan Shell scripts with current documentation

Expected behavior

Scanned result following readme instructions.

Actual behavior

README.md does not contains enough information to run an analysis.

INFO: Source paths: Desktop/templar_Code/Test/home/templar/legacy/test.ksh
INFO: Source encoding: windows-1252, default locale: en_US
INFO: Load server rules
INFO: Load server rules (done) | time=530ms
INFO: Index files
INFO: 1 file indexed
INFO: Quality profile for shell: Sonar way
INFO: Sensor fr.cnes.sonar.plugins.icode.check.ICodeSensor [icode]
**WARN: Results file result.res has not been found and wont be processed.**
INFO: Sensor fr.cnes.sonar.plugins.icode.check.ICodeSensor [icode] (done) | time
=0ms
INFO: Sensor SonarJavaXmlFileSensor [java]
INFO: Sensor SonarJavaXmlFileSensor [java] (done) | time=0ms
INFO: Sensor Zero Coverage Sensor
INFO: Sensor Zero Coverage Sensor (done) | time=0ms
INFO: No SCM system was detected. You can use the 'sonar.scm.provider' property
to explicitly specify it.
INFO: Calculating CPD for 0 files
INFO: CPD calculation finished
INFO: Analysis report generated in 125ms, dir size=35 KB

Steps to reproduce behavior

Detection version

1.1.0

Upgrade plugin with new Icode version

Is your feature request related to a problem? Please describe.**

We have a project with the "too many open file" error in our SonarQube instance.
This bus was resolved in this issue : cnescatlab/i-CodeCNES#221

With the last plugin version 3.0.0. The embedded Icode is 4.1.0 But we would want the 4.1.1 version.
Generate a new plugin version with 4.1.2 Icode version.
Update the README too because it's not updated

Installation problem with sonarqube 6.7

When trying to install the plugin with my installation of sonarqube 6.7.7 I get the following error

2020.04.02 15:38:38 ERROR web[][o.s.s.p.Platform] Background initialization failed. Stopping SonarQube
java.lang.IllegalStateException: Fail to load plugin Sonar i-Code CNES plugin [icode]
        at org.sonar.server.plugins.ServerExtensionInstaller.installExtensions(ServerExtensionInstaller.java:88)
        at org.sonar.server.platform.platformlevel.PlatformLevel4.start(PlatformLevel4.java:581)
        at org.sonar.server.platform.Platform.start(Platform.java:211)
        at org.sonar.server.platform.Platform.startLevel34Containers(Platform.java:185)
        at org.sonar.server.platform.Platform.access$500(Platform.java:46)
        at org.sonar.server.platform.Platform$1.lambda$doRun$0(Platform.java:119)
        at org.sonar.server.platform.Platform$AutoStarterRunnable.runIfNotAborted(Platform.java:371)
        at org.sonar.server.platform.Platform$1.doRun(Platform.java:119)
        at org.sonar.server.platform.Platform$AutoStarterRunnable.run(Platform.java:355)
        at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.lang.IllegalStateException: Unable to register extension fr.cnes.sonar.plugins.icode.languages.ICodeQualityProfiles from plugin 'icode'

I've try with the releases 1.1.0, 1.0.2, 1.0.0.

User environment:

  • OS: CentOS Linux release 7.7.1908
  • Java version: openjdk version "11.0.6" 2020-01-14 LTS
  • i-Code version:
  • Plugin version: 1.0.0, 1.0.2, 1.1.0
/opt/sonarqube/extensions/plugins# ll -tr
total 151648
-rw-r--r-- 1 sonarqube nobody   300101 Jul 20  2018 sonar-icode-cnes-plugin-1.0.0.jar

Plugin's CSS overrides SonarQube's CSS

Expected behavior

SonarQube web apllication's CSS must not be impacted by plugin's CSS.

Actual behavior

CSS of SonarQube's tables is overridden by plugin's CSS.

Steps to reproduce behavior

  • Set following settings:
    • extension for result files: .res
    • source files' suffixes : *.f,*.f77,*.f90,*.sh,*.F,*.F77,*.F90
    • results folder : .
  • Create a quality profile containing all rules and set it as default
  • Execute sonar scanner in APSQ-002: APSQ-002.zip
  • Go on Quality Profiles page

Detection version

  • Plugin version: V0
  • SonarQube version: 6.7.1

Plugin loads in Sonarqube version > 10 but reporting does not work

Hello! Although the latest version of the plugin is not certified for SonarQube version > 9, I thought I'd give it a try and report back.
Unlike previous experiences, no errors anywhere are generated by the presence of plugin and analysis of Fortran code is attempted.

I've tried two mode of analysis:

  1. running iCode to produce an XML results output to be ingested by sonar-scanner
  2. configuring sonar-scanner to auto launch icode

The logs of both cases are attached, for simplicity's sake, as well as the reports which are different (I would expect them to be the same)

  • OS: Red Hat 8.5.0-3
  • Java version: 1.17
  • i-Code version: 4.1.2
  • Plugin version: 3.1.1

Let me know if I can help with getting this to work. We use this to maintain quality on our ocean models.
Cheers!

scanner_plugin.txt
[scanner_icode.txt](https://github.com/cnescatlab/sonar-icode-cnes-plugin/files/12524444/scanner_icode.tx
report_icode_xml.txt
t)
report_pluigin_xml.txt

ICode Plugin Blocking the analysis of a maven project

Hi Team,

I have recently installed Icode-cnes-plugin on sonarqube-7.9 enerprise edition. This was installed as a part of requirement where one of the user wanted to analyse *.sh files for his project. As a part of testing post any plugin installation, i ran a maven analysis for a sample project. The analysis for this maven project failed with the below error:
"Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.7.0.1746:sonar (default-cli) on project maven--test1: The plugin [icode] does not support Java 1.8.0_242: fr/cnes/sonar/plugins/icode/ICodePlugin has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0 -> [Help 1]"

Why is icode-cnes plugin used for a maven project where we have java files?

I ran another analysis for a different project which uses flow plugin and it was successful without any errors.
Please look into and kindly advise accordingly.

Note: Java version on the Linux client machine is java-1.8 and java-11. Attached are the screenshots:
icode error
icode success

Plugin no longer works with Sonarqube > 9.0

According to SonarQube's Plugin Version Matrix version 2.0.2 should work with version 9.0. However I installed 9.1 today and the web interface fails. From web.log:

2021.08.30 17:04:03 ERROR web[][o.s.s.p.Platform] Background initialization failed. Stopping SonarQube
org.sonar.server.exceptions.BadRequestException: Rule was removed: f77-rules:F77.DATA.Array
	at org.sonar.server.exceptions.BadRequestException.create(BadRequestException.java:57)
	at org.sonar.server.exceptions.BadRequestException.create(BadRequestException.java:61)
	at org.sonar.server.exceptions.BadRequestException.checkRequest(BadRequestException.java:44)
	at org.sonar.server.qualityprofile.RuleActivator.doActivate(RuleActivator.java:82)
	at org.sonar.server.qualityprofile.RuleActivator.activate(RuleActivator.java:77)
	at org.sonar.server.qualityprofile.BuiltInQProfileUpdateImpl.update(BuiltInQProfileUpdateImpl.java:73)
	at org.sonar.server.qualityprofile.RegisterQualityProfiles.update(RegisterQualityProfiles.java:132)
	at org.sonar.server.qualityprofile.RegisterQualityProfiles.lambda$start$1(RegisterQualityProfiles.java:93)
	at com.google.common.collect.ImmutableList.forEach(ImmutableList.java:405)
	at org.sonar.server.qualityprofile.RegisterQualityProfiles.start(RegisterQualityProfiles.java:88)
	at org.sonar.core.platform.StartableCloseableSafeLifecyleStrategy.start(StartableCloseableSafeLifecyleStrategy.java:40)
	at org.picocontainer.injectors.AbstractInjectionFactory$LifecycleAdapter.start(AbstractInjectionFactory.java:84)
	at org.picocontainer.behaviors.AbstractBehavior.start(AbstractBehavior.java:169)
	at org.picocontainer.behaviors.Stored$RealComponentLifecycle.start(Stored.java:132)
	at org.picocontainer.behaviors.Stored.start(Stored.java:110)
	at org.picocontainer.DefaultPicoContainer.potentiallyStartAdapter(DefaultPicoContainer.java:1016)
	at org.picocontainer.DefaultPicoContainer.startAdapters(DefaultPicoContainer.java:1009)
	at org.picocontainer.DefaultPicoContainer.start(DefaultPicoContainer.java:767)
	at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:136)
	at org.sonar.server.platform.platformlevel.PlatformLevel.start(PlatformLevel.java:90)
	at org.sonar.server.platform.platformlevel.PlatformLevelStartup.access$001(PlatformLevelStartup.java:49)
	at org.sonar.server.platform.platformlevel.PlatformLevelStartup$1.doPrivileged(PlatformLevelStartup.java:87)
	at org.sonar.server.user.DoPrivileged.execute(DoPrivileged.java:45)
	at org.sonar.server.platform.platformlevel.PlatformLevelStartup.start(PlatformLevelStartup.java:84)
	at org.sonar.server.platform.PlatformImpl.executeStartupTasks(PlatformImpl.java:198)
	at org.sonar.server.platform.PlatformImpl$1.lambda$doRun$1(PlatformImpl.java:122)
	at org.sonar.server.platform.PlatformImpl$AutoStarterRunnable.runIfNotAborted(PlatformImpl.java:370)
	at org.sonar.server.platform.PlatformImpl$1.doRun(PlatformImpl.java:122)
	at org.sonar.server.platform.PlatformImpl$AutoStarterRunnable.run(PlatformImpl.java:354)
	at java.base/java.lang.Thread.run(Thread.java:829)
2021.08.30 17:04:03 INFO  web[][o.s.p.ProcessEntryPoint] Hard stopping process

After I removed the plugin the web interface came up. Any chance this can be quickly solved? Thanx

Sensor must analyze all the project tree.

Expected behavior

When analyzing a project, sensor must browse all files in sub-folders.

Actual behavior

Files in subfolders are ignored.

Steps to reproduce behavior

  • Set following settings:
    • extension for result files: .res
    • source files' suffixes : *.f,*.f77,*.f90,*.sh,*.F,*.F77,*.F90
    • results folder : .
  • Create a quality profile containing all rules and set it as default
  • Execute sonar scanner in APSQ-004: APSQ-004.zip

Detection version

  • Plugin version: V0
  • SonarQube version: 6.7.1

Source and result file names must be independant

Expected behavior

The i-Code result file must be named and placed independently from analyzed source files.

Actual behavior

Currently, the result file must be named like the analyzed source file (+ result file extension) and the result flder must be place at the same tree-level.

Steps to reproduce behavior

  • Set following settings:
    • extension for result files: .res
    • source files' suffixes : *.f,*.f77,*.f90,*.sh,*.F,*.F77,*.F90
    • results folder : .
  • Create a quality profile containing all rules and set it as default
  • Execute sonar scanner in APSQ-002: APSQ-002.zip

Detection version

  • Plugin version: V0
  • SonarQube version: 6.7.1

Analysis failed if an issue on a unknown rule is present in the result file

Expected behavior

Analysis should warn the user of the read of a unknown issue and continue import results.

Actual behavior

Analysis failed if an issue on a unknown rule is present in the result file.

Steps to reproduce behavior

Rule analysis on a file with exotic rule ids.

Detection version

1.0.2

Error icode.fortran90.rules.COMNAMEHomonymy.run

hi... thanks for the help

I have configured some analyzes and they are giving the errors, presented in the attached log, apparently due to a rule, which I have deactivated in the profile assigned to the project but it does still fail.

Screenshots & log

10:32:54.688 INFO: ------------------------------------------------------------------------
10:32:54 10:32:54.689 INFO: EXECUTION FAILURE
10:32:54 10:32:54.689 INFO: ------------------------------------------------------------------------
10:32:54 10:32:54.689 INFO: Total time: 16.560s
10:32:54 10:32:54.808 INFO: Final Memory: 425M/1773M
10:32:54 10:32:54.808 INFO: ------------------------------------------------------------------------
10:32:54 10:32:54.808 ERROR: Error during SonarScanner execution
10:32:54 java.lang.IndexOutOfBoundsException: Index: -1, Size: 1
10:32:54 at java.util.LinkedList.checkElementIndex(Unknown Source)
10:32:54 at java.util.LinkedList.get(Unknown Source)
10:32:54 at fr.cnes.icode.fortran90.rules.COMNAMEHomonymy.run(COMNAMEHomonymy.java:1477)
10:32:54 at fr.cnes.icode.Analyzer.stableCheck(Analyzer.java:224)
10:32:54 at fr.cnes.sonar.plugins.icode.check.ICodeSensor.executeEmbeddedICode(ICodeSensor.java:189)
10:32:54 at fr.cnes.sonar.plugins.icode.check.ICodeSensor.execute(ICodeSensor.java:110)
10:32:54 at org.sonar.scanner.sensor.SensorWrapper.analyse(SensorWrapper.java:53)
10:32:54 at org.sonar.scanner.phases.SensorsExecutor.executeSensor(SensorsExecutor.java:88)
10:32:54 at org.sonar.scanner.phases.SensorsExecutor.execute(SensorsExecutor.java:82)
10:32:54 at org.sonar.scanner.phases.SensorsExecutor.execute(SensorsExecutor.java:68)
10:32:54 at org.sonar.scanner.phases.AbstractPhaseExecutor.execute(AbstractPhaseExecutor.java:88)
10:32:54 at org.sonar.scanner.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:177)
10:32:54 at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:135)
10:32:54 at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:121)
10:32:54 at org.sonar.scanner.scan.ProjectScanContainer.scan(ProjectScanContainer.java:291)
10:32:54 at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:286)
10:32:54 at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:264)
10:32:54 at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:135)
10:32:54 at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:121)
10:32:54 at org.sonar.scanner.task.ScanTask.execute(ScanTask.java:48)
10:32:54 at org.sonar.scanner.task.TaskContainer.doAfterStart(TaskContainer.java:84)
10:32:54 at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:135)
10:32:54 at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:121)
10:32:54 at org.sonar.scanner.bootstrap.GlobalContainer.executeTask(GlobalContainer.java:121)
10:32:54 at org.sonar.batch.bootstrapper.Batch.doExecuteTask(Batch.java:116)
10:32:54 at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:71)
10:32:54 at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46)
10:32:54 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
10:32:54 at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
10:32:54 at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
10:32:54 at java.lang.reflect.Method.invoke(Unknown Source)
10:32:54 at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)
10:32:54 at com.sun.proxy.$Proxy0.execute(Unknown Source)
10:32:54 at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:189)
10:32:54 at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:138)
10:32:54 at org.sonarsource.scanner.cli.Main.execute(Main.java:112)
10:32:54 at org.sonarsource.scanner.cli.Main.execute(Main.java:75)
10:32:54 at org.sonarsource.scanner.cli.Main.main(Main.java:61)
10:32:55 WARN: Unable to locate 'report-task.txt' in the workspace. Did the SonarScanner succeed?
10:32:55 ERROR: SonarQube scanner exited with non-zero code: 1
10:32:58 Finished: FAILURE

User environment

Please complete the following information.

  • OS: SonarQube Linux (Centos)
  • Java version: [1.8.0_91]
  • Plugin version: [e.g. 2.0.1]
  • SonarQube: 6.7

Additional context

Add any other context about the problem here.

Code coverage must be > 80.0%

Expected behavior

Code coverage must be > 80.0%.

Actual behavior

Code coverage is about 40%.

Steps to reproduce behavior

See SonarCloud.

Detection version

1.1.0

Add CPD calculation

Expected behavior

If SonarQube API offers this feature, the plugin should be able to calculate duplications.

Actual behavior

Duplications are not calculated because i-Code does not calculate them.

Steps to reproduce behavior

Run an analysis.

Detection version

1.0.1

NaN values in i-Code results prevent SonarQube to import sonar-scanner report

Expected behavior

The plugin must be able to import result file containing NaN for some metrics which is a nominal value given by i-Code. For example: when a function has lless than 10 lines, value for comment ratio is NaN.

Actual behavior

The sonar-scanner's report can not be imported.

Steps to reproduce behavior

  • Set following settings:
    • extension for result files: .res
    • source files' suffixes : *.f,*.f77,*.f90,*.sh,*.F,*.F77,*.F90
    • results folder : .
  • Create a quality profile containing all rules and set it as default
  • Execute sonar scanner in APSQ-003: APSQ-003.zip

Detection version

  • Plugin version: V0
  • SonarQube version: 6.7.1

Metrics are not correctly displayed

Expected behavior

When analyzing multi-language project, metrics corresponding to a certain language must be displayed in its own widget.

Actual behavior

Metrics are missing in F77 and F90 widgets and are false in SH widget.

Steps to reproduce behavior

  • Set following settings:
    • extension for result files: .res
    • source files' suffixes : *.f,*.f77,*.f90,*.sh,*.F,*.F77,*.F90
    • results folder : .
  • Create a quality profile containing all rules and set it as default
  • Execute sonar scanner in APSQ-005 : APSQ-005.zip

Detection version

  • Plugin version: V0
  • SonarQube version: 6.7.1

Report files may be out of sources and tests files

Expected behavior

Result files can be every where in the project base directory.

Actual behavior

Result files has to be in indexed files to be found.

Steps to reproduce behavior

Launch sonar-scanner on a project where:

sonar.sources=src/
sonar.tests=test/
sonar.framac.reports.path=result.csv

Detection version

1.1.0

Analysis data are printed in web browser's console

Expected behavior

No analysis data must be logged in web browser.

Actual behavior

Currently, analysis data are logged in web browser's console.

Steps to reproduce behavior

  • Set following settings:
    • extension for result files: .res
    • source files' suffixes : *.f,*.f77,*.f90,*.sh,*.F,*.F77,*.F90
    • results folder : .
  • Create a quality profile containing all rules and set it as default
  • Execute sonar scanner in APSQ-005 : APSQ-005.zip
  • Go on i-Code view
  • Open the console

Detection version

  • Plugin version: V0
  • SonarQube version: 6.7.1

JAXB is still used in the plugin

Describe the bug
When using a Sonar Scanner CLI version 4 (using JRE 11), analysis fails because of JAXB library.

It works with a Sonar Scanner CLI which use a JRE < 1.9.

To reproduce

Expected behavior
The sonar-icode-cnes-plugin should work with sonar-scanner using JRE 9, 10 and 11.

Screenshots & log

SEVERE: [fr.cnes.icode] [ERROR]  Class: fr.cnes.icode.fortran77.metrics.Fortran77MetricsDefinition
Method: addFromResources

javax.xml.bind.JAXBException: Implementation of JAXB-API has not been found on module path or classpath.
 - with linked exception:
[java.lang.ClassNotFoundException: com.sun.xml.internal.bind.v2.ContextFactory]
        at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:278)
        at javax.xml.bind.ContextFinder.find(ContextFinder.java:421)
        at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:721)
        at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:662)
        at fr.cnes.icode.data.XmlHandler.unmarshal(XmlHandler.java:53)
        at fr.cnes.icode.data.CheckersDefinition.addFromResources(CheckersDefinition.java:108)
        at fr.cnes.icode.fortran77.metrics.Fortran77MetricsDefinition.define(Fortran77MetricsDefinition.java:27)
        at fr.cnes.icode.data.CheckersDefinition.list(CheckersDefinition.java:45)
        at fr.cnes.icode.services.checkers.CheckerService.getCheckers(CheckerService.java:60)
        at fr.cnes.icode.services.checkers.CheckerService.getCheckers(CheckerService.java:166)
        at fr.cnes.icode.Analyzer.stableCheck(Analyzer.java:207)
        at fr.cnes.sonar.plugins.icode.check.ICodeSensor.executeEmbeddedICode(ICodeSensor.java:189)
        at fr.cnes.sonar.plugins.icode.check.ICodeSensor.execute(ICodeSensor.java:110)
        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)
        at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:122)
        at org.sonar.scanner.scan.ProjectScanContainer.scan(ProjectScanContainer.java:386)
        at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:382)
        at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:351)
        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:72)
        at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:66)
        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(Unknown Source)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.base/java.lang.reflect.Method.invoke(Unknown Source)
        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:189)
        at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:138)
        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)
Caused by: java.lang.ClassNotFoundException: com.sun.xml.internal.bind.v2.ContextFactory
        at java.base/java.net.URLClassLoader.findClass(Unknown Source)
        at org.sonarsource.scanner.api.internal.IsolatedClassloader.loadClass(IsolatedClassloader.java:82)
        at java.base/java.lang.ClassLoader.loadClass(Unknown Source)
        at javax.xml.bind.ServiceLoaderUtil.nullSafeLoadClass(ServiceLoaderUtil.java:122)
        at javax.xml.bind.ServiceLoaderUtil.safeLoadClass(ServiceLoaderUtil.java:155)
        at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:276)
        ... 42 more

User environment (please complete the following information):

  • OS: Debian
  • Java version: 11
  • i-Code version: 4.0.0
  • Plugin version: 2.0.1

i-Code plugin must be able to import standard i-Code result file

Expected behavior

This plugin must be abble to import any file which is compliant to the official i-Code result XSD (analysisResultXsd.zip). For example: it must be able to import a file containing issues for multiple source files.

Actual behavior

This plugin is not able to load all compliant result files: it can only load issues of a result file for only one source file.

Steps to reproduce behavior

  • Set following settings:
    • extension for result files: .res
    • source files' suffixes : *.f,*.f77,*.f90,*.sh,*.F,*.F77,*.F90
    • results folder : .
  • Create a quality profile containing all rules and set it as default
  • Execute sonar scanner in APSQ-001: APSQ-001.zip

Detection version

  • Plugin version: V0
  • SonarQube version: 6.7.1

Plugin should implement Shell, Fortran 77 & 90 languages

Expected behavior

With the plugin we should be able to differenciate all the three languages.

Actual behavior

Therre is only one language called i-Code.

Steps to reproduce behavior

Install the plugin and go and see languages in quality profiles' page.

Detection version

1.0.0-alpha

COMFLOWRecursion.checkCircularCalling crash the execution

Hello,
I hope you can help me

Describe the bug

When I run a scan (sonar-scanner command or in a docker container sonarsource/sonar-scanner-cli or lequal/sonar-scanner) on a project containing some shell files, the scan execution crashes with the following error:

...
INFO: Sensor Sonar i-Code [icode]
INFO: Reflections took 182 ms to scan 12 urls, producing 26 keys and 242 values
INFO: Reflections took 139 ms to scan 12 urls, producing 26 keys and 242 values
INFO: Reflections took 114 ms to scan 12 urls, producing 26 keys and 242 values
INFO: Reflections took 103 ms to scan 12 urls, producing 26 keys and 242 values
INFO: Reflections took 94 ms to scan 12 urls, producing 26 keys and 242 values
INFO: Reflections took 100 ms to scan 12 urls, producing 26 keys and 242 values
INFO: Reflections took 95 ms to scan 12 urls, producing 26 keys and 242 values
INFO: Reflections took 94 ms to scan 12 urls, producing 26 keys and 242 values
INFO: Reflections took 92 ms to scan 12 urls, producing 26 keys and 242 values
INFO: Reflections took 108 ms to scan 12 urls, producing 26 keys and 242 values
INFO: Reflections took 97 ms to scan 12 urls, producing 26 keys and 242 values
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
INFO: Total time: 8.222s
INFO: Final Memory: 562M/940M
INFO: ------------------------------------------------------------------------
ERROR: Error during SonarScanner execution
java.lang.StackOverflowError
        at fr.cnes.icode.shell.rules.COMFLOWRecursion.checkCircularCalling(COMFLOWRecursion.java:424)
        at fr.cnes.icode.shell.rules.COMFLOWRecursion.checkCircularCalling(COMFLOWRecursion.java:433)
        at fr.cnes.icode.shell.rules.COMFLOWRecursion.checkCircularCalling(COMFLOWRecursion.java:433)
        at fr.cnes.icode.shell.rules.COMFLOWRecursion.checkCircularCalling(COMFLOWRecursion.java:433)
        at fr.cnes.icode.shell.rules.COMFLOWRecursion.checkCircularCalling(COMFLOWRecursion.java:433)
        at fr.cnes.icode.shell.rules.COMFLOWRecursion.checkCircularCalling(COMFLOWRecursion.java:433)
        at fr.cnes.icode.shell.rules.COMFLOWRecursion.checkCircularCalling(COMFLOWRecursion.java:433)
        at fr.cnes.icode.shell.rules.COMFLOWRecursion.checkCircularCalling(COMFLOWRecursion.java:433)
        at fr.cnes.icode.shell.rules.COMFLOWRecursion.checkCircularCalling(COMFLOWRecursion.java:433)
...

I have this problem on 2 different projects, but it does not appear on all projects containing shell code.

This problem is not solved by disabling the COM.FLOW.Recursion rule in the associated quality profile

This problem does not occur anymore if I deactivate the i-Code CNES plugin.

To reproduce

The problem is difficult to reproduce because it appears only on certain projects, projects for which the sources cannot be shared.

Screenshots & log

Here is the stacktrace using the debug mode of sonar-scanner (argument -X):

...
13:05:07.129 INFO: Reflections took 95 ms to scan 12 urls, producing 26 keys and 242 values
13:05:07.130 DEBUG: expanded subtype org.sonar.api.scanner.sensor.ProjectSensor -> org.sonar.api.batch.sensor.Sensor
13:05:07.130 DEBUG: expanded subtype java.lang.Throwable -> java.lang.Exception
13:05:07.130 DEBUG: expanded subtype java.io.Serializable -> java.lang.Throwable
13:05:07.130 DEBUG: expanded subtype com.thoughtworks.xstream.mapper.Mapper -> com.thoughtworks.xstream.mapper.MapperWrapper
13:05:07.130 DEBUG: expanded subtype com.thoughtworks.xstream.converters.Converter -> com.thoughtworks.xstream.converters.extended.ToAttributedValueConverter
13:05:07.130 DEBUG: expanded subtype com.thoughtworks.xstream.converters.ConverterMatcher -> com.thoughtworks.xstream.converters.Converter
13:05:07.130 DEBUG: expanded subtype org.sonar.api.resources.Language -> org.sonar.api.resources.AbstractLanguage
13:05:07.131 DEBUG: going to scan these urls:
jar:file:/home/***/.sonar/cache/89b582ef2b351828038c71cf4f0b877f/sonar-icode-plugin.jar_unzip/META-INF/lib/icode-library-v4.1.0.jar!/
jar:file:/home/***/.sonar/cache/89b582ef2b351828038c71cf4f0b877f/sonar-icode-plugin.jar_unzip/META-INF/lib/shell-language-v4.1.0.jar!/
jar:file:/home/***/.sonar/cache/89b582ef2b351828038c71cf4f0b877f/sonar-icode-plugin.jar_unzip/META-INF/lib/fortran90-language-v4.1.0.jar!/
jar:file:/home/***/.sonar/cache/89b582ef2b351828038c71cf4f0b877f/sonar-icode-plugin.jar_unzip/META-INF/lib/fortran90-metrics-v4.1.0.jar!/
jar:file:/home/***/.sonar/cache/89b582ef2b351828038c71cf4f0b877f/sonar-icode-plugin.jar_unzip/META-INF/lib/shell-rules-v4.1.0.jar!/
jar:file:/home/***/.sonar/cache/89b582ef2b351828038c71cf4f0b877f/sonar-icode-plugin.jar_unzip/META-INF/lib/fortran77-rules-v4.1.0.jar!/
jar:file:/home/***/.sonar/cache/89b582ef2b351828038c71cf4f0b877f/sonar-icode-plugin.jar_unzip/META-INF/lib/icode-core-v4.1.0.jar!/
jar:file:/home/***/.sonar/cache/89b582ef2b351828038c71cf4f0b877f/sonar-icode-plugin.jar_unzip/META-INF/lib/fortran77-language-v4.1.0.jar!/
jar:file:/home/***/.sonar/cache/89b582ef2b351828038c71cf4f0b877f/sonar-icode-plugin.jar_unzip/META-INF/lib/fortran90-rules-v4.1.0.jar!/
jar:file:/home/***/.sonar/cache/89b582ef2b351828038c71cf4f0b877f/sonar-icode-plugin.jar!/
jar:file:/home/***/.sonar/cache/89b582ef2b351828038c71cf4f0b877f/sonar-icode-plugin.jar_unzip/META-INF/lib/shell-metrics-v4.1.0.jar!/
jar:file:/home/***/.sonar/cache/89b582ef2b351828038c71cf4f0b877f/sonar-icode-plugin.jar_unzip/META-INF/lib/fortran77-metrics-v4.1.0.jar!/
13:05:07.243 INFO: Reflections took 112 ms to scan 12 urls, producing 26 keys and 242 values
13:05:07.244 DEBUG: expanded subtype org.sonar.api.scanner.sensor.ProjectSensor -> org.sonar.api.batch.sensor.Sensor
13:05:07.244 DEBUG: expanded subtype java.lang.Throwable -> java.lang.Exception
13:05:07.244 DEBUG: expanded subtype java.io.Serializable -> java.lang.Throwable
13:05:07.244 DEBUG: expanded subtype com.thoughtworks.xstream.mapper.Mapper -> com.thoughtworks.xstream.mapper.MapperWrapper
13:05:07.244 DEBUG: expanded subtype com.thoughtworks.xstream.converters.Converter -> com.thoughtworks.xstream.converters.extended.ToAttributedValueConverter
13:05:07.244 DEBUG: expanded subtype com.thoughtworks.xstream.converters.ConverterMatcher -> com.thoughtworks.xstream.converters.Converter
13:05:07.244 DEBUG: expanded subtype org.sonar.api.resources.Language -> org.sonar.api.resources.AbstractLanguage
13:05:09.425 INFO: ------------------------------------------------------------------------
13:05:09.425 INFO: EXECUTION FAILURE
13:05:09.425 INFO: ------------------------------------------------------------------------
13:05:09.425 INFO: Total time: 7.371s
13:05:09.483 INFO: Final Memory: 562M/939M
13:05:09.483 INFO: ------------------------------------------------------------------------
13:05:09.483 ERROR: Error during SonarScanner execution
java.lang.StackOverflowError
        at java.base/java.util.ArrayList.indexOfRange(Unknown Source)
        at java.base/java.util.ArrayList.indexOf(Unknown Source)
        at java.base/java.util.ArrayList.contains(Unknown Source)
        at fr.cnes.icode.shell.rules.COMFLOWRecursion.checkCircularCalling(COMFLOWRecursion.java:426)
        at fr.cnes.icode.shell.rules.COMFLOWRecursion.checkCircularCalling(COMFLOWRecursion.java:433)
        at fr.cnes.icode.shell.rules.COMFLOWRecursion.checkCircularCalling(COMFLOWRecursion.java:433)
        at fr.cnes.icode.shell.rules.COMFLOWRecursion.checkCircularCalling(COMFLOWRecursion.java:433)
        at fr.cnes.icode.shell.rules.COMFLOWRecursion.checkCircularCalling(COMFLOWRecursion.java:433)
        at fr.cnes.icode.shell.rules.COMFLOWRecursion.checkCircularCalling(COMFLOWRecursion.java:433)
        at fr.cnes.icode.shell.rules.COMFLOWRecursion.checkCircularCalling(COMFLOWRecursion.java:433)
        at fr.cnes.icode.shell.rules.COMFLOWRecursion.checkCircularCalling(COMFLOWRecursion.java:433)
        at fr.cnes.icode.shell.rules.COMFLOWRecursion.checkCircularCalling(COMFLOWRecursion.java:433)
        at fr.cnes.icode.shell.rules.COMFLOWRecursion.checkCircularCalling(COMFLOWRecursion.java:433)
        at fr.cnes.icode.shell.rules.COMFLOWRecursion.checkCircularCalling(COMFLOWRecursion.java:433)
...

User environment

  • OS: CentOS Linux 7
  • Java version: 1.8.0_342
  • i-Code version: 2.2.0

Run scan directly with the sonar-scanner command or in a docker container sonarsource/sonar-scanner-cli or lequal/sonar-scanner

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.