SiLeBAT/FSK-Lab

View on GitHub
de.bund.bfr.knime.pmm.nodes/js-src/de/bund/bfr/knime/pmm/js/modelplotter/pmm-plotter.js

Summary

Maintainability
F
2 wks
Test Coverage

File pmm-plotter.js has 1354 lines of code (exceeds 250 allowed). Consider refactoring.
Open

pmm_plotter = function() {
    
    /**
     * @author Markus Freitag, EITCO GmbH, MFreitag@eitco.de, 2015
     * 

Function addFunctionFromSelection has 438 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    function addFunctionFromSelection(selectedModel,onlySecondaryModel,mode,headless)
    {    
        var manaual = !isRealValue(selectedModel)&&!isRealValue(onlySecondaryModel)&&!isRealValue(mode)
        if(manaual){
            onlySecondaryModel = _onlySecondaryModel;

Function parseTretiaryModels has 150 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        function parseTretiaryModels(modelList){
            /*
             * we use the primary model data as a foundation for the tertiary model
             * this applies to the attributes that are equal in all secondary models/data rows
             */

Function addMetaData has 102 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    function addMetaData(modelObject) 
    {
        
        /*
         * Accordion needs a header followed by a div. We add a paragraph per parameter.

Function updateParameterSliders has 83 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    function updateParameterSliders()
    {
        var sliderWrapper = document.getElementById("sliderWrapper");
        var sliderIds = []; // ids of all sliders that correspond to a constant from the used models
        

Function parseSecondaryModels has 73 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        function parseSecondaryModels(currentModel,tertiaryModel,headless){
            var formulaPrim = currentModel.catalogModel.formula; // main formula is shared
            var paramsPrim = currentModel.paramList.params; // so are the primary parameters
            var indepsPrim = currentModel.indepList.indeps; // so are the indepdent parameters
            var depPrim = currentModel.dep; // so are the primary parameters

Function initLayout has 71 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    function initLayout()
    {
        /*
         * body
         */

Function resetBinaryFormulaBindings has 65 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    function resetBinaryFormulaBindings(model) {
        
        // not necessary for data points
        if(model.fnType == 'points')
            return;

Function drawD3Plot has 63 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    function drawD3Plot(headless) 
    {
        
        // the plot element has to be reset because otherwise functionPlot may draw artifacts
        if(!headless){

Function showInputForm has 54 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    function showInputForm()
    {
        var svgElement = document.getElementById("d3plotter").firstChild;
        var serializer = new XMLSerializer();
        

Consider simplifying this complex logical expression.
Open

                    if( ( 
                            (indep.min == undefined || indep.min == "" || indep.min == null) && 
                            (indep.max == undefined || indep.max == "" || indep.max == null) &&
                            (indep.value != undefined && indep.value !== "")
                        ) 

Consider simplifying this complex logical expression.
Open

                if( ( 
                        (indep.min == undefined || indep.min == "" || indep.min == null) && 
                        (indep.max == undefined || indep.max == "" || indep.max == null) &&
                        (indep.value != undefined && indep.value !== "")
                    ) 

Function addFunctionObject has 44 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    function addFunctionObject(dbuuid, functionAsString, functionConstants, model,headless)
    {
    
        var color = getNextColor(); // functionPlot provides 9 colors
        var maxRange = _plotterValue.maxXAxis * 1000; // obligatoric for the range feature 

Function init has 43 lines of code (exceeds 25 allowed). Consider refactoring.
Open

     modelPlotter.init = function(representation, value,headless) {
        
        // view-bug - require js prevents global variable behavior         
        if (!window.functionPlot) {
            if(!headless){

Function prepareParameters has 38 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        function prepareParameters(parameterArray, modelId) 
        {
            // this will be returned containing the preprocessed parameters
            var newParameterArray = {};
            for(index in parameterArray){

Function prepareFunction has 37 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        function prepareFunction(parameterArray, functionString, xUnit, yUnit,onlySecondaryModel) {
            
            var newString = functionString;
        
            // cut the left part of the formula

Function initJQuery has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    function initJQuery() 
    {
        $("#dataChoiceDiv").hide();
        $("#graphTypeDiv").hide();
        

Function deleteFunctionObject has 34 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    function deleteFunctionObject(internalId,dbuuid)
    {
        deleteMetaDataSection(internalId,dbuuid);
        removeModel(internalId,dbuuid);
        updateParameterSliders();

Function parseModel has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        function parseModel(modelList,onlySecondaryModel)
        {
            
            if(onlySecondaryModel){
                /*

Function getGlobalxUnit has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        function getGlobalxUnit(formulaPrim,paramsPrim,indepsPrim,depPrim,secondaryIndeps,secondaryIndepNames,tertiaryModel){
        
            if(!tertiaryModel.m2List){
                for(i in indepsPrim){
                

Function getGlobalxUnit has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

        function getGlobalxUnit(formulaPrim,paramsPrim,indepsPrim,depPrim,secondaryIndeps,secondaryIndepNames,tertiaryModel){

Avoid deeply nested control flow statements.
Open

                             if(indep["name"] == parameterPrim)
                             {
                                 indexToDelete = index;
                                 break;
                             }

Function prepareFunction has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

        function prepareFunction(parameterArray, functionString, xUnit, yUnit,onlySecondaryModel) {

Function addFunctionObject has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

    function addFunctionObject(dbuuid, functionAsString, functionConstants, model,headless)

Similar blocks of code found in 2 locations. Consider refactoring.
Open

            for(index in paramsPrim){
                indep = paramsPrim[index];
            
                // convention #1: do not exchange a secondary formula dependent
                // convention #2: if a parameter has no mininmum or maximum but a value, it shall not be dynamic
de.bund.bfr.knime.pmm.nodes/js-src/de/bund/bfr/knime/pmm/js/modelplotter/pmm-plotter.js on lines 715..740

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 223.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

                for(index in paramsPrim){
                    indep = paramsPrim[index];
                    // convention #1: do not exchange a secondary formula dependent
                    // convention #2: if a parameter has no mininmum or maximum but a value, it shall not be dynamic
                    // convention #3: a parameter with "isStart"-Flag shall have a fixed value
de.bund.bfr.knime.pmm.nodes/js-src/de/bund/bfr/knime/pmm/js/modelplotter/pmm-plotter.js on lines 850..877

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 223.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Identical blocks of code found in 2 locations. Consider refactoring.
Open

            for(index in secondaryIndeps){
                indep = secondaryIndeps[index];
            
                var oldName = indep.name;
                var newName = oldName;
de.bund.bfr.knime.pmm.nodes/js-src/de/bund/bfr/knime/pmm/js/modelplotter/pmm-plotter.js on lines 988..1016

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 181.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Identical blocks of code found in 2 locations. Consider refactoring.
Open

            for(index in secondaryIndeps){
                indep = secondaryIndeps[index];
                var oldName = indep.name;
                var newName = oldName;
                var category = indep.category
de.bund.bfr.knime.pmm.nodes/js-src/de/bund/bfr/knime/pmm/js/modelplotter/pmm-plotter.js on lines 768..796

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 181.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Identical blocks of code found in 2 locations. Consider refactoring.
Open

            if(timeSeries)
            {
                for(i2 in timeSeries){
                    dataPointItem = timeSeries[i2];
                    var point = [ 
de.bund.bfr.knime.pmm.nodes/js-src/de/bund/bfr/knime/pmm/js/modelplotter/pmm-plotter.js on lines 969..980

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 57.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Identical blocks of code found in 2 locations. Consider refactoring.
Open

            if(timeSeries)
            {
                for(i2 in timeSeries){
                    dataPointItem = timeSeries[i2];
                
de.bund.bfr.knime.pmm.nodes/js-src/de/bund/bfr/knime/pmm/js/modelplotter/pmm-plotter.js on lines 750..760

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 57.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

        $.each(_dbUnits, function (i, dbUnit) {
            if(unit == dbUnit.displayInGuiAs)
            {
                factor = dbUnit.conversionFunctionFactor;
                return true;
de.bund.bfr.knime.pmm.nodes/js-src/de/bund/bfr/knime/pmm/js/modelplotter/pmm-plotter.js on lines 1979..1985

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 48.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

        $.each(_dbUnits, function (i, dbUnit) {
            if(unit == dbUnit.displayInGuiAs)
            {
                factor = dbUnit.inverseConversionFunctionFactor;
                return true;
de.bund.bfr.knime.pmm.nodes/js-src/de/bund/bfr/knime/pmm/js/modelplotter/pmm-plotter.js on lines 1954..1960

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 48.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

There are no issues that match your filters.

Category
Status