Takumon/mean-blog

View on GitHub

Showing 100 of 340 total issues

Function onDrop has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  @HostListener('drop', ['$event']) public onDrop(evt) {
    evt.preventDefault();
    evt.stopPropagation();
    this.dragover = false;
    const files = evt.dataTransfer.files;
Severity: Minor
Found in src/app/shared/directives/drag-and-drop.directive.ts - About 35 mins 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 onValidationError has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  onValidationError(error: any): void {
    const noControlErrors = [];
    for (const e of error['errors']) {
      // getterからformControllを取得
      const control: FormControl | FormGroup = this[e.param];
Severity: Minor
Found in src/app/drafts/draft-edit/draft-edit.component.ts - About 35 mins 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 textFormat has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  textFormat($event) {
    if ($event.keyCode === 9) {
      $event.preventDefault();
      this.adjustIndent($event);
      return;
Severity: Minor
Found in src/app/drafts/draft-edit/draft-edit-area.component.ts - About 35 mins 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 scrollToElement has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  scrollToElement(element: Element) {
    if (element) {
      element.scrollIntoView();

      if (window && window.scrollBy) {
Severity: Minor
Found in src/app/articles/shared/scroll.service.ts - About 35 mins 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

Avoid too many return statements within this function.
Open

      return adapter.addAll(action.payload.drafts,  {...state, loading: false});
Severity: Major
Found in src/app/drafts/state/draft.reducer.ts - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

          return Object.assign({}, {...state, loading: false} );
    Severity: Major
    Found in src/app/drafts/state/draft.reducer.ts - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

            return Object.assign({}, {...state, loading: true} );
      Severity: Major
      Found in src/app/state/article.reducer.ts - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

              return Object.assign({}, {...state, loading: false} );
        Severity: Major
        Found in src/app/state/article.reducer.ts - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                return Object.assign({}, {...state, loading: true} );
          Severity: Major
          Found in src/app/state/article.reducer.ts - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                  return adapter.updateOne(action.payload.draft,  {...state, loading: false});
            Severity: Major
            Found in src/app/drafts/state/draft.reducer.ts - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                    return adapter.removeOne(action.payload.draft._id,  {...state, loading: false});
              Severity: Major
              Found in src/app/drafts/state/draft.reducer.ts - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                      return Object.assign({}, {...state, loadingVote: true});
                Severity: Major
                Found in src/app/state/article.reducer.ts - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                        return { dateFrom, dateTo };
                  Severity: Major
                  Found in src/app/shared/enum/date-range-pattern.enum.ts - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                          return Object.assign({}, {...state, loading: false} );
                    Severity: Major
                    Found in src/app/drafts/state/draft.reducer.ts - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                            return Object.assign({}, {...state });
                      Severity: Major
                      Found in src/app/state/article.reducer.ts - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                              return Object.assign({}, {
                                ...state,
                                article: {
                                  ...state.article,
                                  vote: action.payload.vote
                        Severity: Major
                        Found in src/app/state/article.reducer.ts - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                                return Object.assign({}, {...state, loadingVote: false} );
                          Severity: Major
                          Found in src/app/state/article.reducer.ts - About 30 mins to fix

                            Avoid too many return statements within this function.
                            Open

                                  return adapter.addMany(action.payload.drafts, state);
                            Severity: Major
                            Found in src/app/drafts/state/draft.reducer.ts - About 30 mins to fix

                              Avoid too many return statements within this function.
                              Open

                                    return Object.assign({}, {...state, loading: true} );
                              Severity: Major
                              Found in src/app/drafts/state/draft.reducer.ts - About 30 mins to fix

                                Avoid too many return statements within this function.
                                Open

                                      return adapter.addOne(action.payload.article, {
                                        ...state,
                                        loading: false
                                      });
                                Severity: Major
                                Found in src/app/state/article.reducer.ts - About 30 mins to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language