Takumon/mean-blog

View on GitHub

Showing 100 of 340 total issues

Function reducer has 159 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export function reducer(
  state = initialState,
  action: ArticleActions
): State {
  switch (action.type) {
Severity: Major
Found in src/app/state/article.reducer.ts - About 6 hrs to fix

    File draft-edit.component.ts has 422 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import {
      Component,
      OnInit,
      ElementRef,
      ViewChild,
    Severity: Minor
    Found in src/app/drafts/draft-edit/draft-edit.component.ts - About 6 hrs to fix

      File article.ts has 393 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import * as mongoose from 'mongoose';
      import * as http from 'http';
      import { Router, Response } from 'express';
      import { check, oneOf, body, param, validationResult } from 'express-validator/check';
      
      
      Severity: Minor
      Found in server/routes/article.ts - About 5 hrs to fix

        Function extractCondition has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
        Open

        function extractCondition(req: any, cb: (error: any, condition: ArticleCondition) => void): void {
          const query = req.query;
          const source = query.condition ?
            JSON.parse(query.condition) :
            {};
        Severity: Minor
        Found in server/routes/article.ts - About 3 hrs 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 init has 76 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          init(isResume: boolean, _id: string): void {
            if (isResume) {
              this.action = '更新';
              this.store.dispatch(new SetTitle({title: `下書きを${this.action}する`}));
        
        
        Severity: Major
        Found in src/app/drafts/draft-edit/draft-edit.component.ts - About 3 hrs to fix

          Function extractCondition has 66 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function extractCondition(req: any, cb: (error: any, condition: ArticleCondition) => void): void {
            const query = req.query;
            const source = query.condition ?
              JSON.parse(query.condition) :
              {};
          Severity: Major
          Found in server/routes/article.ts - About 2 hrs to fix

            Function reducer has 59 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export function reducer(
              state = initialState,
              action: DraftActions
            ): State {
              switch (action.type) {
            Severity: Major
            Found in src/app/drafts/state/draft.reducer.ts - About 2 hrs to fix

              Function setForm has 58 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                setForm() {
              
                  // TODO ページング
                  if (this.data.idForUpdate) {
                    // 更新時
              Severity: Major
              Found in src/app/articles/search-condition/search-condition.dialog.ts - About 2 hrs to fix

                DraftEditComponent has 21 functions (exceeds 20 allowed). Consider refactoring.
                Open

                @Component({
                  selector: 'app-draft-edit',
                  templateUrl: './draft-edit.component.html',
                  styleUrls: ['./draft-edit.component.scss'],
                })
                Severity: Minor
                Found in src/app/drafts/draft-edit/draft-edit.component.ts - About 2 hrs to fix

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

                    constructor(
                      private router: Router,
                      private actions$: Actions,
                      private route: ActivatedRoute,
                      private fb: FormBuilder,
                  Severity: Major
                  Found in src/app/drafts/draft-edit/draft-edit.component.ts - About 2 hrs to fix

                    File search-condition.ts has 252 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    import * as mongoose from 'mongoose';
                    import * as http from 'http';
                    import { Router, Response } from 'express';
                    import { check, oneOf, body, param, validationResult } from 'express-validator/check';
                    
                    
                    Severity: Minor
                    Found in server/routes/search-condition.ts - About 2 hrs to fix

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

                        of(pattern: string, dateFrom: Date = null, dateTo: Date = null) {
                          const sysdate: moment.Moment = moment();
                      
                          const todayStart: moment.Moment = sysdate.clone().startOf('day');
                          const todayEnd: moment.Moment = sysdate.clone().endOf('day');
                      Severity: Major
                      Found in src/app/shared/enum/date-range-pattern.enum.ts - About 2 hrs to fix

                        File search-condition.dialog.ts has 251 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        import { Component, Inject, OnInit} from '@angular/core';
                        import {
                          FormGroup,
                          FormControl,
                          FormArray,
                        Severity: Minor
                        Found in src/app/articles/search-condition/search-condition.dialog.ts - About 2 hrs to fix

                          Function upsertArticle has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            upsertArticle(form: FormGroup): void {
                              if (!form.valid ) {
                                return;
                              }
                          
                          
                          Severity: Minor
                          Found in src/app/drafts/draft-edit/draft-edit.component.ts - About 1 hr to fix

                            Function getCondition has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            function getCondition(req: any, cb: Function): void {
                              const query = req.query;
                              const source = query.condition ?
                                JSON.parse(query.condition) :
                                {};
                            Severity: Minor
                            Found in server/routes/comment.ts - About 1 hr to fix

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

                                openSerchConditionDialog(conditionForUpdate: SearchConditionModel = null) {
                                  const dialogRef = this.dialog.open(SearchConditionDialogComponent, {
                                    width: '810px',
                                    data: { idForUpdate:  conditionForUpdate && conditionForUpdate._id.toString() }
                                  });
                              Severity: Minor
                              Found in src/app/articles/search-condition/search-condition.component.ts - About 1 hr to fix

                                Function parse has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                  parse(rawText: string, baseUrl: string = null): any {
                                    const toc = [];
                                    const renderer = new marked.Renderer();
                                    renderer.heading = function(text, level) {
                                      // domのidに使えない文字はハイフンに置換する
                                Severity: Minor
                                Found in src/app/shared/services/markdown-parse.service.ts - About 1 hr to fix

                                  Function initDB has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                    private initDB(): void {
                                      User
                                        .findOne({ userId : ENV.ROOT_USER_ID })
                                        .exec((err, user) => {
                                          if (err) {
                                  Severity: Minor
                                  Found in server/app.ts - About 1 hr to fix

                                    Function constructCondition has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                    function constructCondition(req: any, cb: Function): void {
                                      const query = req.query;
                                      const source = query.condition ?
                                        JSON.parse(query.condition) :
                                        {};
                                    Severity: Minor
                                    Found in server/routes/reply.ts - About 1 hr to fix

                                      Function init has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                                      Open

                                        private init(): void {
                                              const _headings = document.querySelectorAll('.' + MARKDOWN_HEADER_CLASS);
                                              const skipNoTocHeadings = (heading: HTMLHeadingElement) => !/(?:no-toc|notoc)/i.test(heading.className);
                                              const headings = Array.prototype.filter.call(_headings, skipNoTocHeadings);
                                              this.tocService.genToc(headings);
                                      Severity: Minor
                                      Found in src/app/articles/article-detail/article-toc.component.ts - About 1 hr to fix
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language