superdesk/superdesk-client-core

View on GitHub

Showing 3,654 of 3,654 total issues

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

        this.selectDesk = function(selectId, deskName) {
            element(by.id(selectId)).element(by.css('option[label="' + deskName + '"]')).click();
        };
Severity: Major
Found in e2e/client/specs/helpers/search.ts and 2 other locations - About 1 hr to fix
e2e/client/specs/helpers/search.ts on lines 451..453
e2e/client/specs/helpers/search.ts on lines 460..462

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

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

    constructor(props: IProps) {
        super(props);

        this.getEditor3Fields = this.getEditor3Fields.bind(this);
        this.getResolvedSuggestions = this.getResolvedSuggestions.bind(this);
scripts/apps/authoring-react/toolbar/mark-for-desks/mark-for-desks-popover.tsx on lines 15..20
scripts/apps/search/components/fields/translations.tsx on lines 12..17
scripts/extensions/broadcasting/src/rundowns/rundowns-list.tsx on lines 73..78

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

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

export const Panel: React.StatelessComponent<any> = ({children, className}) => (
    <div
        className={classNames(
            'sd-preview-panel',
            className,
Severity: Major
Found in scripts/core/ui/components/Preview/Panel.tsx and 3 other locations - About 1 hr to fix
scripts/core/ui/components/Dropdown/Label.tsx on lines 11..20
scripts/core/ui/components/SidePanel/Footer.tsx on lines 10..19
scripts/core/ui/components/SidePanel/SubHeader.tsx on lines 10..19

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

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

    constructor(props: IProps) {
        super(props);

        this.renderOriginalArticle = this.renderOriginalArticle.bind(this);
        this.renderTranslations = this.renderTranslations.bind(this);
Severity: Major
Found in scripts/apps/search/components/fields/translations.tsx and 3 other locations - About 1 hr to fix
scripts/apps/authoring-react/article-widgets/suggestions.tsx on lines 143..148
scripts/apps/authoring-react/toolbar/mark-for-desks/mark-for-desks-popover.tsx on lines 15..20
scripts/extensions/broadcasting/src/rundowns/rundowns-list.tsx on lines 73..78

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

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.selectCreator = function(selectId, userName) {
            element(by.id(selectId)).element(by.css('option[label="' + userName + '"]')).click();
        };
Severity: Major
Found in e2e/client/specs/helpers/search.ts and 2 other locations - About 1 hr to fix
e2e/client/specs/helpers/search.ts on lines 423..425
e2e/client/specs/helpers/search.ts on lines 460..462

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

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

export const Footer: React.StatelessComponent<any> = ({children, className}) => (
    <div
        className={classNames(
            'side-panel__footer',
            className,
Severity: Major
Found in scripts/core/ui/components/SidePanel/Footer.tsx and 3 other locations - About 1 hr to fix
scripts/core/ui/components/Dropdown/Label.tsx on lines 11..20
scripts/core/ui/components/Preview/Panel.tsx on lines 10..19
scripts/core/ui/components/SidePanel/SubHeader.tsx on lines 10..19

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

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

export const Label: React.StatelessComponent<any> = ({children, className}) => (
    <li
        className={classNames(
            'dropdown__menu-label',
            className,
Severity: Major
Found in scripts/core/ui/components/Dropdown/Label.tsx and 3 other locations - About 1 hr to fix
scripts/core/ui/components/Preview/Panel.tsx on lines 10..19
scripts/core/ui/components/SidePanel/Footer.tsx on lines 10..19
scripts/core/ui/components/SidePanel/SubHeader.tsx on lines 10..19

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

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

        ignoreWord: {
            label: gettext('Ignore word'),
            perform: (warning: ISpellcheckWarning) => ng.getService('spellcheck').then((_spellcheck) => {
                return _spellcheck.addWord(warning.text, true);
            }),
scripts/core/editor3/components/spellchecker/default-spellcheckers.tsx on lines 52..57

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

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

                        httpRequestJsonLocal<IRestApiResponse<IUser>>({
                            method: 'GET',
                            path: '/users',
                            urlParams: {
                                where: {display_name: term},
Severity: Major
Found in scripts/apps/authoring-react/field-adapters/sign_off.tsx and 1 other location - About 1 hr to fix
scripts/apps/authoring-react/field-adapters/place.ts on lines 29..43

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

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

        addToDictionary: {
            label: gettext('Add to dictionary'),
            perform: (warning: ISpellcheckWarning) => ng.getService('spellcheck').then((_spellcheck) => {
                return _spellcheck.addWord(warning.text, false);
            }),
scripts/core/editor3/components/spellchecker/default-spellcheckers.tsx on lines 58..63

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

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

                filters.push({or: [
                    {terms: {'subject.qcode': JSON.parse(params[key])}},
                    {terms: {'subject.parent': JSON.parse(params[key])}},
                ]});
Severity: Major
Found in scripts/apps/search/services/SearchService.ts and 1 other location - About 1 hr to fix
scripts/apps/content-api/services/ContentAPISearchService.ts on lines 51..54

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

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

            filters.push({or: [
                {terms: {'subject.code': JSON.parse(params.subject)}},
                {terms: {'subject.parent': JSON.parse(params.subject)}},
            ]});
scripts/apps/search/services/SearchService.ts on lines 226..229

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

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

    onRemove(event: React.MouseEvent<HTMLAnchorElement>) {
        if (this.props.remove != null) {
            event.stopPropagation();

            this.props.remove();
scripts/extensions/sams/src/ui/grid/GritItemThumb.tsx on lines 16..21

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

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

    onChange(e: React.MouseEvent<HTMLDivElement>) {
        if (this.props.toggleSelected != null) {
            e.stopPropagation();
            this.props.toggleSelected();
        }
Severity: Major
Found in scripts/extensions/sams/src/ui/grid/GritItemThumb.tsx and 1 other location - About 1 hr to fix
scripts/extensions/sams/src/components/assets/assetGridItem.tsx on lines 53..59

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

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

                        httpRequestJsonLocal<IRestApiResponse<IGeoName>>({
                            method: 'GET',
                            path: '/places_autocomplete',
                            urlParams: {
                                lang: language,
Severity: Major
Found in scripts/apps/authoring-react/field-adapters/place.ts and 1 other location - About 1 hr to fix
scripts/apps/authoring-react/field-adapters/sign_off.tsx on lines 45..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 68.

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

function getBaseAssetAction(action: ASSET_ACTIONS): IBaseAssetAction {
    const {gettext} = superdeskApi.localization;
    const {assertNever} = superdeskApi.helpers;

    switch (action) {
Severity: Minor
Found in scripts/extensions/sams/src/utils/assets.ts - About 1 hr to fix

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

        constructor(props: IProps) {
            super(props);
            this.videoRef = React.createRef();
            this.reactCropRef = React.createRef();
            this.intervalThumbnails = 0;
    Severity: Minor
    Found in scripts/extensions/videoEditor/src/VideoEditor.tsx - About 1 hr to fix

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

          render(): JSX.Element {
              // loading
              if (this.state.packages == null) {
                  return null;
              }
      Severity: Minor
      Found in scripts/apps/authoring-react/packages.tsx - About 1 hr to fix

        Function DeskConfigModal has 41 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export function DeskConfigModal(metadata, content, templates, api) {
            return {
                scope: {
                    modalActive: '=active',
                    desk: '=',
        Severity: Minor
        Found in scripts/apps/desks/directives/DeskConfigModal.ts - About 1 hr to fix

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

              componentDidMount() {
                  document.addEventListener('keydown', this.handleKeydown);
                  document.addEventListener('click', this.handleClickOutside);
          
                  if (this.dom.root) {
          Severity: Minor
          Found in scripts/apps/contacts/components/Popup/Popup.tsx - About 1 hr to fix
            Severity
            Category
            Status
            Source
            Language