ncbo/bioportal_web_ui

View on GitHub
public/browse/app.js

Summary

Maintainability
F
6 days
Test Coverage

Function app has a Cognitive Complexity of 74 (exceeds 5 allowed). Consider refactoring.
Open

.controller('OntologyList', ['$scope', '$animate', '$timeout', function($scope, $animate, $timeout) {
  // Default values
  $scope.visible_ont_count = 0;
  $scope.ontology_sort_order = "-popularity";
  $scope.previous_sort_order = "-popularity";
Severity: Minor
Found in public/browse/app.js - About 1 day 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 app has 251 lines of code (exceeds 25 allowed). Consider refactoring.
Open

.controller('OntologyList', ['$scope', '$animate', '$timeout', function($scope, $animate, $timeout) {
  // Default values
  $scope.visible_ont_count = 0;
  $scope.ontology_sort_order = "-popularity";
  $scope.previous_sort_order = "-popularity";
Severity: Major
Found in public/browse/app.js - About 1 day to fix

    File app.js has 317 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    'use strict';
    
    // Declare app level module which depends on views, and components
    angular.module('FacetedBrowsing', [
      'ngRoute',
    Severity: Minor
    Found in public/browse/app.js - About 3 hrs to fix

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

        var filterOntologies = function() {
          var key, i, ontology, facet, facet_count, show, other_facets, count = 0;
          $scope.show_highlight = false;
          $scope.show_highlight = true;
      
      
      Severity: Minor
      Found in public/browse/app.js - About 1 hr to fix

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

            groups: {
              active: [],
              ont_property: "groups",
              filter: function(ontology) {
                if ($scope.facets.groups.active.length == 0)
        Severity: Major
        Found in public/browse/app.js and 2 other locations - About 2 hrs to fix
        public/browse/app.js on lines 85..95
        public/browse/app.js on lines 96..106

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

        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 3 locations. Consider refactoring.
        Open

            artifacts: {
              active: [],
              ont_property: "artifacts",
              filter: function(ontology) {
                if ($scope.facets.artifacts.active.length == 0)
        Severity: Major
        Found in public/browse/app.js and 2 other locations - About 2 hrs to fix
        public/browse/app.js on lines 74..84
        public/browse/app.js on lines 85..95

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

        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 3 locations. Consider refactoring.
        Open

            categories: {
              active: [],
              ont_property: "categories",
              filter: function(ontology) {
                if ($scope.facets.categories.active.length == 0)
        Severity: Major
        Found in public/browse/app.js and 2 other locations - About 2 hrs to fix
        public/browse/app.js on lines 74..84
        public/browse/app.js on lines 96..106

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

        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

          $scope.categories = jQuery(document).data().bp.categories.sort(function(a, b){
            if (a.name < b.name) return -1;
            if (a.name > b.name) return 1;
            return 0;
          });
        Severity: Major
        Found in public/browse/app.js and 1 other location - About 2 hrs to fix
        public/browse/app.js on lines 33..37

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

        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

          $scope.groups = jQuery(document).data().bp.groups.sort(function(a, b){
            if (a.acronym < b.acronym) return -1;
            if (a.acronym > b.acronym) return 1;
            return 0;
          });
        Severity: Major
        Found in public/browse/app.js and 1 other location - About 2 hrs to fix
        public/browse/app.js on lines 27..31

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

        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

              filter: function(ontology) {
                if ($scope.facets.types.active.length == 0)
                  return true;
                if ($scope.facets.types.active.indexOf(ontology.type) === -1)
                  return false;
        Severity: Major
        Found in public/browse/app.js and 1 other location - About 2 hrs to fix
        public/browse/app.js on lines 66..72

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

        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

              filter: function(ontology) {
                if ($scope.facets.formats.active.length == 0)
                  return true;
                if ($scope.facets.formats.active.indexOf(ontology.format) === -1)
                  return false;
        Severity: Major
        Found in public/browse/app.js and 1 other location - About 2 hrs to fix
        public/browse/app.js on lines 55..61

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

        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

          $scope.groupAcronyms = function(groups) {
            var groupNames = [];
            angular.forEach(groups, function(group) {
              groupNames.push($scope.groups_hash[group].acronym);
            });
        Severity: Major
        Found in public/browse/app.js and 1 other location - About 1 hr to fix
        public/browse/app.js on lines 162..168

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

        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

          $scope.categoryNames = function(categories) {
            var catNames = [];
            angular.forEach(categories, function(category) {
              catNames.push($scope.categories_hash[category].name)
            })
        Severity: Major
        Found in public/browse/app.js and 1 other location - About 1 hr to fix
        public/browse/app.js on lines 154..160

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

        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