superdesk/superdesk-client-core

View on GitHub

Showing 3,654 of 3,654 total issues

Function replaceWord has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

export const replaceWord = (state, replaceWordData: IReplaceWordData, skipOnChange = false) => {
    const {editorState, suggestingMode} = state;

    const {word, newWord} = replaceWordData;

Severity: Minor
Found in scripts/core/editor3/reducers/spellchecker.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 addColAfter has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

const addColAfter = (state) =>
    processCells(state, (cells, numCols, numRows, i, j, withHeader) => ({
        data: {
            numRows: numRows,
            numCols: numCols + 1,
Severity: Minor
Found in scripts/core/editor3/reducers/table.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 SubscriberTokenController has 39 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export function SubscriberTokenController($scope, api, $rootScope) {
    const subscriber = $scope.subscriber;

    this.copy = copyString;
    this.tokens = [];
Severity: Minor
Found in scripts/apps/publish/controllers/SubscriberTokenController.ts - About 1 hr to fix

    Function componentDidMount has 39 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        componentDidMount() {
            const vocabularies = ng.get('vocabularies');
            const content = ng.get('content');
    
            Promise.all([

      Function getEditorConfig has 39 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export function getEditorConfig(contentTypeId) {
          const content = ng.get('content');
          const metadata = ng.get('metadata');
      
          return Promise.all([
      Severity: Minor
      Found in scripts/apps/workspace/content/components/get-editor-config.tsx - About 1 hr to fix

        Function previewAuthoringEntity has 39 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export function previewAuthoringEntity(
            item: any,
            profile: IContentProfileV2,
            fieldsData: Immutable.Map<string, any>,
            label?: string,
        Severity: Minor
        Found in scripts/apps/authoring-react/preview-article-modal.tsx - About 1 hr to fix

          Function gotoIngest has 39 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                          $scope.gotoIngest = function(provider) {
                              const contentTypes = provider.content_types;
                              const length = provider.content_types.includes('preformatted') || (
                                  contentTypes.includes('planning') && contentTypes.includes('event')) ? 2 : 1;
          
          
          Severity: Minor
          Found in scripts/apps/ingest/directives/IngestSourcesContent.ts - About 1 hr to fix

            Function ContactEditorDirective has 39 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export function ContactEditorDirective(
                contacts,
                notify,
                privileges,
                metadata,
            Severity: Minor
            Found in scripts/apps/contacts/directives/ContactEditorDirective.ts - About 1 hr to fix

              Function ThemeSelectDirective has 39 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export function ThemeSelectDirective(authThemes) {
                  return {
                      templateUrl: 'scripts/apps/authoring/views/theme-select.html',
                      scope: {key: '@'},
                      link: function themeSelectLink(scope, elem) {
              Severity: Minor
              Found in scripts/apps/authoring/authoring/directives/ThemeSelectDirective.ts - About 1 hr to fix

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

                        link: (scope) => {
                            scope.features = features;
                            scope.metadata = metadata;
                
                            scope.handleInputChange = (newValue: string, {field}) => {
                Severity: Minor
                Found in scripts/apps/authoring/media/MediaMetadataEditorDirective.ts - About 1 hr to fix

                  Function editMedia has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                                  scope.editMedia = (defaultTab = 'view') => {
                                      let showTabs = [];
                  
                                      scope.mediaLoading = true;
                  
                  
                  Severity: Minor
                  Found in scripts/apps/authoring/authoring/directives/ArticleEditDirective.ts - About 1 hr to fix

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

                            link: function(scope, element, attrs) {
                                scope.syncWidgets = function() {
                                    angular.forEach(scope.widgets, (widget) => {
                                        if (widget.active) {
                                            var sizes = scope.gridster.serialize(widget.el);
                    Severity: Minor
                    Found in scripts/apps/dashboard/grid/grid.ts - About 1 hr to fix

                      Function renderArea has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      export function renderArea(
                          area: 'firstLine' | 'secondLine' | 'singleLine' | 'priority',
                          itemProps: IItemProps,
                          props?: { className?: string },
                          customRender: any = {},
                      Severity: Minor
                      Found in scripts/apps/search/helpers.tsx - About 1 hr to fix

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

                                    function render(items, next, force?) {
                                        scope.loading = true;
                                        if (items) {
                                            setScopeItems(items, force);
                                        } else if (next) {
                        Severity: Minor
                        Found in scripts/apps/search/directives/SearchResults.ts - About 1 hr to fix

                          Function MultiImageEditDirective has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          export function MultiImageEditDirective(asset, $sce) {
                              return {
                                  scope: {
                                      imagesOriginal: '=',
                                      isUpload: '=',
                          Severity: Minor
                          Found in scripts/apps/search/MultiImageEdit.ts - About 1 hr to fix

                            Function toElasticFilter has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            function toElasticFilter(q: ILogicalOperator | IComparison) {
                                if (isLogicalOperator(q)) {
                                    const r = {};
                            
                                    if (q['$and'] != null) {
                            Severity: Minor
                            Found in scripts/core/query-formatting.ts - About 1 hr to fix

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

                                  render() {
                                      const DropdownButton = this.props.customButton ?? defaultButton;
                              
                                      return (
                                          <DropZone3

                                Function toElasticQuery has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                export function toElasticQuery(q: ISuperdeskQuery): {q?: string; source: string} {
                                    interface IQuery {
                                        query?: {
                                            filtered: {
                                                filter?: {};
                                Severity: Minor
                                Found in scripts/core/query-formatting.ts - About 1 hr to fix

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

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

                                    Function handleBeforeInputHighlights has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                    export function handleBeforeInputHighlights(
                                        onChange,
                                        chars: string,
                                        editorState: EditorState,
                                    ): DraftHandleValue {
                                    Severity: Minor
                                    Found in scripts/core/editor3/helpers/handleBeforeInputHighlights.ts - About 1 hr to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language