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

    onKeyDown(event) {
        if (event) {
            switch (event.keyCode) {
            case KEYCODES.ENTER:
                onEventCapture(event);
scripts/core/ui/components/Form/ColouredValueInput/ColouredValuePopup.tsx on lines 34..51

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

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

export function HighlightsService(api, $q, $cacheFactory, packages: IPackagesService, privileges) {
    var service: any = {};
    var promise = {};
    var cache = $cacheFactory('highlightList');

Severity: Major
Found in scripts/apps/highlights/services/HighlightsService.ts - About 3 hrs to fix

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

        render() {
            const showClearFiltersButton = Object.keys(this.props.filters)
                .some((key) => this.props.filters[key].length !== 0);
    
            return (
    Severity: Major
    Found in scripts/apps/master-desk/components/FilterPanelComponent.tsx - About 3 hrs to fix

      File tasks.ts has 319 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import _ from 'lodash';
      import moment from 'moment';
      import './styles/tasks.scss';
      import {gettext} from 'core/utils';
      
      
      Severity: Minor
      Found in scripts/apps/dashboard/workspace-tasks/tasks.ts - About 3 hrs to fix

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

                link: function(scope, elem) {
                    scope.$watch('urgency', (urgency) => {
                        if (urgency) {
                            var spec = metadata.urgencyByValue(urgency);
        
        
        Severity: Major
        Found in scripts/apps/archive/directives/ItemUrgency.ts and 1 other location - About 3 hrs to fix
        scripts/apps/archive/directives/ItemPriority.ts on lines 14..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 108.

        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

                link: function(scope, elem) {
                    scope.$watch('priority', (priority) => {
                        if (priority) {
                            var spec = metadata.priorityByValue(priority);
        
        
        Severity: Major
        Found in scripts/apps/archive/directives/ItemPriority.ts and 1 other location - About 3 hrs to fix
        scripts/apps/archive/directives/ItemUrgency.ts on lines 13..25

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

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

            render() {
                const subitemTypes = Map<string, IVocabularyItem>(
                    vocabulary.getVocabulary(RUNDOWN_SUBITEM_TYPES).items.map((item) => [item.qcode, item]),
                );
        
        

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

              render() {
                  const {gettext, longFormatDateTime} = superdeskApi.localization;
                  const typeIcon = getIconTypeFromMimetype(
                      this.props.asset.mimetype ?? 'text',
                  );
          Severity: Major
          Found in scripts/extensions/sams/src/components/assets/assetGridItem.tsx - About 3 hrs to fix

            Function ProductionTestController has 91 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export function ProductionTestController($scope, contentFilters, notify, $location, $window) {
                $scope.preview = null;
                $scope.selected = {};
                $scope.selectedItem = {};
                $scope.selectedfilter = null;
            Severity: Major
            Found in scripts/apps/content-filters/controllers/ProductionTestController.ts - About 3 hrs to fix

              Function init has 91 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  init(props) {
                      let value;
                      let title;
                      let altTitle;
                      let item;
              Severity: Major
              Found in scripts/apps/contacts/components/ItemContainer.tsx - About 3 hrs to fix

                Function AuthoringTopbarDirective has 91 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                export function AuthoringTopbarDirective(
                    TranslationService,
                    privileges,
                    authoringWorkspace: AuthoringWorkspaceService,
                    $q,

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

                      render() {
                          const selectedDestination = this.props.value;
                          const destinationPersonalSpace: {id: string; label: string} = {
                              id: PERSONAL_SPACE, label: gettext('Personal space'),
                          };

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

                        render() {
                            const isCreate = this.props.icon === 'icon-plus-large';
                            const buttonClassName = classNames(
                                'dropdown-toggle',
                                'dropdown__toggle',
                    Severity: Major
                    Found in scripts/core/ui/components/SubNav/Dropdown.tsx - About 3 hrs to fix

                      Function splitterWidget has 91 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      function splitterWidget(superdesk, $timeout, $rootScope) {
                          return {
                              link: function(scope, element) {
                                  const MONITORING_MIN_WIDTH = 532;
                                  const AUTHORING_MIN_WIDTH = 730;
                      Severity: Major
                      Found in scripts/core/ui/ui.ts - About 3 hrs to fix

                        Function SearchProviderConfigDirective has 90 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        export default function SearchProviderConfigDirective(searchProviderService, notify, api, modal) {
                            return {
                                templateUrl: 'scripts/apps/search-providers/views/search-provider-config.html',
                                link: function($scope) {
                                    $scope.provider = null;
                        Severity: Major
                        Found in scripts/apps/search-providers/directive.ts - About 3 hrs to fix

                          Function queryItems has 90 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                                      function queryItems(event?, data?, params?) {
                                          var originalQuery;
                          
                                          if (desks.changeDesk) {
                                              desks.changeDesk = false;
                          Severity: Major
                          Found in scripts/apps/monitoring/directives/MonitoringGroup.ts - About 3 hrs to fix

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

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

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

                                  render() {
                                      if (this.props.selectedDesk != null) {
                                          return (
                                              <div className="sd-kanban-list sd-padding-x--2 sd-padding-t--2">
                                                  {(this.props.stages?.[this.props.selectedDesk._id] ?? []).map((stage, index) => (
                              Severity: Major
                              Found in scripts/apps/master-desk/components/OverviewComponent.tsx - About 3 hrs to fix

                                Function DashboardController has 90 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                export function DashboardController(
                                    $scope,
                                    desks,
                                    dashboardWidgets,
                                    api,
                                Severity: Major
                                Found in scripts/apps/dashboard/controllers/DashboardController.ts - About 3 hrs to fix

                                  Function TimepickerInnerDirective has 90 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                  function TimepickerInnerDirective($compile, $document, popupService, datetimeHelper) {
                                      var popupTpl = '<div sd-timepicker-popup ' +
                                          'data-open="open" data-time="time" data-select="timeSelection({time: time})" data-keydown="keydown(e)">' +
                                          '</div>';
                                  
                                  
                                  Severity: Major
                                  Found in scripts/core/ui/ui.ts - About 3 hrs to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language