superdesk/superdesk-client-core

View on GitHub
scripts/core/ui/ui.ts

Summary

Maintainability
F
1 wk
Test Coverage

File ui.ts has 999 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/* eslint-disable max-len */
/* tslint:disable:max-line-length */

import _, {difference, filter, mapValues, sortBy, union, without} from 'lodash';
import moment from 'moment-timezone';
Severity: Major
Found in scripts/core/ui/ui.ts - About 2 days to fix

    Function DatepickerInnerDirective has 99 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function DatepickerInnerDirective($compile, $document, popupService, datetimeHelper) {
        var popupTpl = '<div sd-datepicker-wrapper ng-model="date">' +
            '<div datepicker format-day="d" starting-day="' + appConfig.startingDay + '" show-weeks="false"></div>' +
        '</div>';
    
    
    Severity: Major
    Found in scripts/core/ui/ui.ts - About 3 hrs to fix

      Function splitterWidget has 91 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function splitterWidget(superdesk, $timeout, $rootScope) {
          return {
              link: function(scope, element) {
                  const MONITORING_MIN_WIDTH = 532;
                  const AUTHORING_MIN_WIDTH = 730;
      Severity: Major
      Found in scripts/core/ui/ui.ts - About 3 hrs to fix

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

        function TimepickerInnerDirective($compile, $document, popupService, datetimeHelper) {
            var popupTpl = '<div sd-timepicker-popup ' +
                'data-open="open" data-time="time" data-select="timeSelection({time: time})" data-keydown="keydown(e)">' +
                '</div>';
        
        
        Severity: Major
        Found in scripts/core/ui/ui.ts - About 3 hrs to fix

          Function DropdownFocus has 88 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function DropdownFocus(Keys) {
              return {
                  require: 'dropdown',
                  link: function(scope, elem, attrs, dropdown) {
                      scope.$watch(dropdown.isOpen, (isOpen) => {
          Severity: Major
          Found in scripts/core/ui/ui.ts - About 3 hrs to fix

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

                    link: function(scope, element) {
                        const MONITORING_MIN_WIDTH = 532;
                        const AUTHORING_MIN_WIDTH = 730;
            
                        let workspace, authoring, container;
            Severity: Major
            Found in scripts/core/ui/ui.ts - About 3 hrs to fix

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

                      link: function(scope, element, attrs, ctrl) {
                          var VIEW_DATE_FORMAT = appConfig.view.dateformat;
                          var MODEL_DATE_FORMAT = scope.dtFormat || appConfig.model.dateformat;
                          var ESC = 27;
                          var DOWN_ARROW = 40;
              Severity: Major
              Found in scripts/core/ui/ui.ts - About 3 hrs to fix

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

                        link: function(scope, elem, attrs, dropdown) {
                            scope.$watch(dropdown.isOpen, (isOpen) => {
                                var inputField = elem.find('input[type="text"]');
                
                                if (isOpen) {
                Severity: Major
                Found in scripts/core/ui/ui.ts - About 3 hrs to fix

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

                          link: function(scope, element, attrs, ctrl) {
                              var MODEL_TIME_FORMAT = appConfig.model.timeformat;
                              var VIEW_TIME_FORMAT = appConfig.view.timeformat || MODEL_TIME_FORMAT;
                              var ESC = 27;
                              var DOWN_ARROW = 40;
                  Severity: Major
                  Found in scripts/core/ui/ui.ts - About 3 hrs to fix

                    Function DatepickerInnerDirective has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
                    Open

                    function DatepickerInnerDirective($compile, $document, popupService, datetimeHelper) {
                        var popupTpl = '<div sd-datepicker-wrapper ng-model="date">' +
                            '<div datepicker format-day="d" starting-day="' + appConfig.startingDay + '" show-weeks="false"></div>' +
                        '</div>';
                    
                    
                    Severity: Minor
                    Found in scripts/core/ui/ui.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 TimepickerInnerDirective has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
                    Open

                    function TimepickerInnerDirective($compile, $document, popupService, datetimeHelper) {
                        var popupTpl = '<div sd-timepicker-popup ' +
                            'data-open="open" data-time="time" data-select="timeSelection({time: time})" data-keydown="keydown(e)">' +
                            '</div>';
                    
                    
                    Severity: Minor
                    Found in scripts/core/ui/ui.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 TimepickerPopupDirective has 56 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    function TimepickerPopupDirective($timeout) {
                        return {
                            templateUrl: 'scripts/core/ui/views/sd-timepicker-popup.html',
                            scope: {
                                open: '=',
                    Severity: Major
                    Found in scripts/core/ui/ui.ts - About 2 hrs to fix

                      Function multiSelectDirective has 54 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      function multiSelectDirective() {
                          return {
                              scope: {
                                  item: '=',
                                  list: '=',
                      Severity: Major
                      Found in scripts/core/ui/ui.ts - About 2 hrs to fix

                        Function splitterWidget has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                        Open

                        function splitterWidget(superdesk, $timeout, $rootScope) {
                            return {
                                link: function(scope, element) {
                                    const MONITORING_MIN_WIDTH = 532;
                                    const AUTHORING_MIN_WIDTH = 730;
                        Severity: Minor
                        Found in scripts/core/ui/ui.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 TimezoneDirective has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        function TimezoneDirective(tzdata, $timeout) {
                            return {
                                templateUrl: 'scripts/core/ui/views/sd-timezone.html',
                                scope: {
                                    timezone: '=',
                        Severity: Minor
                        Found in scripts/core/ui/ui.ts - About 1 hr to fix

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

                                  link: function(scope, element) {
                                      const MODEL_TIME_FORMAT = appConfig.model.timeformat;
                                      const VIEW_TIME_FORMAT = appConfig.view.timeformat;
                          
                                      const POPUP = '.timepicker-popup';
                          Severity: Minor
                          Found in scripts/core/ui/ui.ts - About 1 hr to fix

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

                                    link: function(scope) {
                                        scope.selectedItems = [];
                            
                                        // use listCopy in order not to mutate the original list
                                        // mutating the original list prevents passing expression as a list argument
                            Severity: Minor
                            Found in scripts/core/ui/ui.ts - About 1 hr to fix

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

                              function validationDirective() {
                                  const isValid = (errors: ServerErrorsType) => errors == null || (Array.isArray(errors) && errors.length === 0);
                              
                                  return {
                                      restrict: 'A',
                              Severity: Minor
                              Found in scripts/core/ui/ui.ts - About 1 hr to fix

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

                                        link: function(scope, el) {
                                            scope.timeZones = []; // all time zones to choose from
                                            scope.tzSearchTerm = ''; // the current time zone search term
                                            scope.getTimezoneLabel = getTimezoneLabel;
                                
                                
                                Severity: Minor
                                Found in scripts/core/ui/ui.ts - About 1 hr to fix

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

                                  function DatepickerDirective($document) {
                                      return {
                                          scope: {
                                              dt: '=ngModel',
                                              disabled: '=ngDisabled',
                                  Severity: Minor
                                  Found in scripts/core/ui/ui.ts - About 1 hr to fix

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

                                    function mediaQuery($window, authoringWorkspace: AuthoringWorkspaceService) {
                                        return {
                                            scope: {
                                                minWidth: '=',
                                                maxWidth: '=',
                                    Severity: Minor
                                    Found in scripts/core/ui/ui.ts - About 1 hr to fix

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

                                              link: function(scope, elem, attrs, ctrl) {
                                                  var invalidText = '<span id="required_span" class="sd-invalid-text">' +
                                                  gettext('This field is required') + '</span>';
                                      
                                                  scope.$watch(attrs.required, (required) => {
                                      Severity: Minor
                                      Found in scripts/core/ui/ui.ts - About 1 hr to fix

                                        Function AutoexpandDirective has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                                        Open

                                        function AutoexpandDirective() {
                                            return {
                                                link: function(scope, element) {
                                                    var _minHeight = element.outerHeight();
                                        
                                        
                                        Severity: Minor
                                        Found in scripts/core/ui/ui.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 TimepickerDirective has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                                        Open

                                        function TimepickerDirective($document) {
                                            return {
                                                scope: {
                                                    tt: '=ngModel',
                                                    style: '@',
                                        Severity: Minor
                                        Found in scripts/core/ui/ui.ts - About 1 hr to fix

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

                                                  link: function(scope, elem) {
                                                      var window = angular.element($window);
                                                      var resize = _.debounce(calcSize, 300);
                                                      var elementClass = scope.elementClass ? scope.elementClass : 'elementState';
                                          
                                          
                                          Severity: Minor
                                          Found in scripts/core/ui/ui.ts - About 1 hr to fix

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

                                                                    handlers[Keys.down] = function handleDown() {
                                                                        var nextElem = elem.find('button:focus')
                                                                                .parent('li')
                                                                                .next()
                                                                                .children('button'),
                                            Severity: Minor
                                            Found in scripts/core/ui/ui.ts - About 1 hr to fix

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

                                              function DatepickerDirective($document) {
                                                  return {
                                                      scope: {
                                                          dt: '=ngModel',
                                                          disabled: '=ngDisabled',
                                              Severity: Minor
                                              Found in scripts/core/ui/ui.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

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

                                              function mediaQuery($window, authoringWorkspace: AuthoringWorkspaceService) {
                                                  return {
                                                      scope: {
                                                          minWidth: '=',
                                                          maxWidth: '=',
                                              Severity: Minor
                                              Found in scripts/core/ui/ui.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

                                              Function PopupService has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                              Open

                                              function PopupService($document) {
                                                  var service: any = {};
                                              
                                                  service.position = function(width, height, target) {
                                                      // taking care of screen size and responsiveness
                                              Severity: Minor
                                              Found in scripts/core/ui/ui.ts - About 25 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 WeekdayPickerDirective has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                              Open

                                              function WeekdayPickerDirective(weekdays) {
                                                  return {
                                                      templateUrl: 'scripts/core/ui/views/weekday-picker.html',
                                                      scope: {
                                                          model: '=',
                                              Severity: Minor
                                              Found in scripts/core/ui/ui.ts - About 25 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 multiSelectDirective has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                              Open

                                              function multiSelectDirective() {
                                                  return {
                                                      scope: {
                                                          item: '=',
                                                          list: '=',
                                              Severity: Minor
                                              Found in scripts/core/ui/ui.ts - About 25 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 TimepickerPopupDirective has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                              Open

                                              function TimepickerPopupDirective($timeout) {
                                                  return {
                                                      templateUrl: 'scripts/core/ui/views/sd-timepicker-popup.html',
                                                      scope: {
                                                          open: '=',
                                              Severity: Minor
                                              Found in scripts/core/ui/ui.ts - About 25 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

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

                                                          scope.keydown = function(evt) {
                                                              if (evt.which === ESC) {
                                                                  evt.preventDefault();
                                                                  scope.close();
                                                              } else if (evt.which === DOWN_ARROW && !scope.open) {
                                              Severity: Major
                                              Found in scripts/core/ui/ui.ts and 1 other location - About 3 hrs to fix
                                              scripts/core/ui/ui.ts on lines 571..580

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

                                              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

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

                                                          scope.keydown = function(evt) {
                                                              if (evt.which === ESC) {
                                                                  evt.preventDefault();
                                                                  scope.close();
                                                              } else if (evt.which === DOWN_ARROW && !scope.open) {
                                              Severity: Major
                                              Found in scripts/core/ui/ui.ts and 1 other location - About 3 hrs to fix
                                              scripts/core/ui/ui.ts on lines 417..426

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

                                              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 (width < scope.minWidth) {
                                                                  scope.$parent.$applyAsync(() => {
                                                                      scope.$parent[elementClass] = 'compact';
                                                                  });
                                                                  elem.removeClass('comfort').addClass('compact');
                                              Severity: Major
                                              Found in scripts/core/ui/ui.ts and 1 other location - About 1 hr to fix
                                              scripts/core/ui/ui.ts on lines 1017..1027

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

                                              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

                                                              } else if (width > scope.maxWidth) {
                                                                  scope.$parent.$applyAsync(() => {
                                                                      scope.$parent[elementClass] = 'comfort';
                                                                  });
                                                                  elem.removeClass('compact').addClass('comfort');
                                              Severity: Major
                                              Found in scripts/core/ui/ui.ts and 1 other location - About 1 hr to fix
                                              scripts/core/ui/ui.ts on lines 1012..1027

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

                                              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.$watch('open', (value) => {
                                                              if (value) {
                                                                  $popupWrapper.offset(popupService.position(260, 270, element));
                                                                  scope.$broadcast('datepicker.focus');
                                                              }
                                              Severity: Major
                                              Found in scripts/core/ui/ui.ts and 1 other location - About 1 hr to fix
                                              scripts/core/ui/ui.ts on lines 564..569

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

                                              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.$watch('open', (value) => {
                                                              if (value) {
                                                                  $popupWrapper.offset(popupService.position(200, 310, element));
                                                                  scope.$broadcast('timepicker.focus');
                                                              }
                                              Severity: Major
                                              Found in scripts/core/ui/ui.ts and 1 other location - About 1 hr to fix
                                              scripts/core/ui/ui.ts on lines 410..415

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

                                              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

                                                                          var prevElem = elem.find('button:focus')
                                                                                  .parent('li')
                                                                                  .prev()
                                                                                  .children('button'),
                                                                              categoryButton = elem.find('.levelup button');
                                              Severity: Minor
                                              Found in scripts/core/ui/ui.ts and 1 other location - About 45 mins to fix
                                              scripts/core/ui/ui.ts on lines 163..167

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

                                              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

                                                                          var nextElem = elem.find('button:focus')
                                                                                  .parent('li')
                                                                                  .next()
                                                                                  .children('button'),
                                                                              categoryButton = elem.find('.levelup button');
                                              Severity: Minor
                                              Found in scripts/core/ui/ui.ts and 1 other location - About 45 mins to fix
                                              scripts/core/ui/ui.ts on lines 148..152

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

                                              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