greenelab/adage-server

View on GitHub

Showing 230 of 230 total issues

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

angular.module('adage.participation.resources', [
  'ngResource',
  'adage.utils'
])

Severity: Major
Found in interface/src/app/participation/resources.js and 1 other location - About 1 hr to fix
interface/src/app/signature/resources.js on lines 3..20

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

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

angular.module('adage.signature.resources', [
  'ngResource',
  'adage.utils'
])

Severity: Major
Found in interface/src/app/signature/resources.js and 1 other location - About 1 hr to fix
interface/src/app/participation/resources.js on lines 1..18

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

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

Function AnalysisCtrl has 45 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function AnalysisCtrl($scope, $log, $q, $state, $stateParams,
  SampleBin, Sample) {
  $scope.isValidModel = false;
  // Do nothing if mlmodel in URL is falsey. The error will be taken
  // care of by "<ml-model-validator>" component.
Severity: Minor
Found in interface/src/app/analyze/analysis/analysis.js - About 1 hr to fix

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

          function($scope, $state, Gene, SelectedGenesFactory, CommonGeneFuncts) {
            var numResultsToReturn = 10;
            $scope.errors = null;
            $scope.autocompleteQuery = '';
            $scope.selectedGenes = SelectedGenesFactory.returnGenes();
    Severity: Minor
    Found in interface/src/app/gene/searchFew/searchFew.js - About 1 hr to fix

      Function link has 43 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: Minor
      Found in interface/src/app/signature/signature.js - About 1 hr to fix

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

            var calculateEnrichments = function(typeName, genesBySignatures) {
              var m = genesInUrl.length,
                N = self.geneNum,
                pValueArray = [],
                matchedGenesBySignature = [],
        Severity: Minor
        Found in interface/src/app/gene/enriched_signatures.js - About 1 hr to fix

          Function controller has 41 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              function($log, Genesets, Gene, errGen) {
                var self = this;
          
                self.search = {};
          
          
          Severity: Minor
          Found in interface/src/app/tribe_client/genesets.js - About 1 hr to fix

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

                findEnrichedSignatures: function(scope, state) {
                  var geneIds = Object.keys(scope.selectedGenes);
                  var geneString = geneIds.join();
            
                  state.go('enriched_signatures', {
            Severity: Major
            Found in interface/src/app/gene/utils.js and 1 other location - About 1 hr to fix
            interface/src/app/gene/utils.js on lines 17..25

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

            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

            Function SearchCtrl has 40 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              function SearchCtrl($scope, $log, $location, Search) {
                $scope.results = [];
                $scope.search = {
                  query: {
                    text: '',
            Severity: Minor
            Found in interface/src/app/analyze/search/search.js - About 1 hr to fix

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

                  sendToNetwork: function(scope, state) {
                    var geneIds = Object.keys(scope.selectedGenes);
                    var geneString = geneIds.join();
              
                    state.go('gene_network', {
              Severity: Major
              Found in interface/src/app/gene/utils.js and 1 other location - About 1 hr to fix
              interface/src/app/gene/utils.js on lines 27..35

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

              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

              Function get_annotations has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
              Open

                  def get_annotations(request=None, **kwargs):
                      """
                      Return a tab-delimited file containing all samples for every Experiment
                      with Sample properties for each and all annotations (by default) or, if
                      `annotation_types` is specified, return only those annotation types for
              Severity: Minor
              Found in adage/analyze/api.py - About 1 hr 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 handleExperimentResponse has 39 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      var handleExperimentResponse = function(response) {
                        // enhanceExpData: a function that enhances the given experiment.
                        // The enhancements include:
                        // (1) Convert entries in sample_set from sample URI to sample ID,
                        //     and delete samples that are not related to current signature;
              Severity: Minor
              Found in interface/src/app/signature/signature.js - About 1 hr to fix

                Function mapSignaturesToSignatureInfo has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                      var mapSignaturesToSignatureInfo = function() {
                        // (2a) next, we build an array (replacing `volcanoData.source`)
                        //      comprised of `signatureObject`s by walking through the
                        //      `firstSampleSignatures` and constructing a `signatureObject` for
                        //      each. [outer .map()]
                Severity: Minor
                Found in interface/src/app/analyze/analysis/sampleBin.js - About 1 hr to fix

                  Function controller has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                        function($scope, SelectedGenesFactory) {
                          $scope.currentPage = 1;
                          $scope.itemsPerPage = 10;
                          $scope.totalResults = 0;
                          $scope.maxSize = 10;
                  Severity: Minor
                  Found in interface/src/app/gene/searchMany/searchMany.js - About 1 hr to fix

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

                      this.setSpec = function(activities) {
                        var activityArr = [];
                        var samples = Object.keys(activities);
                        samples.forEach(function(sampleID, index) {
                          activityArr.push({
                    Severity: Minor
                    Found in interface/src/app/signature/signature.js - About 1 hr to fix

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

                        function VolcanoPlotViewCtrl(SampleBin, $stateParams) {
                          var ctrl = this;
                          ctrl.isValidModel = false;
                          // Do nothing if mlmodel in URL is falsey. The error will be taken
                          // care of by "<ml-model-validator>" component.
                      Severity: Minor
                      Found in interface/src/app/volcano-plot/view.js - About 1 hr to fix

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

                              self.searchGenesets = function() {
                                self.searchStatus = 'Searching for gene sets...';
                                var qparams = {
                                  'query': self.search.query,
                                  'organism__scientific_name': self.organism,
                        Severity: Minor
                        Found in interface/src/app/tribe_client/genesets.js - About 1 hr 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 controller has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                  function($scope, SelectedGenesFactory, CommonGeneFuncts) {
                                    $scope.buttonPage = 1;
                                    $scope.queryResults = $scope.searchResults[$scope.query];
                            
                                    var selectedGenes = SelectedGenesFactory.returnGenes();
                            Severity: Minor
                            Found in interface/src/app/gene/searchMany/searchMany.js - About 1 hr to fix

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

                                    ctrl.show = function(id) {
                                      if (!id) {
                                        $log.warn(
                                          'adage.experimentDetail.component: show() called with id',
                                          id
                              Severity: Minor
                              Found in interface/src/app/experiment/experimentDetail.component.js - About 1 hr to fix
                                Severity
                                Category
                                Status
                                Source
                                Language