superdesk/superdesk-client-core

View on GitHub

Showing 3,654 of 3,654 total issues

Function backendRequest has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

export function backendRequest(params, callback, retry = 3) {
    let cb = callback || function() { /* no-op */ };
    let ttl = retry || 0;

    if (params.uri) {
Severity: Minor
Found in e2e/client/specs/helpers/backend.ts - About 1 hr to fix

Cognitive Complexity

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

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

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

Further reading

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

                            <Button
                                text={gettext('toggle difference')}
                                onClick={() => {
                                    this.setState({differenceColumnShown: !this.state.differenceColumnShown});
                                }}
scripts/apps/authoring-react/compare-articles/compare-articles.tsx on lines 134..140
scripts/apps/authoring-react/compare-articles/compare-articles.tsx on lines 142..148

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

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 (useFullButtonText) {
                menu.element(by.buttonText(action)).click();
            } else {
                menu.all(by.partialButtonText(action)).first().click();
            }
Severity: Major
Found in e2e/client/specs/helpers/monitoring.ts and 1 other location - About 1 hr to fix
e2e/client/specs/helpers/content.ts on lines 78..84

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

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

ActionBar.propTypes = {
    svc: PropTypes.object.isRequired,
    onSave: PropTypes.func,
    onCancel: PropTypes.func,
    readOnly: PropTypes.bool,
Severity: Major
Found in scripts/apps/contacts/components/Form/ActionBar.tsx and 1 other location - About 1 hr to fix
scripts/core/ui/components/List/Column.tsx on lines 27..34

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

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 (useFullLinkText) {
                menu.element(by.buttonText(action)).click();
            } else {
                menu.all(by.partialButtonText(action))
                    .first()
Severity: Major
Found in e2e/client/specs/helpers/content.ts and 1 other location - About 1 hr to fix
e2e/client/specs/helpers/monitoring.ts on lines 435..439

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

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 function ctrlAltKey(key) {
    var Key = protractor.Key;

    browser.actions().sendKeys(Key.chord(Key.CONTROL, Key.ALT, key))
        .perform();
Severity: Major
Found in e2e/client/specs/helpers/utils.ts and 1 other location - About 1 hr to fix
e2e/client/specs/helpers/utils.ts on lines 138..143

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

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

Column.propTypes = {
    children: PropTypes.node.isRequired,
    grow: PropTypes.bool,
    border: PropTypes.bool,
    noPadding: PropTypes.bool,
Severity: Major
Found in scripts/core/ui/components/List/Column.tsx and 1 other location - About 1 hr to fix
scripts/apps/contacts/components/Form/ActionBar.tsx on lines 32..39

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

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

                        onTrigger: () => {
                            const nextValue = true;

                            this.setState({
                                ...state,
Severity: Major
Found in scripts/apps/authoring-react/authoring-react.tsx and 1 other location - About 1 hr to fix
scripts/apps/authoring-react/authoring-react.tsx on lines 1195..1210

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

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 function ctrlShiftKey(key) {
    var Key = protractor.Key;

    browser.actions().sendKeys(Key.chord(Key.CONTROL, Key.SHIFT, key))
        .perform();
Severity: Major
Found in e2e/client/specs/helpers/utils.ts and 1 other location - About 1 hr to fix
e2e/client/specs/helpers/utils.ts on lines 160..165

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

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

                            'ctrl+shift+y': () => {
                                const nextValue = true;

                                this.setState({
                                    ...state,
Severity: Major
Found in scripts/apps/authoring-react/authoring-react.tsx and 1 other location - About 1 hr to fix
scripts/apps/authoring-react/authoring-react.tsx on lines 1178..1193

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

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

    handleSave() {
        const {dataApi} = this.props.superdesk;
        const {gettext} = this.props.superdesk.localization;
        const {x, y, width, height} = this.state.transformations.crop;
        const crop = this.getCropRotate({x: x, y: y, width: width, height: height});
Severity: Minor
Found in scripts/extensions/videoEditor/src/VideoEditor.tsx - About 1 hr to fix

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

        render() {
            if (this.state.actions == null) {
                return (
                    <MoreActionsButton
                        aria-label={gettext('Actions menu')}

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

          render() {
              if (!this.state.initialized) {
                  return null;
              }
      
      
      Severity: Minor
      Found in scripts/apps/authoring-react/toolbar/highlights-modal.tsx - About 1 hr to fix

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

                link: function(scope, element) {
                    var updated = false;
        
                    element.sortable({
                        items: '.sort-item',
        Severity: Minor
        Found in scripts/apps/monitoring/directives/SortGroups.ts - About 1 hr to fix

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

              render() {
                  const {attachment, differenceType} = this.props;
          
                  const change = ((): IChange | null => {
                      if (differenceType === 'added') {
          Severity: Minor
          Found in scripts/apps/authoring-react/fields/attachments/difference-row.tsx - About 1 hr to fix

            Function IngestRoutingFilter has 43 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export function IngestRoutingFilter() {
                /**
                 * Creates an utility method on the built-in RegExp object used for
                 * escaping arbitrary strings so that they can be safely used in
                 * dynamically created regular expressions patterns.
            Severity: Minor
            Found in scripts/apps/ingest/directives/IngestRoutingFilter.ts - About 1 hr to fix

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

                      link: function(scope, elem, attr) {
                          scope._editable = true;
              
                          var itemToDelete = {_id: scope.item._id, _etag: scope.item._etag};
              
              
              Severity: Minor
              Found in scripts/apps/archive/directives/ArchivedItemKill.ts - About 1 hr to fix

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

                        link: function(scope, elem) {
                            scope.$watch('item', reloadData);
                            scope.isCorrectionWorkflowEnabled = appConfig?.corrections_workflow;
                            scope.loading = true;
                
                
                Severity: Minor
                Found in scripts/apps/archive/directives/MediaMetadata.ts - About 1 hr to fix

                  Function setupTansa has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  export const setupTansa = () => {
                      if (!appConfig?.tansa?.base_url) {
                          console.warn('tansa is not configured properly');
                          appConfig.features.useTansaProofing = false;
                          return;
                  Severity: Minor
                  Found in scripts/apps/tansa/index.ts - About 1 hr to fix

                    Function TranslationService has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    export function TranslationService(
                        api,
                        $rootScope,
                        notify,
                        authoringWorkspace: AuthoringWorkspaceService,
                    Severity: Minor
                    Found in scripts/apps/translations/services/TranslationService.ts - About 1 hr to fix
                      Severity
                      Category
                      Status
                      Source
                      Language