superdesk/superdesk-client-core

View on GitHub

Showing 3,654 of 3,654 total issues

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 87 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

                link: function(scope, element, attrs, controller) {
                    var $input = element.find('.input-term > input');
                    var $list = element.find('.item-list');
    
                    $input.on('focus', () => {
    Severity: Major
    Found in scripts/core/directives/TypeaheadDirective.ts - About 3 hrs to fix

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

          $scope.rotateImage = (direction) => {
              switch (direction) {
              case 'left':
                  $scope.controls.rotate = $scope.controls.rotate - 90;
                  break;
      scripts/apps/authoring/authoring/controllers/ChangeImageController.ts on lines 496..508

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

      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 (params[key] != null && key === fieldname + 'from') {
                                  if (facetrange[key] == null) {
                                      facetrange[key] = {};
                                  }
      
      
      Severity: Major
      Found in scripts/apps/search/services/SearchService.ts and 1 other location - About 3 hrs to fix
      scripts/apps/search/services/SearchService.ts on lines 255..265

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

      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

                                  {
                                      canSetEmbargo && (
                                          <ToggleBox title={gettext('Embargo')} initiallyOpen>
                                              <DateTimePicker
                                                  value={embargo}
      scripts/core/interactive-article-actions-panel/subcomponents/publishing-date-options.tsx on lines 104..120

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

      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

          function getFilterValue() {
              if ($scope.isListValue()) {
                  var values = [];
      
                  _.each($scope.filterCondition.values, (value) => {
      scripts/apps/content-filters/controllers/FilterConditionsController.ts on lines 133..144

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

      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

              var getFilterValue = function() {
                  if ($scope.isListValue()) {
                      var values = [];
      
                      _.each($scope.filterCondition.values, (value) => {
      scripts/apps/content-filters/controllers/FilterSearchController.ts on lines 84..95

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 104.

      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

                                                  <div className="form__row">
                                                      <Input
                                                          type="text"
                                                          label={gettext('Description')}
                                                          required={true}
      scripts/apps/authoring/attachments/UploadAttachmentsModal.tsx on lines 175..186

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

      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.flipImage = (direction) => {
              switch (direction) {
              case 'horizontal':
                  $scope.controls.fliph = $scope.controls.fliph + 180;
                  break;
      scripts/apps/authoring/authoring/controllers/ChangeImageController.ts on lines 476..488

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

      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 (params[key] != null && key === fieldname + 'to') {
                                  if (facetrange[key] == null) {
                                      facetrange[key] = {};
                                  }
      
      
      Severity: Major
      Found in scripts/apps/search/services/SearchService.ts and 1 other location - About 3 hrs to fix
      scripts/apps/search/services/SearchService.ts on lines 266..276

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

      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

                                                  <div className="form__row">
                                                      <Input
                                                          type="text"
                                                          label={gettext('Title')}
                                                          required={true}
      scripts/apps/authoring/attachments/UploadAttachmentsModal.tsx on lines 187..198

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

      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

                                  {
                                      canSetPublishSchedule && (
                                          <ToggleBox title={gettext('Publish schedule')} initiallyOpen>
                                              <DateTimePicker
                                                  value={publishSchedule}
      scripts/core/interactive-article-actions-panel/subcomponents/publishing-date-options.tsx on lines 86..102

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

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

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

          render(): JSX.Element {
              /**
               * From workQueueItems remove articles which were
               * initially selected so they don't repeat the same
               * article twice, then filter if the result
      Severity: Major
      Found in scripts/apps/authoring-react/multi-edit-modal.tsx - About 3 hrs to fix

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

                link: function(scope) {
                    function setActionsFromExtensions() {
                        scope.articleActionsFromExtensions = getArticleActionsFromExtensions(scope.item);
                    }
        
        

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

          function WebSocketProxy($rootScope, $interval, session, SESSION_EVENTS) {
              var ws = null;
              var connectTimer = -1;
              var TIMEOUT = 5000;
          
          
          Severity: Major
          Found in scripts/core/notification/notification.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 ContentExpiry has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
              Open

              export function ContentExpiry() {
                  return {
                      templateUrl: 'scripts/apps/desks/views/content-expiry.html',
                      scope: {
                          item: '=',
              Severity: Minor
              Found in scripts/apps/desks/directives/ContentExpiry.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 UserListController has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
              Open

              export function UserListController($scope, $location, api, _, session, usersService) {
                  var DEFAULT_SIZE = 25;
              
                  $scope.selected = {user: null};
                  $scope.createdUsers = [];
              Severity: Minor
              Found in scripts/apps/users/controllers/UserListController.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 FamilyService has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
              Open

              export function FamilyService(api, desks) {
                  const repo = 'archive,published';
              
                  /**
                   * @ngdoc method
              Severity: Minor
              Found in scripts/apps/archive/services/FamilyService.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 getSelectSingleValue has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
              Open

              export function getSelectSingleValue(
                  getItems: (props: IProps) => Promise<ISelectSingleValueItems>,
                  itemsUnavailableMessage?: string,
                  getDependentFields?: (props: IProps) => Array<string>,
              ) {

              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

              Severity
              Category
              Status
              Source
              Language