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

    toggleOpenDatePicker() {
        this.setState({openDatePicker: !this.state.openDatePicker});

        if (this.state.openDatePicker) {
            // Keep the focus to enable tab navigation
Severity: Major
Found in scripts/core/ui/components/Form/DateInput/index.tsx and 1 other location - About 1 hr to fix
scripts/core/ui/components/Form/TimeInput/index.tsx on lines 57..64

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

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 (filters?.duration?.gte != null && filters.duration.gte !== 0) {
        queryFilters.push({duration: {$gte: filters.duration.gte}});
    }
scripts/extensions/broadcasting/src/rundowns/rundowns-list.tsx on lines 59..61

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

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

const AnnotationWithDependenciesLoaded = connectPromiseResults(() => ({
    annotationTypes: ng.get('metadata').initialize()
        .then(() => ng.get('metadata').values.annotation_types),
}))(Annotation);
scripts/core/editor3/components/annotations/AnnotationInput.tsx on lines 365..368

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

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 SelectInput: React.StatelessComponent<any> = ({
    field,
    label,
    value,
    options,
Severity: Major
Found in scripts/core/ui/components/Form/SelectInput.tsx and 1 other location - About 1 hr to fix
scripts/core/ui/components/Form/TextInput.tsx on lines 12..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 66.

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

            scope.checkNone = function() {
                scope.categories.forEach((cat) => {
                    cat.selected = false;
                });
                scope.userPrefs.$setDirty();
Severity: Major
Found in scripts/apps/users/directives/UserPreferencesDirective.ts and 1 other location - About 1 hr to fix
scripts/apps/users/directives/UserPreferencesDirective.ts on lines 151..156

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

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 (filters?.duration?.lte != null && filters.duration.lte !== 0) {
        queryFilters.push({duration: {$lte: filters.duration.lte}});
    }
scripts/extensions/broadcasting/src/rundowns/rundowns-list.tsx on lines 55..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 66.

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

            function reload() {
                if (scope.item) {
                    commentsService.fetch(scope.item._id).then(() => {
                        scope.comments = commentsService.comments;
                    });
Severity: Major
Found in scripts/apps/authoring/widgets/widgets.ts and 1 other location - About 1 hr to fix
scripts/apps/authoring/comments/comments.ts on lines 63..69

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

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

            scope.checkAll = function() {
                scope.categories.forEach((cat) => {
                    cat.selected = true;
                });
                scope.userPrefs.$setDirty();
Severity: Major
Found in scripts/apps/users/directives/UserPreferencesDirective.ts and 1 other location - About 1 hr to fix
scripts/apps/users/directives/UserPreferencesDirective.ts on lines 164..169

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

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

    function fetchPublishQueue() {
        var criteria = criteria || {};

        criteria.max_results = $scope.pageSize;
        criteria.page = $scope.pagination.page;
Severity: Minor
Found in scripts/apps/publish/controllers/PublishQueueController.ts - About 1 hr to fix

    Function registerAuthoringReactFields has 38 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export function registerAuthoringReactFields() {
        const result: IExtensionActivationResult = {
            contributions: {
                getAuthoringActions: (article, contentProfile, fieldsData) => {
                    if (appConfig.features.useTansaProofing === true) {
    Severity: Minor
    Found in scripts/apps/authoring-react/fields/register-fields.ts - About 1 hr to fix

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

          render() {
              const topbarWidgets = (this.props.coreWidgets ?? []).concat(this.props.extraWidgets ?? []);
      
              const topbarWidgetsStart = topbarWidgets
                  .filter(({group}) => group === 'start')
      Severity: Minor
      Found in scripts/apps/authoring-react/subcomponents/authoring-toolbar.tsx - About 1 hr to fix

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

            render() {
                const {value1, value2, config} = this.props;
                const {source} = config;
        
                switch (source) {
        Severity: Minor
        Found in scripts/apps/authoring-react/fields/dropdown/difference.tsx - About 1 hr to fix

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

              render() {
                  const {value, config} = this.props;
                  const {source} = config;
          
                  switch (source) {
          Severity: Minor
          Found in scripts/apps/authoring-react/fields/dropdown/preview.tsx - About 1 hr to fix

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

                render() {
                    const {comment} = this.props;
                    const user =
                        store.getState().entities.users[comment.authorId];
            
            
            Severity: Minor
            Found in scripts/apps/authoring-react/generic-widgets/inline-comments.tsx - About 1 hr to fix

              Function SubjectService has 38 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export function SubjectService(api) {
                  var service = {
                      rawSubjects: null,
                      qcodeLookup: {},
                      subjects: [],
              Severity: Minor
              Found in scripts/apps/ingest/services/SubjectService.ts - About 1 hr to fix

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

                    render(): React.ReactNode {
                        const {
                            onVersionChange,
                            versions,
                            version,
                Severity: Minor
                Found in scripts/apps/authoring-react/toolbar/version-header.tsx - About 1 hr to fix

                  Function RolesPrivilegesDirective has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  export function RolesPrivilegesDirective(api, notify, $q, $filter) {
                      return {
                          scope: true,
                          templateUrl: 'scripts/apps/users/views/settings-privileges.html',
                          link: function(scope) {
                  Severity: Minor
                  Found in scripts/apps/users/directives/RolesPrivilegesDirective.ts - About 1 hr to fix

                    Function uploadAndCropImages has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        uploadAndCropImages(scope, files): Promise<boolean> {
                            // in case of feature media we dont have scope.field available as it is not a vocabulary.
                            const maxUploadsRemaining = scope.maxUploads != null && scope.field != null
                                ? scope.maxUploads - getAssociationsByFieldId(scope.item.associations, scope.field._id).length
                                : 1;

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

                          render() {
                              const {
                                  widget,
                                  pinWidget,
                              } = this.props;
                      Severity: Minor
                      Found in scripts/apps/authoring/widgets/WidgetHeaderComponent.tsx - About 1 hr to fix

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

                                link: function(scope, element) {
                                    scope.words = [];
                                    scope.selectedTerm = '';
                        
                                    scope.$applyAsync(() => {
                        Severity: Minor
                        Found in scripts/apps/authoring/metadata/metadata.ts - About 1 hr to fix
                          Severity
                          Category
                          Status
                          Source
                          Language