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.eventListenersToRemoveBeforeUnmounting.push(
            addWebsocketEventListener(
                'resource:updated',
                (event: IWebsocketMessage<IResourceUpdateEvent>) => {
                    const {resource, _id, fields} = event.extra;
Severity: Major
Found in scripts/core/ArticlesListV2.tsx and 2 other locations - About 3 hrs to fix
scripts/apps/search/components/ItemListAngularWrapper.tsx on lines 224..233
scripts/core/itemList/items-list-limited.tsx on lines 97..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 99.

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 FileUploadModal.tsx has 299 lines of code (exceeds 250 allowed). Consider refactoring.
Open

// External modules
import * as React from 'react';

// Types
import {superdeskApi} from '../apis';
Severity: Minor
Found in scripts/extensions/sams/src/containers/FileUploadModal.tsx - About 3 hrs to fix

    VideoEditor has 27 functions (exceeds 20 allowed). Consider refactoring.
    Open

    export class VideoEditor extends React.Component<IProps, IState> {
        private videoRef: React.RefObject<HTMLVideoElement>;
        private reactCropRef: React.RefObject<ReactCrop>;
        private reactCropInitImage: string;
        private intervalThumbnails: number;
    Severity: Minor
    Found in scripts/extensions/videoEditor/src/VideoEditor.tsx - About 3 hrs to fix

      Function activate has 79 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          activate: (superdesk: ISuperdesk) => {
              const {gettext} = superdesk.localization;
      
              return superdesk.session.getCurrentUser().then((user) => {
                  const personalSpaceSections: Array<IPersonalSpaceSection> = [
      Severity: Major
      Found in scripts/extensions/markForUser/src/extension.tsx - About 3 hrs to fix

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

                render() {
                    const {articles, desks} = this.state;
        
                    if (articles === null || desks == null) {
                        return null;
        Severity: Major
        Found in scripts/extensions/markForUser/src/get-marked-for-me-component.tsx - About 3 hrs to fix

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

                  link: function(scope, elem) {
                      scope.data = null;
                      scope.error = null;
                      scope.userLookup = desks.userLookup;
                      scope.label = null;
          Severity: Major
          Found in scripts/apps/packaging/directives/PackageItemPreview.ts - About 3 hrs to fix

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

                    link: function(scope, element, attrs, ctrl) {
                        var MODEL_TIME_FORMAT = appConfig.model.timeformat;
                        var VIEW_TIME_FORMAT = appConfig.view.timeformat || MODEL_TIME_FORMAT;
                        var ESC = 27;
                        var DOWN_ARROW = 40;
            Severity: Major
            Found in scripts/core/ui/ui.ts - About 3 hrs to fix

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

              export const getLookupFields = () => [
                  {name: 'mobile', label: gettext('mobile')},
                  {name: 'contact_phone', label: gettext('phone')},
                  {name: 'contact_email', label: gettext('email')},
                  {name: 'twitter', label: gettext('twitter')},
              Severity: Major
              Found in scripts/apps/contacts/constants.ts and 2 other locations - About 3 hrs to fix
              scripts/apps/content-api/services/ContentAPISearchService.ts on lines 27..34
              scripts/apps/legal-archive/services/LegalArchiveService.ts on lines 23..30

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

              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

                  var sortOptions = [
                      {field: 'versioncreated', label: gettext('Updated')},
                      {field: 'firstcreated', label: gettext('Created')},
                      {field: 'urgency', label: gettext('Urgency')},
                      {field: 'anpa_category.name', label: gettext('Category')},
              Severity: Major
              Found in scripts/apps/legal-archive/services/LegalArchiveService.ts and 2 other locations - About 3 hrs to fix
              scripts/apps/contacts/constants.ts on lines 46..53
              scripts/apps/content-api/services/ContentAPISearchService.ts 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 98.

              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.sortOptions = [
                          {field: 'versioncreated', label: gettext('Updated')},
                          {field: 'firstcreated', label: gettext('Created')},
                          {field: 'urgency', label: gettext('Urgency')},
                          {field: 'priority', label: gettext('Priority')},
              scripts/apps/contacts/constants.ts on lines 46..53
              scripts/apps/legal-archive/services/LegalArchiveService.ts on lines 23..30

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

              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 getValueTemplate(config: IDropdownConfigRemoteSource): React.ComponentType<{item: unknown}> {
                  function defaultTemplate({item}) {
                      return (
                          <span>{config.getLabel(item)}</span>
                      );
              scripts/apps/authoring-react/fields/dropdown/dropdown-tree/get-value-template.tsx on lines 4..12

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

              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 getValueTemplate(config: IDropdownTreeConfig): React.ComponentType<{item: unknown}> {
                  function defaultTemplate({item}) {
                      return (
                          <span>{config.getLabel(item)}</span>
                      );
              scripts/apps/authoring-react/fields/dropdown/dropdown-remote-source/get-value-template.tsx on lines 4..12

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

              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 default function SelectDirective() {
                  return {
                      scope: {
                          label: '@',
                          model: '=',
              Severity: Major
              Found in scripts/core/form/SelectDirective.ts and 1 other location - About 3 hrs to fix
              scripts/core/form/InputDirective.ts on lines 2..17

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

              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 default function InputDirective() {
                  return {
                      scope: {
                          id: '@',
                          type: '@',
              Severity: Major
              Found in scripts/core/form/InputDirective.ts and 1 other location - About 3 hrs to fix
              scripts/core/form/SelectDirective.ts on lines 2..17

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

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

                  render() {
                      const {items1, items2, getId} = this.props;
                      const Template = this.props.template;
              
                      const items1Lookup = keyBy(items1, getId);
              Severity: Major
              Found in scripts/apps/authoring-react/fields/difference-generic.tsx - About 3 hrs to fix

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

                    render() {
                        const {contentProfile} = this.props;
                        const allFields = contentProfile.header.merge(contentProfile.content);
                        const unresolvedComments = this.getUnresolvedComments();
                        const resolvedComments = this.getResolvedComments();
                Severity: Major
                Found in scripts/apps/authoring-react/generic-widgets/inline-comments.tsx - About 3 hrs to fix

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

                      render(): React.ReactNode {
                          return (
                              <Container>
                                  <Spacer v gap="8">
                                      <Button
                  Severity: Major
                  Found in scripts/apps/authoring-react/macros/interactive-macros-display.tsx - About 3 hrs to fix

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

                        render() {
                            if (this.state.macros == null) {
                                return null;
                            }
                    
                    
                    Severity: Major
                    Found in scripts/apps/authoring-react/macros/macros.tsx - About 3 hrs to fix

                      Function getActions has 78 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                                  function getActions(item: IArticle): void {
                                      scope.menuGroups = [];
                      
                                      const actionsFromExtensions = getArticleActionsFromExtensions(item);
                                      let intent = {action: 'list', type: getType(item)};
                      Severity: Major
                      Found in scripts/apps/monitoring/directives/ItemActionsMenu.ts - About 3 hrs to fix

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

                            render() {
                                return (
                                    <div className="sd-content-wrapper__main-content-area sd-main-content-grid">
                                        <HeaderComponent
                                            activeTab={this.state.currentTab}
                        Severity: Major
                        Found in scripts/apps/master-desk/MasterDesk.tsx - About 3 hrs to fix
                          Severity
                          Category
                          Status
                          Source
                          Language