superdesk/superdesk-client-core

View on GitHub

Showing 3,654 of 3,654 total issues

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

export const getUiThemeFontSize = (value: IFontSizeOption) => {
    if (value === 'small') {
        return '1.4rem';
    } else if (value === 'medium') {
        return '1.6rem';
Severity: Major
Found in scripts/apps/authoring-react/authoring-react.tsx and 1 other location - About 2 hrs to fix
scripts/apps/authoring-react/authoring-react.tsx on lines 232..242

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

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 const getUiThemeFontSizeHeading = (value: IFontSizeOption) => {
    if (value === 'small') {
        return '2.3rem';
    } else if (value === 'medium') {
        return '2.8rem';
Severity: Major
Found in scripts/apps/authoring-react/authoring-react.tsx and 1 other location - About 2 hrs to fix
scripts/apps/authoring-react/authoring-react.tsx on lines 220..230

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

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

                        'item:unmarked': (notification: IMarkForUserNotification) => {
                            return {
                                body: notification.message,
                                actions: [
                                    {
Severity: Major
Found in scripts/extensions/markForUser/src/extension.tsx and 1 other location - About 2 hrs to fix
scripts/extensions/markForUser/src/extension.tsx on lines 56..66

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

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

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

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

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

Refactorings

Further Reading

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

            if (storedDraftJsState != null) {
                const val: IEditor3ValueStorage = {
                    rawContentState: storedDraftJsState[0],
                };

scripts/extensions/broadcasting/src/rundown-templates/rundown-template-item-storage-adapter.tsx on lines 125..136

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

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.previewItem = function(desk, stage, item) {
            this.getItem(desk, stage, item).click();
            this.getItem(desk, stage, item).element(by.className('icon-external')).click();
        };
Severity: Major
Found in e2e/client/specs/helpers/master_desks.ts and 1 other location - About 2 hrs to fix
e2e/client/specs/helpers/master_desks.ts on lines 87..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 75.

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 class Preview extends React.PureComponent<IProps> {
    render() {
        if (this.props.value == null) {
            return null;
        }
Severity: Major
Found in scripts/apps/authoring-react/fields/dateline/preview.tsx and 1 other location - About 2 hrs to fix
scripts/apps/authoring-react/fields/time/preview.tsx on lines 6..16

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

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

                                            itemTemplate={({entity: rundownTemplate}: {entity: IRundownTemplate}) => (
                                                rundownTemplate == null
                                                    ? (
                                                        <span>{gettext('Select template')}</span>
                                                    ) : (
scripts/extensions/broadcasting/src/rundowns/components/select-show.tsx on lines 50..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 75.

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 class Preview extends React.PureComponent<IProps> {
    render() {
        if (this.props.value == null) {
            return null;
        }
Severity: Major
Found in scripts/apps/authoring-react/fields/time/preview.tsx and 1 other location - About 2 hrs to fix
scripts/apps/authoring-react/fields/dateline/preview.tsx on lines 10..20

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

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

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

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

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

Refactorings

Further Reading

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

            if (storedDraftJsState != null) {
                const val: IEditor3ValueStorage = {
                    rawContentState: storedDraftJsState[0],
                };

scripts/extensions/broadcasting/src/rundown-templates/rundown-template-item-storage-adapter.tsx on lines 65..76

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

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

                itemTemplate={({entity: show}: {entity: IShow}) => (
                    show == null
                        ? (
                            <span>{gettext('Select show')}</span>
                        ) : (
scripts/extensions/broadcasting/src/rundowns/create-rundown-from-template.tsx on lines 155..162

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

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.editUser = function(desk, role, user) {
            this.getUser(desk, role, user).click();
            this.getUser(desk, role, user).element(by.className('icon-pencil')).click();
        };
Severity: Major
Found in e2e/client/specs/helpers/master_desks.ts and 1 other location - About 2 hrs to fix
e2e/client/specs/helpers/master_desks.ts on lines 42..45

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

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.eventListenersToRemoveBeforeUnmounting.push(
            addWebsocketEventListener('resource:deleted', (event) => {
                const {resource} = event.extra;

                /**
scripts/core/ui/components/virtual-lists/virtual-list-from-query.tsx on lines 223..237

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

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

      this.batch = function batch(fn, scope, description) {
        var _clear = bind(this, this._clear),
          _initStores = this._initStores,
          listener,
          watchObj,
Severity: Minor
Found in scripts/libs/angular-history/history.js - About 1 hr to fix

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

        render() {
            const {gettext, longFormatDateTime, getRelativeOrAbsoluteDateTime} = superdeskApi.localization;
            const {config} = superdeskApi.instance;
            const {item} = this.props;
    
    

      Function SubscribersService has 49 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export function SubscribersService(api, $q, $filter) {
          /**
           * Recursively returns all subscribers
           *
           * @return {*}
      Severity: Minor
      Found in scripts/apps/publish/services/SubscribersService.ts - About 1 hr to fix

        Function queryAssets has 49 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export function queryAssets(
            params: IAssetSearchParams,
            listStyle: ASSET_LIST_STYLE,
        ): Promise<IRestApiResponse<IAssetItem>> {
            const {gettext} = superdeskApi.localization;
        Severity: Minor
        Found in scripts/extensions/sams/src/api/assets.ts - About 1 hr to fix

          Function getInitialState has 49 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function getInitialState<T extends IBaseRestApiResponse>(
              item: {saved: T; autosaved: T},
              profile: IContentProfileV2,
              userPreferencesForFields: IStateLoaded<T>['userPreferencesForFields'],
              spellcheckerEnabled: boolean,
          Severity: Minor
          Found in scripts/apps/authoring-react/authoring-react.tsx - About 1 hr to fix

            Function getKeywordsAdapter has 49 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export function getKeywordsAdapter(): IFieldAdapter<IArticle> {
                const hasKeywordCV = sdApi.vocabularies.getAll().has('keywords');
            
                if (hasKeywordCV) {
                    return {
            Severity: Minor
            Found in scripts/apps/authoring-react/field-adapters/keywords.ts - About 1 hr to fix

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

                  render(): ReactNode {
                      return (
                          <Modal
                              contentPadding="none"
                              zIndex={1050}
              Severity: Minor
              Found in scripts/apps/authoring-react/toolbar/multi-edit-toolbar-action.tsx - About 1 hr to fix

                Function VersioningController has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function VersioningController($scope, authoring, desks, archiveService) {
                    $scope.last = null;
                    $scope.versions = null;
                    $scope.selected = null;
                    $scope.users = null;
                Severity: Minor
                Found in scripts/apps/authoring/versioning/versions/versions.ts - About 1 hr to fix
                  Severity
                  Category
                  Status
                  Source
                  Language