superdesk/superdesk-client-core

View on GitHub

Showing 3,654 of 3,654 total issues

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

        link: function($scope) {
            $scope.provider = null;
            $scope.origProvider = null;
            $scope.providers = null;
            $scope.newDestination = null;
Severity: Major
Found in scripts/apps/search-providers/directive.ts - About 3 hrs to fix

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

            link: function(scope, element, attrs) {
                var appendTarget = element[0];
                var horizBlocks = attrs.x ? parseInt(attrs.x, 10) : 1;
                var vertBlocks = attrs.y ? parseInt(attrs.y, 10) : 1;
    
    
    Severity: Major
    Found in scripts/apps/ingest/directives/PieChartDashboard.ts - About 3 hrs to fix

      Function ReloadService has 85 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function ReloadService($window, $rootScope, session, desks, superdeskFlags) {
          var self = this;
      
          self.userDesks = [];
          self.result = null;
      Severity: Major
      Found in scripts/core/notification/notification.ts - About 3 hrs to fix

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

        export function onAssetLocked(event: ISAMSWebsocketEvent) {
            const store = getStore();
            const item_id = event.detail.extra.item_id!;
            const assetItemIds = getAssetListItemIds(store?.getState());
        
        
        Severity: Major
        Found in scripts/extensions/sams/src/notifications/assets.ts and 1 other location - About 3 hrs to fix
        scripts/extensions/sams/src/notifications/assets.ts on lines 62..70

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

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

        function querySetIds(source: IRootElasticQuery, params: IAssetSearchParams) {
            if (params.setIds != null && params.setIds.length > 0) {
                source.query.bool.must.push(
                    superdeskApi.elasticsearch.terms({
                        field: 'set_id',
        Severity: Major
        Found in scripts/extensions/sams/src/api/assets.ts and 4 other locations - About 3 hrs to fix
        scripts/extensions/sams/src/api/assets.ts on lines 83..92
        scripts/extensions/sams/src/api/assets.ts on lines 120..129
        scripts/extensions/sams/src/api/assets.ts on lines 131..140
        scripts/extensions/sams/src/api/assets.ts on lines 142..151

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

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

        function queryExcludedAssetIds(source: IRootElasticQuery, params: IAssetSearchParams) {
            if (params.excludedAssetIds != null && params.excludedAssetIds.length > 0) {
                source.query.bool.must_not.push(
                    superdeskApi.elasticsearch.terms({
                        field: '_id',
        Severity: Major
        Found in scripts/extensions/sams/src/api/assets.ts and 4 other locations - About 3 hrs to fix
        scripts/extensions/sams/src/api/assets.ts on lines 83..92
        scripts/extensions/sams/src/api/assets.ts on lines 94..103
        scripts/extensions/sams/src/api/assets.ts on lines 131..140
        scripts/extensions/sams/src/api/assets.ts on lines 142..151

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

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

        function querySetId(source: IRootElasticQuery, params: IAssetSearchParams) {
            if (params.setId != null && params.setId.length > 0) {
                source.query.bool.must.push(
                    superdeskApi.elasticsearch.term({
                        field: 'set_id',
        Severity: Major
        Found in scripts/extensions/sams/src/api/assets.ts and 4 other locations - About 3 hrs to fix
        scripts/extensions/sams/src/api/assets.ts on lines 94..103
        scripts/extensions/sams/src/api/assets.ts on lines 120..129
        scripts/extensions/sams/src/api/assets.ts on lines 131..140
        scripts/extensions/sams/src/api/assets.ts on lines 142..151

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

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

                    return function DataAdapter(resource, params) {
                        var self = this;
                        var state = LocationStateAdapter; // @todo implement storage state adapter
                        var cancelWatch = angular.noop;
                        var defaultParams: any = {page: 1};
        Severity: Major
        Found in scripts/core/services/data.ts - About 3 hrs to fix

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

          function queryState(source: IRootElasticQuery, params: IAssetSearchParams) {
              if (params.state != null && params.state.length > 0) {
                  source.query.bool.must.push(
                      superdeskApi.elasticsearch.term({
                          field: 'state',
          Severity: Major
          Found in scripts/extensions/sams/src/api/assets.ts and 4 other locations - About 3 hrs to fix
          scripts/extensions/sams/src/api/assets.ts on lines 83..92
          scripts/extensions/sams/src/api/assets.ts on lines 94..103
          scripts/extensions/sams/src/api/assets.ts on lines 120..129
          scripts/extensions/sams/src/api/assets.ts on lines 142..151

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

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

          function queryStates(source: IRootElasticQuery, params: IAssetSearchParams) {
              if (params.states != null && params.states.length > 0) {
                  source.query.bool.must.push(
                      superdeskApi.elasticsearch.terms({
                          field: 'state',
          Severity: Major
          Found in scripts/extensions/sams/src/api/assets.ts and 4 other locations - About 3 hrs to fix
          scripts/extensions/sams/src/api/assets.ts on lines 83..92
          scripts/extensions/sams/src/api/assets.ts on lines 94..103
          scripts/extensions/sams/src/api/assets.ts on lines 120..129
          scripts/extensions/sams/src/api/assets.ts on lines 131..140

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

          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

          export function onAssetUnlocked(event: ISAMSWebsocketEvent) {
              const store = getStore();
              const item_id = event.detail.extra.item_id!;
              const assetItemIds = getAssetListItemIds(store?.getState());
          
          
          Severity: Major
          Found in scripts/extensions/sams/src/notifications/assets.ts and 1 other location - About 3 hrs to fix
          scripts/extensions/sams/src/notifications/assets.ts on lines 52..60

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

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

          function getDefaults(grunt) {
              var version;
          
              try {
                  version = require('git-rev-sync').short('..');
          Severity: Major
          Found in webpack.config.js - About 3 hrs to fix

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

                render() {
                    const {gettext} = superdeskApi.localization;
                    const {ListItemComponent, RightPanelComponent} = this.props;
                    const currentItem = this.state.items[this.state.selectedIndex];
            
            
            Severity: Major
            Found in scripts/extensions/sams/src/containers/FileUploadModal.tsx - About 3 hrs to fix

              Function SavedSearches has 84 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export function SavedSearches($rootScope, api, session, modal, notify, asset, $location,
                  desks, privileges, savedSearch): ng.IDirective {
                  return {
                      templateUrl: asset.templateUrl('apps/search/views/saved-searches.html'),
                      scope: {},
              Severity: Major
              Found in scripts/apps/search/directives/SavedSearches.ts - About 3 hrs to fix

                Function getSelectSingleValueAutoComplete has 84 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                export function getSelectSingleValueAutoComplete(
                    options: {
                        query: (searchString: string, props: IProps) => Promise<IRestApiResponse<any>>;
                        queryById: (id: string) => Promise<any>;
                        getPlaceholder: (props: IProps) => string;

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

                                      {has('annotation') && (
                                          <SelectionButton
                                              onClick={showPopup(PopupTypes.Annotation)}
                                              precondition={
                                                  this.props.highlightsManager.canAddHighlight(getHighlightsConfig().ANNOTATION.type)
                  Severity: Major
                  Found in scripts/core/editor3/components/toolbar/index.tsx and 1 other location - About 3 hrs to fix
                  scripts/core/editor3/components/toolbar/index.tsx on lines 267..278

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

                  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

                      constructor(props) {
                          super(props);
                  
                          this.state = {hover: false};
                          this.select = this.select.bind(this);
                  Severity: Major
                  Found in scripts/apps/contacts/components/Item.tsx and 1 other location - About 3 hrs to fix
                  scripts/apps/search/components/actions-menu/SubmenuDropdown.tsx on lines 21..31

                  Duplicated Code

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

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

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

                  Tuning

                  This issue has a mass of 102.

                  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

                      constructor(props) {
                          super(props);
                  
                          this.state = {
                              open: false,
                  scripts/apps/contacts/components/Item.tsx on lines 23..30

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

                  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>
                                      <Checkbox
                                          label={{text: gettext('Allow adding items that are published')}}
                                          checked={config.allowedWorkflows.published}
                                          onChange={(val) => {
                  Severity: Major
                  Found in scripts/apps/authoring-react/fields/media/config.tsx and 1 other location - About 3 hrs to fix
                  scripts/apps/authoring-react/fields/media/config.tsx on lines 76..90

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

                  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

                          const values1: Array<IDropdownOption> =
                              (() => {
                                  if (value1 == null) {
                                      return [];
                                  } else if (Array.isArray(value1)) {
                  scripts/apps/authoring-react/fields/dropdown/dropdown-manual-entry/difference.tsx on lines 25..35

                  Duplicated Code

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

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

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

                  Tuning

                  This issue has a mass of 102.

                  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

                  Severity
                  Category
                  Status
                  Source
                  Language