superdesk/superdesk-client-core

View on GitHub
scripts/apps/authoring/metadata/metadata.ts

Summary

Maintainability
F
2 wks
Test Coverage

File metadata.ts has 1148 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import _ from 'lodash';
import PreferedCvItemsConfigDirective from './PreferedCvItemsConfigDirective';
import MetaPlaceDirective from './MetaPlaceDirective';
import {getVocabularySelectionTypes} from '../../vocabularies/constants';
import {gettext} from 'core/utils';
Severity: Major
Found in scripts/apps/authoring/metadata/metadata.ts - About 2 days to fix

    Function MetaTermsDirective has a Cognitive Complexity of 92 (exceeds 5 allowed). Consider refactoring.
    Open

    function MetaTermsDirective(metadata, $filter, $timeout, preferencesService, desks) {
        return {
            scope: {
                item: '=',
                field: '@',
    Severity: Minor
    Found in scripts/apps/authoring/metadata/metadata.ts - 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 MetaTermsDirective has 298 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function MetaTermsDirective(metadata, $filter, $timeout, preferencesService, desks) {
        return {
            scope: {
                item: '=',
                field: '@',
    Severity: Major
    Found in scripts/apps/authoring/metadata/metadata.ts - About 1 day to fix

      Function MetaTermsDirectiveLink has 273 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              link: function MetaTermsDirectiveLink(scope, elem, attrs) {
                  metadata.subjectScope = scope;
                  scope.getLocaleName = metadata.getLocaleName;
                  const reloadList = scope.reloadList === 'true';
                  const includeParent = scope.includeParent === 'true';
      Severity: Major
      Found in scripts/apps/authoring/metadata/metadata.ts - About 1 day to fix

        Function MetadataService has 216 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export function MetadataService(api, subscribersService, vocabularies, $rootScope, session, $filter) {
            var service = {
                values: {},
                helper_text: {},
                popup_width: {},
        Severity: Major
        Found in scripts/apps/authoring/metadata/metadata.ts - About 1 day to fix

          Function MetadataCtrl has 153 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function MetadataCtrl(
              $scope, desks, metadata, privileges, datetimeHelper, userList,
              preferencesService, archiveService, moment, content) {
              desks.initialize();
          
          
          Severity: Major
          Found in scripts/apps/authoring/metadata/metadata.ts - About 6 hrs to fix

            Function MetadataCtrl has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
            Open

            function MetadataCtrl(
                $scope, desks, metadata, privileges, datetimeHelper, userList,
                preferencesService, archiveService, moment, content) {
                desks.initialize();
            
            
            Severity: Minor
            Found in scripts/apps/authoring/metadata/metadata.ts - About 5 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 MetaDropdownDirective has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
            Open

            function MetaDropdownDirective($filter, metadata) {
                return {
                    scope: {
                        list: '=',
                        disabled: '=ngDisabled',
            Severity: Minor
            Found in scripts/apps/authoring/metadata/metadata.ts - 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 MetaLocatorsDirective has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
            Open

            function MetaLocatorsDirective(places) {
                return {
                    scope: {
                        item: '=',
                        fieldprefix: '@',
            Severity: Minor
            Found in scripts/apps/authoring/metadata/metadata.ts - 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 MetadataService has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
            Open

            export function MetadataService(api, subscribersService, vocabularies, $rootScope, session, $filter) {
                var service = {
                    values: {},
                    helper_text: {},
                    popup_width: {},
            Severity: Minor
            Found in scripts/apps/authoring/metadata/metadata.ts - About 3 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 MetaLocatorsDirective has 87 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function MetaLocatorsDirective(places) {
                return {
                    scope: {
                        item: '=',
                        fieldprefix: '@',
            Severity: Major
            Found in scripts/apps/authoring/metadata/metadata.ts - About 3 hrs to fix

              Function MetaTagsDirective has 78 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function MetaTagsDirective(api, $timeout) {
                  var ENTER = 13;
                  var ESC = 27;
              
                  return {
              Severity: Major
              Found in scripts/apps/authoring/metadata/metadata.ts - About 3 hrs to fix

                Function MetaDropdownDirective has 70 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function MetaDropdownDirective($filter, metadata) {
                    return {
                        scope: {
                            list: '=',
                            disabled: '=ngDisabled',
                Severity: Major
                Found in scripts/apps/authoring/metadata/metadata.ts - About 2 hrs to fix

                  Function link has 67 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                          link: function(scope, element) {
                              scope.locators = [];
                  
                              scope.$applyAsync(() => {
                                  if (scope.item) {
                  Severity: Major
                  Found in scripts/apps/authoring/metadata/metadata.ts - About 2 hrs to fix

                    Function link has 64 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                            link: function(scope, element) {
                                var inputElem = element.find('input')[0];
                    
                                scope.adding = false;
                                scope.refreshing = false;
                    Severity: Major
                    Found in scripts/apps/authoring/metadata/metadata.ts - About 2 hrs to fix

                      Function MetaTagsDirective has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                      Open

                      function MetaTagsDirective(api, $timeout) {
                          var ENTER = 13;
                          var ESC = 27;
                      
                          return {
                      Severity: Minor
                      Found in scripts/apps/authoring/metadata/metadata.ts - 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 link has 52 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                              link: function(scope, elem) {
                                  scope.multiInputFields = ['place', 'genre', 'anpa_category', 'subject', 'authors'];
                                  scope.getLocaleName = metadata.getLocaleName;
                      
                                  scope.select = function(item) {
                      Severity: Major
                      Found in scripts/apps/authoring/metadata/metadata.ts - About 2 hrs to fix

                        Function MetaWordsListDirective has 52 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        function MetaWordsListDirective() {
                            return {
                                scope: {
                                    item: '=',
                                    field: '@',
                        Severity: Major
                        Found in scripts/apps/authoring/metadata/metadata.ts - About 2 hrs to fix

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

                                      scope.selectTerm = function(term, $event) {
                                          // while searching, allow to search for categories but don't select them
                                          if (scope.tree?.[term?.[scope.uniqueField]] && !scope.allowEntireCat) {
                                              scope.openTree(term, $event);
                                          } else if (term) {
                          Severity: Minor
                          Found in scripts/apps/authoring/metadata/metadata.ts - About 1 hr to fix

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

                                    link: function(scope, element) {
                                        scope.words = [];
                                        scope.selectedTerm = '';
                            
                                        scope.$applyAsync(() => {
                            Severity: Minor
                            Found in scripts/apps/authoring/metadata/metadata.ts - About 1 hr to fix

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

                              function MetadropdownFocusDirective(keyboardManager) {
                                  return {
                                      require: 'dropdown',
                                      link: function(scope, elem, attrs, dropdown) {
                                          scope.$watch(dropdown.isOpen, (isOpen) => {
                              Severity: Minor
                              Found in scripts/apps/authoring/metadata/metadata.ts - About 1 hr to fix

                                Function MetaTargetedPublishingDirective has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                function MetaTargetedPublishingDirective() {
                                    return {
                                        scope: {
                                            list: '=',
                                            disabled: '=ngDisabled',
                                Severity: Minor
                                Found in scripts/apps/authoring/metadata/metadata.ts - About 1 hr to fix

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

                                              scope.searchTerms = function(term) {
                                                  if (!term) {
                                                      scope.terms = filterSelected(scope.list);
                                                      scope.activeList = false;
                                                  } else {
                                  Severity: Minor
                                  Found in scripts/apps/authoring/metadata/metadata.ts - About 1 hr to fix

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

                                            link: function(scope, elem, attrs, dropdown) {
                                                scope.$watch(dropdown.isOpen, (isOpen) => {
                                                    if (isOpen) {
                                                        _.defer(() => {
                                                            var keyboardOptions = {inputDisabled: false, propagate: false};
                                    Severity: Minor
                                    Found in scripts/apps/authoring/metadata/metadata.ts - About 1 hr to fix

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

                                                  scope.selectLocator = function(locator) {
                                                      var updates = {};
                                                      let loc = locator;
                                      
                                                      if (!loc && scope.$ctrl.selectedTerm) {
                                      Severity: Minor
                                      Found in scripts/apps/authoring/metadata/metadata.ts - About 1 hr to fix

                                        Function MetadataCtrl has 10 arguments (exceeds 4 allowed). Consider refactoring.
                                        Open

                                            $scope, desks, metadata, privileges, datetimeHelper, userList,
                                            preferencesService, archiveService, moment, content) {
                                        Severity: Major
                                        Found in scripts/apps/authoring/metadata/metadata.ts - About 1 hr to fix

                                          Function select has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                                          Open

                                                      scope.select = function(item) {
                                                          var fieldObject: {[fieldId: string]: any} = {};
                                                          const isMultiInputField = scope.multiInputFields.includes(scope.field);
                                          
                                                          if (item) {
                                          Severity: Minor
                                          Found in scripts/apps/authoring/metadata/metadata.ts - About 1 hr to fix

                                            Function fetchMetadataValues has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                                            Open

                                                    fetchMetadataValues: function() {
                                                        var self = this;
                                            
                                                        return vocabularies.getAllActiveVocabularies().then((result) => {
                                                            _.each(result, (vocabulary) => {
                                            Severity: Minor
                                            Found in scripts/apps/authoring/metadata/metadata.ts - About 1 hr to fix

                                              Function MetaWordsListDirective has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                                              Open

                                              function MetaWordsListDirective() {
                                                  return {
                                                      scope: {
                                                          item: '=',
                                                          field: '@',
                                              Severity: Minor
                                              Found in scripts/apps/authoring/metadata/metadata.ts - 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 fetchAuthors has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                                              Open

                                                      fetchAuthors: function(code) {
                                                          var self = this;
                                              
                                                          self.values.authors = [];
                                              
                                              
                                              Severity: Minor
                                              Found in scripts/apps/authoring/metadata/metadata.ts - About 1 hr to fix

                                                Function MetadropdownFocusDirective has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                                                Open

                                                function MetadropdownFocusDirective(keyboardManager) {
                                                    return {
                                                        require: 'dropdown',
                                                        link: function(scope, elem, attrs, dropdown) {
                                                            scope.$watch(dropdown.isOpen, (isOpen) => {
                                                Severity: Minor
                                                Found in scripts/apps/authoring/metadata/metadata.ts - About 55 mins 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 MetadataService has 6 arguments (exceeds 4 allowed). Consider refactoring.
                                                Open

                                                export function MetadataService(api, subscribersService, vocabularies, $rootScope, session, $filter) {
                                                Severity: Minor
                                                Found in scripts/apps/authoring/metadata/metadata.ts - About 45 mins to fix

                                                  Consider simplifying this complex logical expression.
                                                  Open

                                                                  if (!term) {
                                                                      scope.terms = filterSelected(scope.list);
                                                                      scope.activeList = false;
                                                                  } else {
                                                                      let searchList;
                                                  Severity: Major
                                                  Found in scripts/apps/authoring/metadata/metadata.ts - About 40 mins to fix

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

                                                    function MetaTermsDirective(metadata, $filter, $timeout, preferencesService, desks) {
                                                    Severity: Minor
                                                    Found in scripts/apps/authoring/metadata/metadata.ts - About 35 mins to fix

                                                      Function MetaTargetedPublishingDirective has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                                      Open

                                                      function MetaTargetedPublishingDirective() {
                                                          return {
                                                              scope: {
                                                                  list: '=',
                                                                  disabled: '=ngDisabled',
                                                      Severity: Minor
                                                      Found in scripts/apps/authoring/metadata/metadata.ts - About 35 mins 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

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

                                                          if (!archiveService.isLegal($scope.item)) {
                                                              if ($scope.item.original_creator) {
                                                                  userList.getUser($scope.item.original_creator)
                                                                      .then((user) => {
                                                                          $scope.originalCreator = user.display_name;
                                                      Severity: Major
                                                      Found in scripts/apps/authoring/metadata/metadata.ts and 1 other location - About 5 hrs to fix
                                                      scripts/apps/archive/directives/MediaMetadata.ts on lines 38..51

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

                                                      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

                                                          function setEmbargoTS(newValue, oldValue) {
                                                              if ((newValue || oldValue) && newValue !== oldValue) {
                                                                  if ($scope.item.embargo_date && $scope.item.embargo_time) {
                                                                      $scope.item.embargo = datetimeHelper.mergeDateTime(
                                                                          $scope.item.embargo_date,
                                                      Severity: Major
                                                      Found in scripts/apps/authoring/metadata/metadata.ts and 1 other location - About 5 hrs to fix
                                                      scripts/apps/authoring/metadata/metadata.ts on lines 132..147

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

                                                      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

                                                          function setPublishScheduleDate(newValue, oldValue) {
                                                              if ((newValue || oldValue) && newValue !== oldValue) {
                                                                  if ($scope.item.publish_schedule_date && $scope.item.publish_schedule_time) {
                                                                      $scope.item.publish_schedule = datetimeHelper.mergeDateTime(
                                                                          $scope.item.publish_schedule_date,
                                                      Severity: Major
                                                      Found in scripts/apps/authoring/metadata/metadata.ts and 1 other location - About 5 hrs to fix
                                                      scripts/apps/authoring/metadata/metadata.ts on lines 167..182

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

                                                      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

                                                                      this.loaded = this.fetchMetadataValues()
                                                                          .then(angular.bind(this, this.fetchSubjectcodes))
                                                                          .then(angular.bind(this, this.fetchAuthors))
                                                                          .then(angular.bind(this, this.fetchSubscribers))
                                                                          .then(angular.bind(this, this.fetchCities))
                                                      Severity: Major
                                                      Found in scripts/apps/authoring/metadata/metadata.ts and 1 other location - About 3 hrs to fix
                                                      scripts/apps/desks/services/DesksFactory.ts on lines 322..327

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

                                                      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

                                                                      self.values.regions = _.sortBy(self.values.geographical_restrictions,
                                                                          (target) => target.value && target.value.toLowerCase() === 'all' ? '' : target.name,
                                                                      );
                                                      Severity: Major
                                                      Found in scripts/apps/authoring/metadata/metadata.ts and 1 other location - About 1 hr to fix
                                                      scripts/apps/authoring/metadata/metadata.ts on lines 1172..1174

                                                      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

                                                              if (publishSchedule) {
                                                                  info = datetimeHelper.splitDateTime(publishSchedule, $scope.item.time_zone);
                                                                  $scope.item.publish_schedule_date = info.date;
                                                                  $scope.item.publish_schedule_time = info.time;
                                                              }
                                                      Severity: Major
                                                      Found in scripts/apps/authoring/metadata/metadata.ts and 1 other location - About 1 hr to fix
                                                      scripts/apps/authoring/metadata/metadata.ts on lines 205..209

                                                      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

                                                                      self.values.subscriberTypes = _.sortBy(self.values.subscriber_types,
                                                                          (target) => target.value && target.value.toLowerCase() === 'all' ? '' : target.name,
                                                                      );
                                                      Severity: Major
                                                      Found in scripts/apps/authoring/metadata/metadata.ts and 1 other location - About 1 hr to fix
                                                      scripts/apps/authoring/metadata/metadata.ts on lines 1169..1171

                                                      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

                                                              if (embargo) {
                                                                  info = datetimeHelper.splitDateTime(embargo, $scope.item.time_zone);
                                                                  $scope.item.embargo_date = info.date;
                                                                  $scope.item.embargo_time = info.time;
                                                              }
                                                      Severity: Major
                                                      Found in scripts/apps/authoring/metadata/metadata.ts and 1 other location - About 1 hr to fix
                                                      scripts/apps/authoring/metadata/metadata.ts on lines 211..215

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

                                                              scope: {
                                                                  list: '=',
                                                                  disabled: '=ngDisabled',
                                                                  item: '=',
                                                                  field: '@',
                                                      Severity: Major
                                                      Found in scripts/apps/authoring/metadata/metadata.ts and 2 other locations - About 1 hr to fix
                                                      scripts/apps/authoring/authoring/directives/ItemCarouselDirective.ts on lines 61..73
                                                      scripts/apps/authoring/media/MediaMetadataEditorDirective.ts on lines 6..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 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

                                                              search_cvs: appConfig.search_cvs || [
                                                                  {id: 'subject', name: 'Subject', field: 'subject', list: 'subjectcodes'},
                                                                  {id: 'companycodes', name: 'Company Codes', field: 'company_codes', list: 'company_codes'},
                                                              ],
                                                      Severity: Minor
                                                      Found in scripts/apps/authoring/metadata/metadata.ts and 1 other location - About 55 mins to fix
                                                      scripts/apps/search/services/SearchService.ts on lines 137..139

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

                                                      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: {
                                                                  item: '=',
                                                                  fieldprefix: '@',
                                                                  field: '@',
                                                                  disabled: '=ngDisabled',
                                                      Severity: Minor
                                                      Found in scripts/apps/authoring/metadata/metadata.ts and 1 other location - About 35 mins to fix
                                                      scripts/apps/search/services/SearchService.ts on lines 297..307

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

                                                      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