Takumon/mean-blog

View on GitHub

Showing 100 of 340 total issues

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

  getSearchCondition() {
    const withUser = true;

    this.searchConditionService.get({
      userId: this.auth.loginUser._id.toString()
Severity: Minor
Found in src/app/articles/search-condition/search-condition.component.ts - About 1 hr to fix

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

      intercept(request: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {
        const token = this.localStorageService.get(LOCALSTORAGE_KEY.TOKEN);
        const req = request.clone(token
          ? { headers: request.headers.set('x-access-token', token)}
          : { headers: request.headers }
    Severity: Minor
    Found in src/app/shared/services/http.interceptor.ts - About 1 hr to fix

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

        createCondition(): SearchArticlesCondition {
          const noCondition = {};
      
          if (!this.seaerchConditions
            || this.seaerchConditions.length === 0) {
      Severity: Minor
      Found in src/app/articles/search-condition/search-condition.component.ts - About 1 hr to fix

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

          upsert() {
            const searchCondition: any = {};
            searchCondition.name = this.form.value.name;
            searchCondition.author = this.auth.loginUser._id;
            searchCondition.users = this.form.value.users;
        Severity: Minor
        Found in src/app/articles/search-condition/search-condition.dialog.ts - About 1 hr to fix

          Function sortAndRefresh has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

            sortAndRefresh(selectedKey): void {
              for (const key of this.sortFactorKeys) {
                const factor = this.sortFactors[key];
          
                if (selectedKey === key) {
          Severity: Minor
          Found in src/app/users/user-list/user-list.component.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 deleteCondition has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            deleteCondition(conditionForDelete: SearchConditionModel) {
              const dialogRef = this.dialog.open(ConfirmDialogComponent, {
                data: {
                  title: '検索条件削除',
                  message: `「${conditionForDelete.name}」を削除しますか?`
          Severity: Minor
          Found in src/app/articles/search-condition/search-condition.component.ts - About 1 hr to fix

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

              private adjustIndent($event) {
                const TAB = '    ';
                // インデントを追加
                if (!$event.shiftKey) {
                  if (this.extractListInfo().isListLine) {
            Severity: Minor
            Found in src/app/drafts/draft-edit/draft-edit-area.component.ts - About 1 hr to fix

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

                private constructSearchCondition(cb: (searchCondition: SearchArticlesCondition) => void ): void {
                  switch (this.mode) {
                    case ArticleSearchMode.ALL:
                      cb({});
                      break;
              Severity: Minor
              Found in src/app/articles/article-list/article-list.component.ts - About 1 hr to fix

                Function onValidationError has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                  private onValidationError(error: any): void {
                    const noControlErrors = [];
                
                    for (const e of error['errors']) {
                      // getterからformControllを取得
                Severity: Minor
                Found in src/app/articles/search-condition/search-condition.dialog.ts - About 55 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 upsertArticle has a Cognitive Complexity of 9 (exceeds 5 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 55 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 constructCondition has a Cognitive Complexity of 9 (exceeds 5 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 55 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 getCondition has a Cognitive Complexity of 9 (exceeds 5 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 55 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 createCondition has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                  createCondition(): SearchArticlesCondition {
                    const noCondition = {};
                
                    if (!this.seaerchConditions
                      || this.seaerchConditions.length === 0) {
                Severity: Minor
                Found in src/app/articles/search-condition/search-condition.component.ts - About 45 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 8 (exceeds 5 allowed). Consider refactoring.
                Open

                  private onValidationError(error: any): void {
                    const noControlErrors = [];
                
                    for (const e of error['errors']) {
                      const control: FormControl | FormGroup = this[e.param];
                Severity: Minor
                Found in src/app/users/user.component.ts - About 45 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 getImage has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                function getImage(req, res, next, condition: any, errorMessage: string) {
                Severity: Minor
                Found in server/routes/image.ts - About 35 mins to fix

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

                    private onValidationError(error: any): void {
                      const noControlErrors = [];
                  
                      for (const e of error['errors']) {
                        const control: FormControl | FormGroup = this[e.param];
                  Severity: Minor
                  Found in src/app/articles/reply-form/reply-form.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 onValidationError has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                    private onValidationError(error: any): void {
                      const noControlErrors = [];
                  
                      for (const e of error['errors']) {
                        const control: FormControl | FormGroup = this[e.param];
                  Severity: Minor
                  Found in src/app/articles/comment-form/comment-form.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 parse has a Cognitive Complexity of 7 (exceeds 5 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 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 of has a Cognitive Complexity of 7 (exceeds 5 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: Minor
                  Found in src/app/shared/enum/date-range-pattern.enum.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/articles/article-list/article.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

                  Severity
                  Category
                  Status
                  Source
                  Language