superdesk/superdesk-client-core

View on GitHub

Showing 3,654 of 3,654 total issues

Function MacrosService has 50 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function MacrosService(api, notify) {
    /**
     * Recursively returns all macros
     *
     * @return {*}
Severity: Minor
Found in scripts/apps/authoring/macros/macros.ts - About 2 hrs to fix

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

        render() {
            const {item, field, editable} = this.props;
            const FieldType = getField(field.custom_field_type);
    
            if (FieldType == null) {
    Severity: Minor
    Found in scripts/apps/authoring/authoring/authoring-custom-field.tsx - About 2 hrs to fix

      Function AuthoringService has 16 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          $q,
          $location,
          api,
          lock,
          autosave,
      Severity: Major
      Found in scripts/apps/authoring/authoring/services/AuthoringService.ts - About 2 hrs to fix

        Function PlacesServiceFactory has 50 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export default function PlacesServiceFactory(api, features, metadata) {
            const geoNameToCity = (data: IGeoName): ILocated => ({
                dateline: 'city',
                country_code: data.country_code,
                tz: data.tz,
        Severity: Minor
        Found in scripts/apps/authoring/metadata/PlacesService.ts - About 2 hrs to fix

          Function MediaFieldsController has 50 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export default function MediaFieldsController($q, metadata) {
              function getCV(field) {
                  const cv = metadata.cvs.find((_cv) => _cv._id === field || _cv.schema_field === field);
          
                  if (cv == null && field === 'subject') {
          Severity: Minor
          Found in scripts/apps/authoring/media/media-fields-controller.ts - About 2 hrs to fix

            Function saveAuthoring has 50 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                this.save = function saveAuthoring(
                    origItem: IArticle,
                    _item: IArticle,
                    requestEditor3DirectivesToGenerateHtml?: Array<()=> void>,
                ) {
            Severity: Minor
            Found in scripts/apps/authoring/authoring/services/AuthoringService.ts - About 2 hrs to fix

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

                  render() {
                      const {Wrapper, showPrintDialog, closeModal} = this.props;
              
                      return (
                          <Wrapper
              Severity: Minor
              Found in scripts/apps/authoring/preview/fullPreviewMultiple.tsx - About 2 hrs to fix

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

                    render() {
                        return (
                            <>
                                <div className="sd-board__subheader">
                                    <h5 className="sd-board__subheader-title">{this.props.role?.name ?? gettext('No role')}</h5>
                Severity: Minor
                Found in scripts/apps/master-desk/components/UserListComponent.tsx - About 2 hrs to fix

                  Function getDateRangesByKey has 50 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  export function getDateRangesByKey(): Dictionary<string, IDateRange> {
                      const before_next_month: IDateRange = {
                          key: 'before_next_month',
                          label: gettext('Next Month'),
                          elasticSearchDateRange: {
                  Severity: Minor
                  Found in scripts/apps/search/directives/DateFilters.ts - About 2 hrs to fix

                    Function MediaInfo has 50 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    export const MediaInfo: React.StatelessComponent<IProps> = (props) => {
                        const datetime = ng.get('datetime');
                    
                        const item = props.item;
                        const meta = [];
                    Severity: Minor
                    Found in scripts/apps/search/components/MediaInfo.tsx - About 2 hrs to fix

                      Function dragDrop has 50 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      export function dragDrop(
                          dataTransfer: DataTransfer,
                          type: string,
                          blockKey: string | null,
                          _canAddArticleEmbed?: (srcId: string) => ReturnType<typeof canAddArticleEmbed>,
                      Severity: Minor
                      Found in scripts/core/editor3/actions/editor3.tsx - About 2 hrs to fix

                        Function getLeftRangeAndTextForStyle has 50 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        function getLeftRangeAndTextForStyle(editorState, style) {
                            const type = getHighlightTypeFromStyleName(style);
                            const selection = editorState.getSelection();
                            const content = editorState.getCurrentContent();
                            let startBlock = content.getBlockForKey(selection.getStartKey());
                        Severity: Minor
                        Found in scripts/core/editor3/helpers/highlights.ts - About 2 hrs to fix

                          Function constructor has 50 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              constructor(props: ILiveQueryProps<T> & {onInitialized(): void}) {
                                  super(props);
                          
                                  this.state = {};
                          
                          
                          Severity: Minor
                          Found in scripts/core/with-live-query.tsx - About 2 hrs to fix

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

                            FileInput.propTypes = {
                                field: PropTypes.string,
                                label: PropTypes.string,
                                value: PropTypes.array,
                                onChange: PropTypes.func,
                            Severity: Major
                            Found in scripts/core/ui/components/Form/FileInput.tsx and 3 other locations - About 2 hrs to fix
                            scripts/apps/contacts/components/Form/ContactNumberInput.tsx on lines 117..125
                            scripts/apps/contacts/components/Popup/Header.tsx on lines 33..41
                            scripts/core/ui/components/Popup/Header.tsx on lines 38..46

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

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

                                constructor(props: ILiveResourcesProps & {onInitialized(): void}) {
                                    super(props);
                            
                                    this.state = {};
                            
                            
                            Severity: Minor
                            Found in scripts/core/with-resources.tsx - About 2 hrs to fix

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

                              ContactNumberInput.propTypes = {
                                  remove: PropTypes.func,
                                  field: PropTypes.string,
                                  value: PropTypes.object,
                                  label: PropTypes.string,
                              scripts/apps/contacts/components/Popup/Header.tsx on lines 33..41
                              scripts/core/ui/components/Form/FileInput.tsx on lines 157..165
                              scripts/core/ui/components/Popup/Header.tsx on lines 38..46

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

                              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 4 locations. Consider refactoring.
                              Open

                              Header.propTypes = {
                                  text: PropTypes.string,
                                  onClose: PropTypes.func,
                                  children: PropTypes.node,
                                  className: PropTypes.string,
                              Severity: Major
                              Found in scripts/core/ui/components/Popup/Header.tsx and 3 other locations - About 2 hrs to fix
                              scripts/apps/contacts/components/Form/ContactNumberInput.tsx on lines 117..125
                              scripts/apps/contacts/components/Popup/Header.tsx on lines 33..41
                              scripts/core/ui/components/Form/FileInput.tsx on lines 157..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 75.

                              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 4 locations. Consider refactoring.
                              Open

                              Header.propTypes = {
                                  text: PropTypes.string,
                                  onClose: PropTypes.func,
                                  children: PropTypes.node,
                                  className: PropTypes.string,
                              Severity: Major
                              Found in scripts/apps/contacts/components/Popup/Header.tsx and 3 other locations - About 2 hrs to fix
                              scripts/apps/contacts/components/Form/ContactNumberInput.tsx on lines 117..125
                              scripts/core/ui/components/Form/FileInput.tsx on lines 157..165
                              scripts/core/ui/components/Popup/Header.tsx on lines 38..46

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

                              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

                                                      'item:marked': (notification: IMarkForUserNotification) => {
                                                          return {
                                                              body: notification.message,
                                                              actions: [
                                                                  {
                              Severity: Major
                              Found in scripts/extensions/markForUser/src/extension.tsx and 1 other location - About 2 hrs to fix
                              scripts/extensions/markForUser/src/extension.tsx on lines 67..77

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

                              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

                                      this.eventListenersToRemoveBeforeUnmounting.push(
                                          addWebsocketEventListener('resource:created', (event) => {
                                              const {resource} = event.extra;
                              
                                              /**
                              scripts/core/ui/components/virtual-lists/virtual-list-from-query.tsx on lines 207..221

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

                              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

                              Severity
                              Category
                              Status
                              Source
                              Language