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

        if (q['$or'] != null) {
            q['$or'].forEach((q1: ILogicalOperator | IComparison) => {
                getQueryFieldsRecursive(q1).forEach((field) => {
                    fields.add(field);
                });
Severity: Major
Found in scripts/core/query-formatting.ts and 1 other location - About 2 hrs to fix
scripts/core/query-formatting.ts on lines 108..114

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

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 (q['$and'] != null) {
            q['$and'].forEach((q1: ILogicalOperator | IComparison) => {
                getQueryFieldsRecursive(q1).forEach((field) => {
                    fields.add(field);
                });
Severity: Major
Found in scripts/core/query-formatting.ts and 1 other location - About 2 hrs to fix
scripts/core/query-formatting.ts on lines 115..121

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

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

                                    onClick={() => {
                                        this.props.closeModal();

                                        if (this.state.selectedUserId !== undefined) {
                                            markForUserAndSend(this.state.selectedUserId);
scripts/extensions/markForUser/src/get-mark-for-user-modal.tsx on lines 98..106

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

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

                                    onClick={() => {
                                        this.props.closeModal();

                                        if (this.state.selectedUserId !== undefined) {
                                            markForUser(this.state.selectedUserId);
scripts/extensions/markForUser/src/get-mark-for-user-modal.tsx on lines 118..126

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

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

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

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

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

Refactorings

Further Reading

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

    constructor(props) {
        super(props);
        this.state = {hover: false};

        this.setHover = this.setHover.bind(this);
Severity: Major
Found in scripts/apps/search/components/ListTypeIcon.tsx and 1 other location - About 2 hrs to fix
scripts/core/ui/components/SubNav/Dropdown.tsx on lines 21..26

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

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

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

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

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

Refactorings

Further Reading

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

    constructor(props) {
        super(props);
        this.state = {open: false};
        this.toggle = this.toggle.bind(this);
        this.close = this.close.bind(this);
Severity: Major
Found in scripts/core/ui/components/SubNav/Dropdown.tsx and 1 other location - About 2 hrs to fix
scripts/apps/search/components/ListTypeIcon.tsx on lines 22..28

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

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

File CardsService.ts has 257 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import {flatMap, flattenDeep, includes, isNil} from 'lodash';
import {setFilters, IQueryParams} from 'apps/search/services/SearchService';
import {PUBLISHED_STATES} from 'apps/archive/constants';
import {ITEM_STATE} from 'apps/archive/constants';
import {
Severity: Minor
Found in scripts/apps/monitoring/services/CardsService.ts - About 2 hrs to fix

    File menu.ts has 257 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import {reactToAngular1} from 'superdesk-ui-framework';
    import {GlobalMenuHorizontal} from './GlobalMenuHorizontal';
    import {appConfig} from 'appConfig';
    import {addInternalEventListener} from 'core/internal-events';
    import {IFullWidthPageCapabilityConfiguration} from 'superdesk-api';
    Severity: Minor
    Found in scripts/core/menu/menu.ts - About 2 hrs to fix

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

          render(): ReactNode {
              return (
                  <div
                      style={{
                          marginBlockStart: 8,
      Severity: Major
      Found in scripts/apps/authoring-react/field-adapters/sign_off.tsx - About 2 hrs to fix

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

            render() {
                const {
                    renditions,
                    title,
                    removeButton,
        Severity: Major
        Found in scripts/apps/authoring-react/fields/media/media-carousel/audio.tsx - About 2 hrs to fix

          Function MultiService has 54 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export function MultiService($rootScope) {
              var items = [];
              var self = this;
              var findItem = (item) => _.find(items, (i) => i._id === item._id && i._current_version === item._current_version);
          
          
          Severity: Major
          Found in scripts/apps/archive/services/MultiService.ts - About 2 hrs to fix

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

                    link: function(scope) {
                        scope.diff = null;
            
                        // this is triggered from MacrosController.call and apply the changes to body field
                        scope.$on('macro:diff', (evt, diff) => {
            Severity: Major
            Found in scripts/apps/authoring/macros/macros.ts - About 2 hrs to fix

              Function ItemLock has 54 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export function ItemLock(api, lock, privileges, desks) {
                  return {
                      templateUrl: 'scripts/apps/archive/views/item-lock.html',
                      scope: {item: '='},
                      link: function(scope) {
              Severity: Major
              Found in scripts/apps/archive/directives/ItemLock.ts - About 2 hrs to fix

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

                    render() {
                        return (
                            <Modal
                                visible
                                zIndex={1050}

                  Function publish has 54 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      const publish = () => {
                          const errors = [];
                  
                          const addErrorForItem = (item, err) => {
                              const itemName = item.headline || item.slugline || item._id;
                  Severity: Major
                  Found in scripts/apps/search/controllers/get-multi-actions.tsx - About 2 hrs to fix

                    Function saveChanges has 54 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                                scope.saveChanges = () => {
                                    const {user_subscriptions, desk_subscriptions} = scope.savedSearch.subscribers;
                                    const {subscriptionInCreateOrEditMode} = scope.wrapper;
                    
                                    let nextUserSubscriptions = scope.savedSearch.subscribers.user_subscriptions;
                    Severity: Major
                    Found in scripts/apps/search/directives/SavedSearchManageSubscribers.ts - About 2 hrs to fix

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

                          render() {
                              if (this.state.selectedUser === 'loading') {
                                  return null;
                              }
                      
                      
                      Severity: Major
                      Found in scripts/core/ui/components/SelectUser.tsx - About 2 hrs to fix

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

                                render() {
                                    if (this.state.loading) {
                                        return null;
                                    }
                        
                        

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

                              render() {
                                  const {groups, getToggleElement} = this.props;
                                  const onClick = () => this.setState({open: !this.state.open});
                          
                                  return (
                          Severity: Major
                          Found in scripts/core/ui/components/dropdown-tree.tsx - About 2 hrs to fix

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

                                render() {
                                    const {value, field, remove, onChange, label, readOnly, iframelyKey, onFocus, ...props} = this.props;
                            
                                    const showLink = this.state.title &&
                                        !props.message &&
                            Severity: Major
                            Found in scripts/core/ui/components/Form/LinkInput.tsx - About 2 hrs to fix
                              Severity
                              Category
                              Status
                              Source
                              Language