superdesk/superdesk-client-core

View on GitHub

Showing 3,654 of 3,654 total issues

Function canRewrite has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function canRewrite(item: IArticle): true | Array<string> {
    const errors = [];

    if (
        isReadOnly(item)
Severity: Minor
Found in scripts/apps/authoring/authoring/services/AuthoringService.ts - About 1 hr to fix

    Function StreamController has 30 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export function StreamController($scope, api, $rootScope, desks) {
        $scope.desk = null;
        $scope.activities = null;
        $scope.pageLength = 10;
        $scope.max_results = $scope.pageLength;
    Severity: Minor
    Found in scripts/apps/stream/controllers/StreamController.ts - About 1 hr to fix

      Function buildGeneralFilters has 30 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              function buildGeneralFilters(paramsObject, query) {
                  if (paramsObject.urgency) {
                      query.post_filter({terms: {urgency: JSON.parse(paramsObject.urgency)}});
                  }
      
      
      Severity: Minor
      Found in scripts/apps/search/services/SearchService.ts - About 1 hr to fix

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

            render() {
                const showSelect = this.state.hover || this.props.itemSelected;
        
                return (
                    <div
        Severity: Minor
        Found in scripts/apps/search/components/ListTypeIcon.tsx - About 1 hr to fix

          Function getFieldTypeForFiltering has 30 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function getFieldTypeForFiltering(type: FormFieldType): FormFieldType {
              switch (type) {
              case FormFieldType.plainText:
                  return FormFieldType.plainText;
              case FormFieldType.textEditor3:

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

                render() {
                    return (
                        <Modal
                            visible
                            zIndex={1050}
            Severity: Minor
            Found in scripts/core/ui/components/modal-simple.tsx - About 1 hr to fix

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

                  render() {
                      if (this.props.previewOutput) {
                          return <div>{this.props.value ? gettext('Yes') : gettext('No')}</div>;
                      }
              
              
              Severity: Minor
              Found in scripts/core/ui/components/generic-form/input-types/checkbox.tsx - About 1 hr to fix

                Function getFormFieldComponent has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                export function getFormFieldComponent(type: FormFieldType): React.ComponentType<IInputType<any>> {
                    switch (type) {
                    case FormFieldType.plainText:
                        return PlainText;
                    case FormFieldType.textEditor3:
                Severity: Minor
                Found in scripts/core/ui/components/generic-form/form-field.tsx - About 1 hr to fix

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

                      constructor(props: IProps<T>) {
                          super(props);
                  
                          this.state = {
                              search: '',
                  Severity: Minor
                  Found in scripts/core/ui/components/select2.tsx - About 1 hr to fix

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

                        render() {
                            const {markupV2} = this.props;
                    
                            return (
                                <React.Fragment>

                      Function getQueryWithFilters has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      function getQueryWithFilters(
                          originalQuery: ISuperdeskQuery,
                          filters: IState['activeFilters'],
                          fullTextSearch: string,
                          sortOption: ISortOption,
                      Severity: Minor
                      Found in scripts/core/ArticlesListByQueryWithFilters.tsx - About 1 hr to fix

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

                            render() {
                                if (this.props.previewOutput) {
                                    return <UserHtmlSingleLine html={this.props.value} showAsPlainText={!!this.props.showAsPlainText} />;
                                }
                        
                        

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

                                  link: function(scope, element, attrs) {
                                      const SIZE = 25;
                          
                                      scope.pgsizes = [SIZE, SIZE * 2, SIZE * 4];
                          
                          
                          Severity: Minor
                          Found in scripts/core/list/list.ts - About 1 hr to fix

                            Function onSubmit has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                onSubmit(linkType) {
                                    let link;
                                    const {suggestingMode, localDomains} = this.props;
                                    const _createLinkSuggestion = this.props.createLinkSuggestion;
                                    const _applyLink = this.props.applyLink;
                            Severity: Minor
                            Found in scripts/core/editor3/components/links/LinkInput.tsx - About 1 hr to fix

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

                                  render() {
                                      const {block, contentState} = this.props;
                                      const entityKey = block.getEntityAt(0);
                                      const entity = contentState.getEntity(entityKey);
                                      const {item} = entity.getData() as IEditorDragDropArticleEmbed['data'];
                              Severity: Minor
                              Found in scripts/core/editor3/components/article-embed/article-embed.tsx - About 1 hr to fix

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

                                            if (warnAboutLosingChanges) {
                                                return superdesk.ui.confirm('Discard unsaved changes?').then((confirmed) => {
                                                    if (confirmed) {
                                                        doClose();
                                                    }
                                scripts/extensions/broadcasting/src/rundowns/prepare-create-edit-rundown-item.ts on lines 114..122

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

                                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

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

                                    edit(
                                        item: {_id: IArticle['_id'], _type?: IArticle['_type'], state?: IArticle['state']},
                                        action?: IAuthoringActionType,
                                    ) {
                                        return sdApi.article.edit(item, action);
                                scripts/api/article.ts on lines 411..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 59.

                                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

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

                                function edit(
                                    item: {
                                        _id: IArticle['_id'],
                                        _type?: IArticle['_type'],
                                        state?: IArticle['state']
                                Severity: Major
                                Found in scripts/api/article.ts and 1 other location - About 1 hr to fix
                                scripts/apps/authoring/authoring/services/AuthoringWorkspaceService.ts on lines 101..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 59.

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

                                                function drawPoint(img, poi = vm.poi) {
                                                    var topOffset = poi.y * img.height - circleRadius;
                                                    var leftOffset = poi.x * img.width - circleRadius;
                                                    var verticalLeftOffset = leftOffset + circleRadius - lineThickness / 2;
                                                    var horizontalTopffset = topOffset + circleRadius - lineThickness / 2;
                                Severity: Minor
                                Found in scripts/core/upload/image-crop-directive.ts - About 1 hr to fix

                                  Function backendRequest has 30 lines of code (exceeds 25 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
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language