GithubHelp home page GithubHelp logo

Comments (13)

begarco avatar begarco commented on May 10, 2024

Hi @difeijin,

Please rewrite your issue like in the template we provide.

It seems to be a specific C# plugin related issue(C# metric) , but we need more information about your use case to reproduce it and fix it.

Regards,
Benoît

from sonar-cnes-report.

begarco avatar begarco commented on May 10, 2024

Please use edit feature of GitHub issues instead of duplicating them.

from sonar-cnes-report.

begarco avatar begarco commented on May 10, 2024

@difeijin I gather all your information in that issue.

Could you provide us your list of installed plugins and their versions?

from sonar-cnes-report.

astrasia avatar astrasia commented on May 10, 2024

I have a similar issue. I don't think it is related to C# as I am using PHP (my guess). The errors line are exact.

I have very limited plug-ins installed, all are the default from SonarQube installation. CNES is the only plug-in I added.

2019-10-06_18-22-12

from sonar-cnes-report.

begarco avatar begarco commented on May 10, 2024

Hello @astrasia,

Could you send us the content of 404.php, or a piece of project with which we can reproduce thius error?

Thanks.

from sonar-cnes-report.

Sancretor avatar Sancretor commented on May 10, 2024

Hi @astrasia,

Just a quick reminder.
In order to investigate, we really need an example file that triggers this error.
Thanks !

from sonar-cnes-report.

difeijin avatar difeijin commented on May 10, 2024

from sonar-cnes-report.

difeijin avatar difeijin commented on May 10, 2024

from sonar-cnes-report.

Eduardx05 avatar Eduardx05 commented on May 10, 2024

I reproduce the error.

When we extract the component_tree measures in the Component provider. The getMinMetric and the getMaxMetric try to parse the file name of the component tree to double.

I saw that type of error on files that has numbers on the file name.

404.jsp
3A

1E

I change the next methods:

 private double getMinMetric(String metric){
        double min = Double.MAX_VALUE;
        for(Map c: componentsList){
            final String rawValue = (String)c.get(metric);
            if(rawValue!=null){
                try{
                    min = Math.min(min, Double.valueOf(rawValue));
                }catch(NumberFormatException e){
                    LOGGER.warning(metric +" : "+rawValue+" | Error Min" );
                    min = 0;
                }
                
            }
        }
        return min;
    }

    /**
     * Get max value for a specified metrics
     * */
    private double getMaxMetric(String metric){
        double max = -Double.MAX_VALUE;
        for(Map c: componentsList){
            final String rawValue = (String)c.get(metric);
            if(rawValue!=null){
                

                try{
                    max = Math.max(max, Double.valueOf(rawValue));
                }catch(NumberFormatException e){
                    LOGGER.warning(metric +" : "+rawValue+" | Error Max" );
                    max = 0;
                }
            }
        }
        return max;
    }


And then the reports generated.

from sonar-cnes-report.

difeijin avatar difeijin commented on May 10, 2024

from sonar-cnes-report.

Sancretor avatar Sancretor commented on May 10, 2024

Hi @Eduardx05 !

Thanks for your feedback and contribution, we truly appreciate it !
We're also glad you managed to reproduce this error... that was a tricky one.
I can't say when, but be sure I'll look into it as soon as possible.

from sonar-cnes-report.

jeritiana avatar jeritiana commented on May 10, 2024

I stumbled upon this issue too and I needed badly to generate a report lol

You have to be lucky to reproduce this on your side. It happens inside src/main/java/fr/cnes/sonar/report/providers/ComponentProvider.java, when the very first component value used inside isCountableMetric(String metric) is actually a valid number.

Here is a typical component and its attributes:

{Path=include/fieldbus/488, complexity=0, duplicated_lines_density=0.0, cognitive_complexity=0, ncloc=41, ID=AXTj4p-qHIPsNopKiPtX, comment_lines_density=42.3, Name=488}

488 in this particular case means IEEE-488 or GPIB field bus.

When calling isCountableMetric("Name"): the first non-null value is used to detect if the metric is countable, and NumberUtils.isCreatable("488") is indeed TRUE!

Then, the metric Name is also computed for all components in getMetricStats(), calling getMinMetric(String metric) and getMaxMetric(String metric), as reported by @Eduardx05, leading to the java.lang.NumberFormatException on all file names and directory names. The suggested fix pointed me to this analysis, but it is too late during the runtime.

Fix idea: exclude known attributes not to be in the computed metrics, such as Name or Path, not relying on their value. This will give a deterministic behavior, independently from the component order or name.

At least, that's what I found and it works on my setup.

Associated PR #179

from sonar-cnes-report.

Sancretor avatar Sancretor commented on May 10, 2024

Hi @jeritiana

Thanks a lot or your contribution !
That was a tricky one indeed.
We will have a look at your PR as soon as possible, as it would be great to merge it for the next 3.3.0 release.

from sonar-cnes-report.

Related Issues (20)

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.