superdesk/superdesk-client-core

View on GitHub

Showing 3,654 of 3,654 total issues

Function replaceHighlight has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

const replaceHighlight = (state, txt, all = false) => {
    const {index, pattern, caseSensitive, diff} = state.searchTerm;
    const es = state.editorState;

    let contentChanged = false;
Severity: Minor
Found in scripts/core/editor3/reducers/find-replace.tsx - About 1 hr to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function constructor has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    constructor() {
        this.send = send;

        this.setListView = function(noNavigate) {
            if (noNavigate === undefined || !noNavigate) {
Severity: Minor
Found in e2e/client/specs/helpers/content.ts - About 1 hr to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

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

    render() {
        const {item, page, getId, index} = this.props;

        return (
            <ListItem key={index} onClick={() => page.openPreview(getId(item))}>
Severity: Minor
Found in scripts/extensions/predefinedTextField/src/config.tsx - About 1 hr to fix

    Function storeValue has 35 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        storeValue: (value, fieldId, rundownItem, config, fieldType) => {
            if (fieldType === 'editor3') {
                const editor3Config = config as IEditor3Config;
                const rawState = (value as IEditor3ValueStorage).rawContentState;
    
    

      Function activate has 35 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          activate: (superdesk: ISuperdesk) => {
              const {httpRequestJsonLocal} = superdesk;
              const {dateToServerString} = superdesk.utilities;
      
              superdesk.session.getCurrentUser().then((user) => {
      Severity: Minor
      Found in scripts/extensions/usageMetrics/src/extension.ts - About 1 hr to fix

        Function getActionsInitialize has 35 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export function getActionsInitialize(superdesk: ISuperdesk) {
            const {gettext} = superdesk.localization;
        
            return function getActions(article: IArticle): Array<IAuthoringAction> {
                if (!canChangeMarkedUser(superdesk, article)) {
        Severity: Minor
        Found in scripts/extensions/markForUser/src/get-article-actions.tsx - About 1 hr to fix

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

              render() {
                  const initialConfig = this.props?.config?.initial_offset_minutes;
                  const checkbox = (
                      <Switch
                          label={{content: ''}}
          Severity: Minor
          Found in scripts/extensions/datetimeField/src/template-editor.tsx - About 1 hr to fix

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

                            render() {
                                const {item, page} = this.props;
            
                                return (
                                    <ListItem onClick={() => page.openPreview(item._id)}>

              Function saveEntity has 35 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  saveEntity: (current, original) => {
                      const adapter = getArticleAdapter();
              
                      return authoringApiCommon.saveBefore(current, original).then((_current) => {
                          const id = original._id;
              Severity: Minor
              Found in scripts/apps/authoring-react/data-layer.ts - About 1 hr to fix

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

                    render() {
                        const {
                            widget,
                            pinned,
                            pinWidget,
                Severity: Minor
                Found in scripts/apps/authoring-react/widget-header-component.tsx - About 1 hr to fix

                  Function updateSearchQuery has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      this.updateSearchQuery = function updateSearchQuery(search) {
                          var where = [];
                  
                          function prepareDate(val, timeSuffix) {
                              var local = moment(val, appConfig.view.dateformat).format('YYYY-MM-DD') + timeSuffix +
                  Severity: Minor
                  Found in scripts/apps/legal-archive/services/LegalArchiveService.ts - About 1 hr to fix

                    Function updateScopeData has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                                function updateScopeData(helperData, userPrefs) {
                                    // If the planning module is installed we save a list of the available agendas
                                    if (scope.features.agenda) {
                                        scope.agendas = helperData.agendas;
                                    }
                    Severity: Minor
                    Found in scripts/apps/users/directives/UserPreferencesDirective.ts - About 1 hr to fix

                      Function saveCrops has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          $scope.saveCrops = function() {
                              /* Throw an exception if PoI is outside of a crop */
                              function poiIsInsideEachCrop() {
                                  const originalImage = $scope.data.metadata.renditions.original;
                      
                      

                        Function ItemActionsByIntentDirective has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        export function ItemActionsByIntentDirective(superdesk, activityService, workflowService) {
                            return {
                                templateUrl: 'scripts/apps/authoring/views/item-actions-by-intent.html',
                                link: function($scope, elem, attrs) {
                                    function getMenuGroups() {

                          Function AuthoringContainerDirective has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          export function AuthoringContainerDirective(authoringWorkspace: AuthoringWorkspaceService) {
                              function AuthoringContainerController() {
                                  var self = this;
                          
                                  this.state = {};

                            Function MetaTargetedPublishingDirective has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            function MetaTargetedPublishingDirective() {
                                return {
                                    scope: {
                                        list: '=',
                                        disabled: '=ngDisabled',
                            Severity: Minor
                            Found in scripts/apps/authoring/metadata/metadata.ts - About 1 hr to fix

                              Function getHistoryItems has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              export function getHistoryItems(item: IArticle): Promise<Array<IHistoryItem>> {
                                  let historyItemsResult = [];
                                  const archiveService = ng.get('archiveService');
                                  const desks = ng.get('desks');
                              
                              
                              Severity: Minor
                              Found in scripts/apps/authoring/versioning/history/HistoryController.ts - About 1 hr to fix

                                Function positionPopup has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                export function positionPopup(target, zIndex = 1000) {
                                    const node: any = menuHolderElem().firstChild;
                                
                                    if (node == null) { // when loading
                                        return;
                                Severity: Minor
                                Found in scripts/apps/search/helpers.tsx - About 1 hr to fix

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

                                      render() {
                                          const {loading} = this.state;
                                          const {children} = this.props;
                                          const style: CSSProperties = loading
                                              ? {position: 'absolute', insetInlineStart: -9999, insetBlockStart: -9999, visibility: 'hidden'}
                                  Severity: Minor
                                  Found in scripts/apps/search/components/SmoothLoaderForKey.tsx - About 1 hr to fix

                                    Function EditTimeInterval has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                    export function EditTimeInterval() {
                                        return {
                                            scope: {
                                                initialValue: '=',
                                                onChange: '=',
                                    Severity: Minor
                                    Found in scripts/apps/search/directives/EditTimeInterval.ts - About 1 hr to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language