greenelab/adage-server

View on GitHub
interface/src/app/gene/network/network.js

Summary

Maintainability
F
1 wk
Test Coverage

Function GeneNetworkController has a Cognitive Complexity of 103 (exceeds 5 allowed). Consider refactoring.
Open

    function GeneNetworkController(
      $stateParams, Edge, Signature, Gene, ExpressionValue, $log, errGen,
      $httpParamSerializerJQLike, $scope, MlModelTracker, $timeout
    ) {
      var self = this;
Severity: Minor
Found in interface/src/app/gene/network/network.js - About 2 days to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function GeneNetworkController has 414 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    function GeneNetworkController(
      $stateParams, Edge, Signature, Gene, ExpressionValue, $log, errGen,
      $httpParamSerializerJQLike, $scope, MlModelTracker, $timeout
    ) {
      var self = this;
Severity: Major
Found in interface/src/app/gene/network/network.js - About 2 days to fix

    File network.js has 477 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /**
     * "adage.gene.network" module.
     */
    
    angular.module('adage.gene.network', [
    Severity: Minor
    Found in interface/src/app/gene/network/network.js - About 7 hrs to fix

      Function drawNetwork has 103 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            function drawNetwork() {
              // Calculate svg size.
              var minSvgSize = 600;  // Minimum size of svg.
              var maxSvgSize = 1280; // Maximum size of svg.
              var svgSize = genes.length * 10;
      Severity: Major
      Found in interface/src/app/gene/network/network.js - About 4 hrs to fix

        Function success has 90 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                function success(responseObject) {
                  var edgeList = responseObject.objects;
                  // Collect a list of distinct genes for query.
                  var geneList = getQueriedGenes(edgeList);
                  // Now retrieve the Gene objects using the geneList.
        Severity: Major
        Found in interface/src/app/gene/network/network.js - About 3 hrs to fix

          Function success has 74 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                      function success(responseObject) {
                        setGenes(responseObject);
                        if (genes.length === 0) {
                          self.statusMessage =
                            'Gene(s) not found, please check the gene ID.';
          Severity: Major
          Found in interface/src/app/gene/network/network.js - About 2 hrs to fix

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

                    function showEdgeTip(data) {
                      geneTip.hide(); // Hide gene-tip window (if any) first.
                      var weightPrecision = 3;
                      var htmlText = 'Edge weight: ';
                      htmlText += data.weight.toFixed(weightPrecision);
            Severity: Minor
            Found in interface/src/app/gene/network/network.js - About 1 hr to fix

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

                              function success(responseObject) {
                                // Function that calculates input gene's expression value
                                // based on the input array of base and comparison sums.
                                var calcGeneExpr = function(geneID, exprTracker) {
                                  // Do nothing if the length of exprTracker is not 4, or one
              Severity: Minor
              Found in interface/src/app/gene/network/network.js - About 1 hr to fix

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

                        genesParam.split(',').forEach(function(token) {
                          var id = parseInt(token);
                          if (!isNaN(id) && arr.indexOf(id) === -1) {
                            arr.push(id);
                          }
                Severity: Major
                Found in interface/src/app/gene/network/network.js and 1 other location - About 1 hr to fix
                interface/src/app/gene/enriched_signatures.js on lines 55..60

                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 61.

                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

                        if (f.showingGenes === f.totalGenes) {
                          f.showingGenesText = 'all ';
                        } else {
                          f.showingGenesText = f.showingGenes + ' of ';
                        }
                Severity: Minor
                Found in interface/src/app/gene/network/network.js and 1 other location - About 40 mins to fix
                interface/src/app/gene/network/network.js on lines 185..189

                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 53.

                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

                        if (f.showingEdges === f.totalEdges) {
                          f.showingEdgesText = 'all ';
                        } else {
                          f.showingEdgesText = f.showingEdges + ' of ';
                        }
                Severity: Minor
                Found in interface/src/app/gene/network/network.js and 1 other location - About 40 mins to fix
                interface/src/app/gene/network/network.js on lines 191..195

                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 53.

                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