greenelab/adage-server

View on GitHub

Showing 82 of 230 total issues

Function exports has 471 lines of code (exceeds 25 allowed). Consider refactoring.
Open

module.exports = function ( grunt ) {

  /**
   * Load required Grunt tasks. These are installed based on the versions listed
   * in `package.json` when you do `npm install` in this directory.
Severity: Major
Found in interface/Gruntfile.js - About 2 days to fix

    File tests.py has 945 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    # coding: utf-8 (see https://www.python.org/dev/peps/pep-0263/)
    
    from __future__ import unicode_literals
    from __future__ import print_function
    import os
    Severity: Major
    Found in adage/analyze/tests.py - About 2 days to fix

      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

          File Gruntfile.js has 473 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          module.exports = function ( grunt ) {
          
            /**
             * Load required Grunt tasks. These are installed based on the versions listed
             * in `package.json` when you do `npm install` in this directory.
          Severity: Minor
          Found in interface/Gruntfile.js - About 7 hrs to fix

            Function bootstrap_database has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring.
            Open

            def bootstrap_database(annotation_fh, dir_name=None):
                """
                Import initial experiment, sample and annotation data to initialize the
                ADAGE database. Assumes we are starting with an empty database, so this
                will fail if any existing data are found that conflict with what is being
            Severity: Minor
            Found in adage/analyze/management/commands/import_data.py - About 6 hrs 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

            APIResourceTestCase has 45 functions (exceeds 20 allowed). Consider refactoring.
            Open

            class APIResourceTestCase(ResourceTestCaseMixin, TestCase):
                # API tests:
                # For most of our interfaces, we should be able to GET, but every other
                # REST API should fail: POST, PUT, PATCH, DELETE. There are a few
                # exceptions for which we allow POST but the behavior is the same as GET.
            Severity: Minor
            Found in adage/analyze/tests.py - About 6 hrs to fix

              Function EnrichedSignatureController has 149 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                function EnrichedSignatureController($stateParams, Signature, Participation,
                  Gene, MlModelTracker, MathFuncts, pValueCutoff, pValueDigits, $scope, $q,
                  $log, errGen) {
                  var self = this;
                  self.isValidModel = false;
              Severity: Major
              Found in interface/src/app/gene/enriched_signatures.js - About 5 hrs to fix

                File api.py has 414 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                from django.conf.urls import url
                from django.core.exceptions import ObjectDoesNotExist
                from django.db.models import Q
                from django.http import HttpResponse
                from organisms.api import OrganismResource
                Severity: Minor
                Found in adage/analyze/api.py - About 5 hrs to fix

                  File signature.js has 375 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

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

                    Function check_and_import has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
                    Open

                    def check_and_import(file_handle, ml_model):
                        """Read valid data lines into the database.  An exception will be raised
                        if any errors are detected in file_handle.
                        """
                        # If the database already includes record(s) of the same ml_model,
                    Severity: Minor
                    Found in adage/analyze/management/commands/import_gene_network.py - About 4 hrs 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 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 link has 90 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                            link: function($scope) {
                              $scope.queryStatus = 'Connecting to the server ...';
                              $scope.activities = {};
                              $scope.experiments = [];
                              $scope.topMode = true;
                      Severity: Major
                      Found in interface/src/app/signature/signature.js - About 3 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 link has 88 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                                link: function($scope) {
                                  $scope.queryStatus = 'Connecting to the server ...';
                          
                                  $scope.topMode = true;
                                  $scope.topNum = 3;
                          Severity: Major
                          Found in interface/src/app/signature/signature.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 getVolcanoPlotData has 68 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  getVolcanoPlotData: function() {
                                    // use sample lists for base-group and comp-group to produce output for
                                    // the volcano plot of the form:
                                    //   signature - diff - logsig,
                                    // where:
                              Severity: Major
                              Found in interface/src/app/analyze/analysis/sampleBin.js - About 2 hrs to fix

                                Function check_and_import has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                                Open

                                def check_and_import(file_handle, ml_model, participation_type):
                                    """Read valid data lines into the database.  An exception will be
                                    raised if any errors are detected in file_handle.
                                    """
                                    signatures_in_file = set()
                                Severity: Minor
                                Found in adage/analyze/management/commands/import_signature_gene_network.py - About 2 hrs 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 rebuildHeatmapActivity has 64 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                      rebuildHeatmapActivity: function() {
                                        if (!this.mlmodel.id) {
                                          // ignore "rebuild" requests until a model is specified
                                          $log.info(
                                            'rebuildHeatmapActivity: skipping because mlmodel=', this.mlmodel
                                Severity: Major
                                Found in interface/src/app/heatmap.service.js - About 2 hrs to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language