superdesk/superdesk-client-core

View on GitHub

Showing 3,654 of 3,654 total issues

Function WorkspaceService has 137 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export function WorkspaceService(api, desks, session, preferences, $q, modal) {
    this.active = null;
    this.save = save;
    this.delete = _delete;
    this.setActive = setActiveWorkspace;
Severity: Major
Found in scripts/apps/workspace/services/WorkspaceService.ts - About 5 hrs to fix

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

        render() {
            const {items, tabs, onClose, onError, onDataChange} = this.props;
            const {activeTab} = this.state;
            const markupV2 = authoringReactViewEnabled && this.props.markupV2 === true;
            const handleUnsavedChanges = this.props.handleUnsavedChanges ?? handleUnsavedChangesDefault;
    Severity: Major
    Found in scripts/core/interactive-article-actions-panel/index-ui.tsx - About 5 hrs to fix

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

          it('can report if text contains multiple spaces', inject((spellcheck, api, $rootScope) => {
              // Test with existing words in dictionary
              var p = createParagraph('Foo what? Foo is foo.');
      
              spellcheck.errors(p).then(assignErrors);
      Severity: Major
      Found in scripts/core/spellcheck/spellcheck.spec.ts and 2 other locations - About 5 hrs to fix
      scripts/core/spellcheck/spellcheck.spec.ts on lines 109..124
      scripts/core/spellcheck/spellcheck.spec.ts on lines 172..187

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

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

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

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

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

      Refactorings

      Further Reading

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

          it('can avoid reporting error if a valid word is in middle of sentence and starts with capital letter',
              inject((spellcheck, api, $rootScope) => {
                  // Test with existing words in dictionary
                  var p = createParagraph('Foo what, Foo is foo.');
      
      
      Severity: Major
      Found in scripts/core/spellcheck/spellcheck.spec.ts and 2 other locations - About 5 hrs to fix
      scripts/core/spellcheck/spellcheck.spec.ts on lines 109..124
      scripts/core/spellcheck/spellcheck.spec.ts on lines 126..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 144.

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

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

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

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

      Refactorings

      Further Reading

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

          it('can report error if word comes after .|?|!|: (i.e, after : or at new sentence) starts with small letter',
              inject((spellcheck, api, $rootScope) => {
              // Test with existing words in dictionary
                  var p = createParagraph('Foo what? Foo is foo. Foo is foo! What foo: Foo?');
      
      
      Severity: Major
      Found in scripts/core/spellcheck/spellcheck.spec.ts and 2 other locations - About 5 hrs to fix
      scripts/core/spellcheck/spellcheck.spec.ts on lines 126..140
      scripts/core/spellcheck/spellcheck.spec.ts on lines 172..187

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

      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

                      <p className="sd-text__date-and-author sd-margin-b--0">
                          {updatedUser == null ? (
                              <time title={updateDateLong}>
                                  {gettext('Updated {{ datetime }}', {datetime: updateDate})}
                              </time>
      scripts/extensions/sams/src/components/common/versionUserDateLines.tsx on lines 81..96

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

      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

                      <p className="sd-text__date-and-author sd-margin-b--0">
                          {createdUser == null ? (
                              <time title={createdDateLong}>
                                  {gettext('Created {{ datetime }}', {datetime: createdDate})}
                              </time>
      scripts/extensions/sams/src/components/common/versionUserDateLines.tsx on lines 97..112

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

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

          render() {
              const {gettext} = this.props.superdesk.localization;
              const {getClass} = this.props.superdesk.utilities.CSS;
              const degree = this.state.transformations.degree + 'deg';
              const videoRef = this.videoRef.current;
      Severity: Major
      Found in scripts/extensions/videoEditor/src/VideoEditor.tsx - About 5 hrs to fix

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

            render() {
                const {
                    contentProfiles,
                    primaryColumnShown,
                    secondaryColumnShown,
        Severity: Major
        Found in scripts/apps/authoring-react/compare-articles/compare-articles.tsx - About 5 hrs to fix

          Function getInlineToolbarActions has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
          Open

          function getInlineToolbarActions(
              options: IExposedFromAuthoring<IArticle>,
              action?: IAuthoringActionType,
          ): IAuthoringOptions<IArticle> {
              const {
          Severity: Minor
          Found in scripts/apps/authoring-react/authoring-angular-integration.tsx - About 5 hrs to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          Function UserEditDirective has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
          Open

          export function UserEditDirective(api, notify, usersService, userList, session, _,
              langmap, $location, $route, superdesk, features, asset, privileges, desks, keyboardManager,
              gettextCatalog, metadata, modal, $q) {
              return {
                  templateUrl: asset.templateUrl('apps/users/views/edit-form.html'),
          Severity: Minor
          Found in scripts/apps/users/directives/UserEditDirective.ts - About 5 hrs to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          Function APIProvider has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
          Open

          function APIProvider() {
              var apis = {};
          
              /**
               * @ngdoc method
          Severity: Minor
          Found in scripts/core/api/api-service.ts - About 5 hrs to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

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

              render() {
                  const config = getConfigWithDefaults(this.props.config);
          
                  const checkbox = (
                      <Switch
          Severity: Major
          Found in scripts/extensions/datetimeField/src/editor.tsx - About 5 hrs to fix

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

                render() {
                    if (this.state.ready !== true) {
                        return null;
                    }
            
            
            Severity: Major
            Found in scripts/apps/authoring-react/fields/editor3/editor.tsx - About 5 hrs to fix

              Function IngestRoutingContent has 135 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export function IngestRoutingContent(api, notify, modal, contentFilters, $filter) {
                  return {
                      templateUrl: 'scripts/apps/ingest/views/settings/ingest-routing-content.html',
                      link: function(scope) {
                          let _orig = null, _origRule = null, _new = false;
              Severity: Major
              Found in scripts/apps/ingest/directives/IngestRoutingContent.ts - About 5 hrs to fix

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

                                {
                                    (descriptionInput != null || titleInput != null) && (
                                        <div style={{padding: mediaDetailsPadding}}>
                                            <Spacer v gap="16" noWrap>
                                                {
                scripts/apps/authoring-react/fields/media/media-carousel/video.tsx on lines 52..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 143.

                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

                                {
                                    (descriptionInput != null || titleInput != null) && (
                                        <div style={{padding: mediaDetailsPadding}}>
                                            <Spacer v gap="16" noWrap>
                                                {
                scripts/apps/authoring-react/fields/media/media-carousel/audio.tsx on lines 57..75

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

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

                export function DictionaryService(api, urls, session, Upload, $q) {
                    this.dictionaries = null;
                    this.currDictionary = null;
                
                    this.getActive = getActive;
                Severity: Major
                Found in scripts/apps/dictionaries/services/DictionaryService.ts - About 5 hrs to fix

                  Function ProductsConfigController has 133 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  export function ProductsConfigController($scope: IScope, notify, api, products, modal,
                      subscribersService, metadata, $filter) {
                      $scope.testLookup = {};
                      $scope.productLookup = {};
                      $scope.loading = false;
                  Severity: Major
                  Found in scripts/apps/products/controllers/ProductsConfigController.ts - About 5 hrs to fix

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

                            link: function(scope, element, attrs, ngModel) {
                                // cache a reference to the DOM element
                                var ta = element[0],
                                    $ta = element;
                    
                    
                    Severity: Major
                    Found in scripts/core/ui/autoheight-directive.ts - About 5 hrs to fix
                      Severity
                      Category
                      Status
                      Source
                      Language