superdesk/superdesk-client-core

View on GitHub

Showing 3,654 of 3,654 total issues

Function UsersService has 37 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export function UsersService(api, $q, notify) {
    var usersService: any = {};

    usersService.usernamePattern = /^[A-Za-z0-9_.'-]+$/;
    usersService.phonePattern = /^(?:(?:0?[1-9][0-9]{8})|(?:(?:\+|00)[1-9][0-9]{9,11}))$/;
Severity: Minor
Found in scripts/apps/users/services/UsersService.ts - About 1 hr to fix

    Function publish has 37 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

                $scope.publish = function() {
                    $scope.$applyAsync(() => {
                        $scope.loading = true;
                    });
    
    
    Severity: Minor
    Found in scripts/apps/authoring/authoring/directives/AuthoringDirective.ts - About 1 hr to fix

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

          render() {
              const {item} = this.props;
              const thumbnail = getViewImage(item);
              const showFigure = thumbnail != null && thumbnail.mimetype.startsWith('image');
      
      

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

                    render() {
                        return (
                            <Modal
                                visible
                                zIndex={1050}

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

              constructor($location, superdeskFlags, authoring, suggest, $rootScope, search, $window) {
                  this.$location = $location;
                  this.superdeskFlags = superdeskFlags;
                  this.authoring = authoring;
                  this.suggest = suggest;

            Function MetadropdownFocusDirective has 37 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function MetadropdownFocusDirective(keyboardManager) {
                return {
                    require: 'dropdown',
                    link: function(scope, elem, attrs, dropdown) {
                        scope.$watch(dropdown.isOpen, (isOpen) => {
            Severity: Minor
            Found in scripts/apps/authoring/metadata/metadata.ts - About 1 hr to fix

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

                  render() {
                      return (
                          <div>
                              {this.props.mediaItems.map((item, index) => (
                                  <div key={item._id}>
              Severity: Minor
              Found in scripts/apps/authoring/preview/field-types/media.tsx - About 1 hr to fix

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

                        link: function(scope, elem) {
                            var open = false;
                
                            elem.bind('click', (event) => {
                                if (!open) {
                Severity: Minor
                Found in scripts/apps/authoring/multiedit/multiedit.ts - About 1 hr to fix

                  Function ExtensionPointDirective has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  export function ExtensionPointDirective(extensionPoints, _, $q) {
                      function _buildCompoment(extension, scope) {
                          // for easy access put values from parent scope into ...
                          const callback = extension.onInit && extension.onInit(extension, scope) || $q.resolve();
                  
                  

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

                        render() {
                            if (this.props.loading || this.props.itemIds == null) {
                                return <div className="item-group__loading" />;
                            }
                    
                    
                    Severity: Minor
                    Found in scripts/apps/search/components/WidgetItemList.tsx - About 1 hr to fix

                      Function PhotoDeskInfo has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      export const PhotoDeskInfo: React.StatelessComponent<IProps> = (props) => {
                          const {item} = props;
                      
                          const datetime = ng.get('datetime');
                      
                      
                      Severity: Minor
                      Found in scripts/apps/search/components/PhotoDeskInfo.tsx - About 1 hr to fix

                        Function SavedSearchService has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        export function SavedSearchService(api, $filter, $q, $rootScope) {
                            var _getAll = function(endPoint, page = 1, items = [], params = null) {
                                return api.query(endPoint, {max_results: 200, page: page}, params)
                                    .then((result) => {
                                        let pg = page;
                        Severity: Minor
                        Found in scripts/apps/search/services/SavedSearchService.ts - About 1 hr to fix

                          Function getDraftCharacterListForSelection has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          export function getDraftCharacterListForSelection(
                              editorState: EditorState,
                              selection: SelectionState,
                          ): List<CharacterMetadata> {
                              // including all blocks
                          Severity: Minor
                          Found in scripts/core/editor3/helpers/getDraftCharacterListForSelection.ts - About 1 hr to fix

                            Function manageEmbeds has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                manageEmbeds(__html: string): string {
                                    let html = __html;
                                    const embedCount = html.match(/<!-- EMBED START.*-->/g)?.length ?? 0;
                            
                                    for (let i = 0; i < embedCount; i++) {
                            Severity: Minor
                            Found in scripts/core/editor3/html/from-html/index.ts - About 1 hr to fix

                              Function fetchChangedResources has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              export function fetchChangedResources<T extends IBaseRestApiResponse>(
                                  resource: string,
                                  changes: Array<IResourceChange>,
                                  currentItems: Array<T>,
                                  refreshAllOnFieldsChange: Set<string> = new Set(),
                              Severity: Minor
                              Found in scripts/core/helpers/CrudManager.tsx - About 1 hr to fix

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

                                    constructor() {
                                        this.scope = {};
                                        this.controllerAs = 'vm';
                                        this.controller = [
                                            '$element',
                                Severity: Minor
                                Found in scripts/core/editor3/directive.tsx - About 1 hr to fix

                                  Function mediaQuery has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                  function mediaQuery($window, authoringWorkspace: AuthoringWorkspaceService) {
                                      return {
                                          scope: {
                                              minWidth: '=',
                                              maxWidth: '=',
                                  Severity: Minor
                                  Found in scripts/core/ui/ui.ts - About 1 hr to fix

                                    Function applyStyleSuggestion has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                    function applyStyleSuggestion(editorState, type, style, data) {
                                        const selection = editorState.getSelection();
                                        let newEditorState = editorState;
                                        let tmpEditorState;
                                        let currentStyle;
                                    Severity: Minor
                                    Found in scripts/core/editor3/reducers/suggestions.tsx - About 1 hr to fix

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

                                          constructor() {
                                              var self = this;
                                      
                                              this.dropDown = element(by.id('ingest-dashboard-dropdown'));
                                              this.ingestDashboard = element(by.css('.ingest-dashboard-list'));
                                      Severity: Minor
                                      Found in e2e/client/specs/helpers/pages.ts - About 1 hr to fix

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

                                                                                    <a
                                                                                        className="image-block__image-action"
                                                                                        data-sd-tooltip={gettext('Edit metadata')}
                                                                                        onClick={() => {
                                                                                            this.onClick('view');
                                        Severity: Major
                                        Found in scripts/core/editor3/components/media/MediaBlock.tsx and 2 other locations - About 1 hr to fix
                                        scripts/core/editor3/components/media/MediaBlock.tsx on lines 159..167
                                        scripts/core/editor3/components/media/MediaBlock.tsx on lines 169..177

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

                                        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