superdesk/superdesk-client-core

View on GitHub

Showing 3,654 of 3,654 total issues

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

    constructor(props) {
        super(props);

        const {data, annotationTypes} = props;
        const editing = typeof data.annotation === 'object';
Severity: Minor
Found in scripts/core/editor3/components/annotations/AnnotationInput.tsx - About 1 hr to fix

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

    export function getInitialContent(props): ContentState {
        // support standalone instance of editor3 which is not connected to item field
        if (props.editorState != null) {
            var contentState = convertFromRaw(
                props.editorState instanceof Array
    Severity: Minor
    Found in scripts/core/editor3/store/index.ts - About 1 hr to fix

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

          componentDidMount() {
              this._mounted = true;
      
              this.monitoringState.init().then(() => {
                  if (this._mounted) {
      Severity: Minor
      Found in scripts/core/ArticlesListV2.tsx - About 1 hr to fix

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

                    (changes) => {
                        if (this.lazyLoaderRef == null) {
                            return;
                        }
        
        
        Severity: Minor
        Found in scripts/core/ArticlesListV2.tsx - About 1 hr to fix

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

              fetchItems(): Promise<void> {
                  const {resources} = this.props;
          
                  function toPair(resource: string, res: unknown): [string, unknown] {
                      return [resource, res];
          Severity: Minor
          Found in scripts/core/with-resources.tsx - About 1 hr to fix

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

                this.errors = function check(node) {
                    return getDict().then((d) => {
                        var errors = [],
                            regexp = /[0-9a-zA-Z\u00C0-\u1FFF\u2C00-\uD7FF]+/g,
                            dblSpacesRegExp = /\S(\s{2,})\S/g,
            Severity: Minor
            Found in scripts/core/spellcheck/spellcheck.ts - About 1 hr to fix

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

              export function fetchRelatedEntities(
                  entitiesToFetch: IEntitiesToFetch,
                  abortSignal: AbortSignal,
              ): Promise<IRelatedEntities> {
                  return new Promise((resolve) => {
              Severity: Minor
              Found in scripts/core/getRelatedEntities.ts - About 1 hr to fix

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

                        this.getKeywords = function() {
                            return element(by.css('[data-field="keywords"]'))
                                .all(by.repeater('t in item[field] track by t'))
                                .first().getText();
                        };
                Severity: Major
                Found in e2e/client/specs/helpers/authoring.ts and 2 other locations - About 1 hr to fix
                e2e/client/specs/helpers/authoring.ts on lines 519..521
                e2e/client/specs/helpers/authoring.ts on lines 1004..1006

                Duplicated Code

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

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

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

                Tuning

                This issue has a mass of 61.

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

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

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

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

                Refactorings

                Further Reading

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

                        scope: {
                            item: '=',
                            validator: '=',
                            placeholder: '=',
                            disabled: '=',
                scripts/apps/authoring/authoring/directives/ItemCarouselDirective.ts on lines 61..73
                scripts/apps/authoring/metadata/metadata.ts on lines 344..356

                Duplicated Code

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

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

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

                Tuning

                This issue has a mass of 61.

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

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

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

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

                Refactorings

                Further Reading

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

                                <AttachmentsList
                                    attachments={this.props.attachments}
                                    readOnly={this.props.readOnly}
                                    editAttachment={this.editAttachment}
                                    removeAttachment={this.props.removeAttachment}
                scripts/core/ui/components/Form/SelectMetaTermsInput/SelectFieldPopup.tsx on lines 266..304
                scripts/core/ui/components/Form/SelectMetaTermsInput/SelectFieldPopup.tsx on lines 316..379

                Duplicated Code

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

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

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

                Tuning

                This issue has a mass of 61.

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

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

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

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

                Refactorings

                Further Reading

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

                export const TextAreaInput: React.StatelessComponent<any> = ({
                    field,
                    value,
                    label,
                    onChange,
                Severity: Major
                Found in scripts/core/ui/components/Form/TextAreaInput.tsx and 2 other locations - About 1 hr to fix
                scripts/core/ui/components/Form/Input.tsx on lines 9..49
                scripts/core/ui/components/Nav/Button.tsx on lines 12..47

                Duplicated Code

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

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

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

                Tuning

                This issue has a mass of 61.

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

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

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

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

                Refactorings

                Further Reading

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

                            <Popup
                                close={this.props.onCancel}
                                target={this.props.target}
                                onKeyDown={this.onKeyDown}
                                popupContainer={this.props.popupContainer}
                scripts/apps/authoring/attachments/AttachmentsWidgetComponent.tsx on lines 90..95
                scripts/core/ui/components/Form/SelectMetaTermsInput/SelectFieldPopup.tsx on lines 316..379

                Duplicated Code

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

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

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

                Tuning

                This issue has a mass of 61.

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

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

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

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

                Refactorings

                Further Reading

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

                            <Popup
                                close={this.props.onCancel}
                                target={this.props.target}
                                onKeyDown={this.onKeyDown}
                                popupContainer={this.props.popupContainer}
                scripts/apps/authoring/attachments/AttachmentsWidgetComponent.tsx on lines 90..95
                scripts/core/ui/components/Form/SelectMetaTermsInput/SelectFieldPopup.tsx on lines 266..304

                Duplicated Code

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

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

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

                Tuning

                This issue has a mass of 61.

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

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

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

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

                Refactorings

                Further Reading

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

                export const Input: React.StatelessComponent<any> = ({
                    field,
                    type,
                    value,
                    onChange,
                Severity: Major
                Found in scripts/core/ui/components/Form/Input.tsx and 2 other locations - About 1 hr to fix
                scripts/core/ui/components/Form/TextAreaInput.tsx on lines 14..46
                scripts/core/ui/components/Nav/Button.tsx on lines 12..47

                Duplicated Code

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

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

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

                Tuning

                This issue has a mass of 61.

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

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

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

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

                Refactorings

                Further Reading

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

                        return samsApi.assets.unlockAsset(asset, {})
                            .then((unlockedAsset: Partial<IAssetItem>) => {
                                dispatch(updateAssetInStore(unlockedAsset, asset._id));
                                const getassets = getAssets(getState());
                
                
                Severity: Major
                Found in scripts/extensions/sams/src/store/assets/actions.ts and 2 other locations - About 1 hr to fix
                scripts/extensions/sams/src/store/assets/actions.ts on lines 245..251
                scripts/extensions/sams/src/store/assets/actions.ts on lines 261..267

                Duplicated Code

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

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

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

                Tuning

                This issue has a mass of 61.

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

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

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

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

                Refactorings

                Further Reading

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

                        this.getPubStatus = function() {
                            return element(by.css('[ng-if="item.pubstatus"]')).all(by.className('data')).first().getText();
                        };
                Severity: Major
                Found in e2e/client/specs/helpers/authoring.ts and 2 other locations - About 1 hr to fix
                e2e/client/specs/helpers/authoring.ts on lines 513..517
                e2e/client/specs/helpers/authoring.ts on lines 1004..1006

                Duplicated Code

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

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

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

                Tuning

                This issue has a mass of 61.

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

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

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

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

                Refactorings

                Further Reading

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

                        return samsApi.assets.unlockAsset(asset, {'force': true})
                            .then((unlockedAsset: Partial<IAssetItem>) => {
                                dispatch(updateAssetInStore(unlockedAsset, asset._id));
                                const getassets = getAssets(getState());
                
                
                Severity: Major
                Found in scripts/extensions/sams/src/store/assets/actions.ts and 2 other locations - About 1 hr to fix
                scripts/extensions/sams/src/store/assets/actions.ts on lines 233..239
                scripts/extensions/sams/src/store/assets/actions.ts on lines 261..267

                Duplicated Code

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

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

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

                Tuning

                This issue has a mass of 61.

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

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

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

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

                Refactorings

                Further Reading

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

                        this.getItemSource = function() {
                            return element(by.className('authoring-header__general-info')).all(by.id('item-source')).first().getText();
                        };
                Severity: Major
                Found in e2e/client/specs/helpers/authoring.ts and 2 other locations - About 1 hr to fix
                e2e/client/specs/helpers/authoring.ts on lines 513..517
                e2e/client/specs/helpers/authoring.ts on lines 519..521

                Duplicated Code

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

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

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

                Tuning

                This issue has a mass of 61.

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

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

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

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

                Refactorings

                Further Reading

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

                        scope: {
                            allowAudio: '<',
                            allowPicture: '<',
                            allowVideo: '<',
                            editable: '<',
                scripts/apps/authoring/media/MediaMetadataEditorDirective.ts on lines 6..18
                scripts/apps/authoring/metadata/metadata.ts on lines 344..356

                Duplicated Code

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

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

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

                Tuning

                This issue has a mass of 61.

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

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

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

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

                Refactorings

                Further Reading

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

                    this.getSelectedFileTypes = function(): string {
                        return this.activeFilters.fileType.length === 0 ? null : JSON.stringify(this.activeFilters.fileType);
                    };
                Severity: Major
                Found in scripts/apps/monitoring/controllers/AggregateCtrl.ts and 1 other location - About 1 hr to fix
                scripts/apps/monitoring/controllers/AggregateCtrl.ts on lines 372..375

                Duplicated Code

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

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

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

                Tuning

                This issue has a mass of 61.

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

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

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

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

                Refactorings

                Further Reading

                Severity
                Category
                Status
                Source
                Language