mtxr/vscode-sqltools

View on GitHub
packages/formatter/src/core/Tokenizer.ts

Summary

Maintainability
D
2 days
Test Coverage

Tokenizer has 36 functions (exceeds 20 allowed). Consider refactoring.
Open

export default class Tokenizer {
  public WHITESPACE_REGEX: RegExp;
  public NUMBER_REGEX: RegExp;
  public AMBIGUOS_OPERATOR_REGEX: RegExp;
  public OPERATOR_REGEX: RegExp;
Severity: Minor
Found in packages/formatter/src/core/Tokenizer.ts - About 4 hrs to fix

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

      getIndexedPlaceholderToken(input: string): Token {
        return this.getPlaceholderTokenWithKey({
          input,
          regex: this.INDEXED_PLACEHOLDER_REGEX,
          parseKey: v => v.slice(1),
    Severity: Major
    Found in packages/formatter/src/core/Tokenizer.ts and 1 other location - About 1 hr to fix
    packages/formatter/src/core/Tokenizer.ts on lines 243..249

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 62.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

      getIdentNamedPlaceholderToken(input: string): Token {
        return this.getPlaceholderTokenWithKey({
          input,
          regex: this.IDENT_NAMED_PLACEHOLDER_REGEX,
          parseKey: v => v.slice(1),
    Severity: Major
    Found in packages/formatter/src/core/Tokenizer.ts and 1 other location - About 1 hr to fix
    packages/formatter/src/core/Tokenizer.ts on lines 259..265

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 62.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 12 locations. Consider refactoring.
    Open

      getCloseParenToken(input: string): Token {
        return this.getTokenOnFirstMatch({
          input,
          type: TokenTypes.CLOSE_PAREN,
          regex: this.CLOSE_PAREN_REGEX,
    Severity: Major
    Found in packages/formatter/src/core/Tokenizer.ts and 11 other locations - About 55 mins to fix
    packages/formatter/src/core/Tokenizer.ts on lines 175..181
    packages/formatter/src/core/Tokenizer.ts on lines 187..193
    packages/formatter/src/core/Tokenizer.ts on lines 195..201
    packages/formatter/src/core/Tokenizer.ts on lines 203..209
    packages/formatter/src/core/Tokenizer.ts on lines 211..217
    packages/formatter/src/core/Tokenizer.ts on lines 297..303
    packages/formatter/src/core/Tokenizer.ts on lines 305..311
    packages/formatter/src/core/Tokenizer.ts on lines 327..333
    packages/formatter/src/core/Tokenizer.ts on lines 335..341
    packages/formatter/src/core/Tokenizer.ts on lines 343..349
    packages/formatter/src/core/Tokenizer.ts on lines 359..365

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 54.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 12 locations. Consider refactoring.
    Open

      getOpenParenToken(input: string): Token {
        return this.getTokenOnFirstMatch({
          input,
          type: TokenTypes.OPEN_PAREN,
          regex: this.OPEN_PAREN_REGEX,
    Severity: Major
    Found in packages/formatter/src/core/Tokenizer.ts and 11 other locations - About 55 mins to fix
    packages/formatter/src/core/Tokenizer.ts on lines 175..181
    packages/formatter/src/core/Tokenizer.ts on lines 187..193
    packages/formatter/src/core/Tokenizer.ts on lines 195..201
    packages/formatter/src/core/Tokenizer.ts on lines 203..209
    packages/formatter/src/core/Tokenizer.ts on lines 219..225
    packages/formatter/src/core/Tokenizer.ts on lines 297..303
    packages/formatter/src/core/Tokenizer.ts on lines 305..311
    packages/formatter/src/core/Tokenizer.ts on lines 327..333
    packages/formatter/src/core/Tokenizer.ts on lines 335..341
    packages/formatter/src/core/Tokenizer.ts on lines 343..349
    packages/formatter/src/core/Tokenizer.ts on lines 359..365

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 54.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 12 locations. Consider refactoring.
    Open

      getNoSpaceOperatorToken(input: string): Token {
        return this.getTokenOnFirstMatch({
          input,
          type: TokenTypes.NO_SPACE_OPERATOR,
          regex: this.NO_SPACE_OPERATOR_REGEX,
    Severity: Major
    Found in packages/formatter/src/core/Tokenizer.ts and 11 other locations - About 55 mins to fix
    packages/formatter/src/core/Tokenizer.ts on lines 175..181
    packages/formatter/src/core/Tokenizer.ts on lines 187..193
    packages/formatter/src/core/Tokenizer.ts on lines 195..201
    packages/formatter/src/core/Tokenizer.ts on lines 203..209
    packages/formatter/src/core/Tokenizer.ts on lines 211..217
    packages/formatter/src/core/Tokenizer.ts on lines 219..225
    packages/formatter/src/core/Tokenizer.ts on lines 297..303
    packages/formatter/src/core/Tokenizer.ts on lines 327..333
    packages/formatter/src/core/Tokenizer.ts on lines 335..341
    packages/formatter/src/core/Tokenizer.ts on lines 343..349
    packages/formatter/src/core/Tokenizer.ts on lines 359..365

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 54.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 12 locations. Consider refactoring.
    Open

      getLineCommentToken(input: string): Token {
        return this.getTokenOnFirstMatch({
          input,
          type: TokenTypes.LINE_COMMENT,
          regex: this.LINE_COMMENT_REGEX,
    Severity: Major
    Found in packages/formatter/src/core/Tokenizer.ts and 11 other locations - About 55 mins to fix
    packages/formatter/src/core/Tokenizer.ts on lines 175..181
    packages/formatter/src/core/Tokenizer.ts on lines 195..201
    packages/formatter/src/core/Tokenizer.ts on lines 203..209
    packages/formatter/src/core/Tokenizer.ts on lines 211..217
    packages/formatter/src/core/Tokenizer.ts on lines 219..225
    packages/formatter/src/core/Tokenizer.ts on lines 297..303
    packages/formatter/src/core/Tokenizer.ts on lines 305..311
    packages/formatter/src/core/Tokenizer.ts on lines 327..333
    packages/formatter/src/core/Tokenizer.ts on lines 335..341
    packages/formatter/src/core/Tokenizer.ts on lines 343..349
    packages/formatter/src/core/Tokenizer.ts on lines 359..365

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 54.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 12 locations. Consider refactoring.
    Open

      getPlainReservedToken(input: string): Token {
        return this.getTokenOnFirstMatch({
          input,
          type: TokenTypes.RESERVED,
          regex: this.RESERVED_PLAIN_REGEX,
    Severity: Major
    Found in packages/formatter/src/core/Tokenizer.ts and 11 other locations - About 55 mins to fix
    packages/formatter/src/core/Tokenizer.ts on lines 175..181
    packages/formatter/src/core/Tokenizer.ts on lines 187..193
    packages/formatter/src/core/Tokenizer.ts on lines 195..201
    packages/formatter/src/core/Tokenizer.ts on lines 203..209
    packages/formatter/src/core/Tokenizer.ts on lines 211..217
    packages/formatter/src/core/Tokenizer.ts on lines 219..225
    packages/formatter/src/core/Tokenizer.ts on lines 297..303
    packages/formatter/src/core/Tokenizer.ts on lines 305..311
    packages/formatter/src/core/Tokenizer.ts on lines 327..333
    packages/formatter/src/core/Tokenizer.ts on lines 335..341
    packages/formatter/src/core/Tokenizer.ts on lines 359..365

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 54.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 12 locations. Consider refactoring.
    Open

      getToplevelReservedToken(input: string): Token {
        return this.getTokenOnFirstMatch({
          input,
          type: TokenTypes.RESERVED_TOP_LEVEL,
          regex: this.RESERVED_TOP_LEVEL_REGEX,
    Severity: Major
    Found in packages/formatter/src/core/Tokenizer.ts and 11 other locations - About 55 mins to fix
    packages/formatter/src/core/Tokenizer.ts on lines 175..181
    packages/formatter/src/core/Tokenizer.ts on lines 187..193
    packages/formatter/src/core/Tokenizer.ts on lines 195..201
    packages/formatter/src/core/Tokenizer.ts on lines 203..209
    packages/formatter/src/core/Tokenizer.ts on lines 211..217
    packages/formatter/src/core/Tokenizer.ts on lines 219..225
    packages/formatter/src/core/Tokenizer.ts on lines 297..303
    packages/formatter/src/core/Tokenizer.ts on lines 305..311
    packages/formatter/src/core/Tokenizer.ts on lines 335..341
    packages/formatter/src/core/Tokenizer.ts on lines 343..349
    packages/formatter/src/core/Tokenizer.ts on lines 359..365

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 54.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 12 locations. Consider refactoring.
    Open

      getBlockCommentToken(input: string): Token {
        return this.getTokenOnFirstMatch({
          input,
          type: TokenTypes.BLOCK_COMMENT,
          regex: this.BLOCK_COMMENT_REGEX,
    Severity: Major
    Found in packages/formatter/src/core/Tokenizer.ts and 11 other locations - About 55 mins to fix
    packages/formatter/src/core/Tokenizer.ts on lines 175..181
    packages/formatter/src/core/Tokenizer.ts on lines 187..193
    packages/formatter/src/core/Tokenizer.ts on lines 203..209
    packages/formatter/src/core/Tokenizer.ts on lines 211..217
    packages/formatter/src/core/Tokenizer.ts on lines 219..225
    packages/formatter/src/core/Tokenizer.ts on lines 297..303
    packages/formatter/src/core/Tokenizer.ts on lines 305..311
    packages/formatter/src/core/Tokenizer.ts on lines 327..333
    packages/formatter/src/core/Tokenizer.ts on lines 335..341
    packages/formatter/src/core/Tokenizer.ts on lines 343..349
    packages/formatter/src/core/Tokenizer.ts on lines 359..365

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 54.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 12 locations. Consider refactoring.
    Open

      getWhitespaceToken(input: string): Token {
        return this.getTokenOnFirstMatch({
          input,
          type: TokenTypes.WHITESPACE,
          regex: this.WHITESPACE_REGEX,
    Severity: Major
    Found in packages/formatter/src/core/Tokenizer.ts and 11 other locations - About 55 mins to fix
    packages/formatter/src/core/Tokenizer.ts on lines 187..193
    packages/formatter/src/core/Tokenizer.ts on lines 195..201
    packages/formatter/src/core/Tokenizer.ts on lines 203..209
    packages/formatter/src/core/Tokenizer.ts on lines 211..217
    packages/formatter/src/core/Tokenizer.ts on lines 219..225
    packages/formatter/src/core/Tokenizer.ts on lines 297..303
    packages/formatter/src/core/Tokenizer.ts on lines 305..311
    packages/formatter/src/core/Tokenizer.ts on lines 327..333
    packages/formatter/src/core/Tokenizer.ts on lines 335..341
    packages/formatter/src/core/Tokenizer.ts on lines 343..349
    packages/formatter/src/core/Tokenizer.ts on lines 359..365

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 54.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 12 locations. Consider refactoring.
    Open

      getNewlineReservedToken(input: string): Token {
        return this.getTokenOnFirstMatch({
          input,
          type: TokenTypes.RESERVED_NEWLINE,
          regex: this.RESERVED_NEWLINE_REGEX,
    Severity: Major
    Found in packages/formatter/src/core/Tokenizer.ts and 11 other locations - About 55 mins to fix
    packages/formatter/src/core/Tokenizer.ts on lines 175..181
    packages/formatter/src/core/Tokenizer.ts on lines 187..193
    packages/formatter/src/core/Tokenizer.ts on lines 195..201
    packages/formatter/src/core/Tokenizer.ts on lines 203..209
    packages/formatter/src/core/Tokenizer.ts on lines 211..217
    packages/formatter/src/core/Tokenizer.ts on lines 219..225
    packages/formatter/src/core/Tokenizer.ts on lines 297..303
    packages/formatter/src/core/Tokenizer.ts on lines 305..311
    packages/formatter/src/core/Tokenizer.ts on lines 327..333
    packages/formatter/src/core/Tokenizer.ts on lines 343..349
    packages/formatter/src/core/Tokenizer.ts on lines 359..365

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 54.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 12 locations. Consider refactoring.
    Open

      getWordToken(input: string): Token {
        return this.getTokenOnFirstMatch({
          input,
          type: TokenTypes.WORD,
          regex: this.WORD_REGEX,
    Severity: Major
    Found in packages/formatter/src/core/Tokenizer.ts and 11 other locations - About 55 mins to fix
    packages/formatter/src/core/Tokenizer.ts on lines 175..181
    packages/formatter/src/core/Tokenizer.ts on lines 187..193
    packages/formatter/src/core/Tokenizer.ts on lines 195..201
    packages/formatter/src/core/Tokenizer.ts on lines 203..209
    packages/formatter/src/core/Tokenizer.ts on lines 211..217
    packages/formatter/src/core/Tokenizer.ts on lines 219..225
    packages/formatter/src/core/Tokenizer.ts on lines 297..303
    packages/formatter/src/core/Tokenizer.ts on lines 305..311
    packages/formatter/src/core/Tokenizer.ts on lines 327..333
    packages/formatter/src/core/Tokenizer.ts on lines 335..341
    packages/formatter/src/core/Tokenizer.ts on lines 343..349

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 54.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 12 locations. Consider refactoring.
    Open

      getStringToken(input: string): Token {
        return this.getTokenOnFirstMatch({
          input,
          type: TokenTypes.STRING,
          regex: this.STRING_REGEX,
    Severity: Major
    Found in packages/formatter/src/core/Tokenizer.ts and 11 other locations - About 55 mins to fix
    packages/formatter/src/core/Tokenizer.ts on lines 175..181
    packages/formatter/src/core/Tokenizer.ts on lines 187..193
    packages/formatter/src/core/Tokenizer.ts on lines 195..201
    packages/formatter/src/core/Tokenizer.ts on lines 211..217
    packages/formatter/src/core/Tokenizer.ts on lines 219..225
    packages/formatter/src/core/Tokenizer.ts on lines 297..303
    packages/formatter/src/core/Tokenizer.ts on lines 305..311
    packages/formatter/src/core/Tokenizer.ts on lines 327..333
    packages/formatter/src/core/Tokenizer.ts on lines 335..341
    packages/formatter/src/core/Tokenizer.ts on lines 343..349
    packages/formatter/src/core/Tokenizer.ts on lines 359..365

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 54.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 12 locations. Consider refactoring.
    Open

      getAmbiguosOperatorToken(input: string): Token {
        return this.getTokenOnFirstMatch({
          input,
          type: TokenTypes.OPERATOR,
          regex: this.AMBIGUOS_OPERATOR_REGEX,
    Severity: Major
    Found in packages/formatter/src/core/Tokenizer.ts and 11 other locations - About 55 mins to fix
    packages/formatter/src/core/Tokenizer.ts on lines 175..181
    packages/formatter/src/core/Tokenizer.ts on lines 187..193
    packages/formatter/src/core/Tokenizer.ts on lines 195..201
    packages/formatter/src/core/Tokenizer.ts on lines 203..209
    packages/formatter/src/core/Tokenizer.ts on lines 211..217
    packages/formatter/src/core/Tokenizer.ts on lines 219..225
    packages/formatter/src/core/Tokenizer.ts on lines 305..311
    packages/formatter/src/core/Tokenizer.ts on lines 327..333
    packages/formatter/src/core/Tokenizer.ts on lines 335..341
    packages/formatter/src/core/Tokenizer.ts on lines 343..349
    packages/formatter/src/core/Tokenizer.ts on lines 359..365

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 54.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

          this.getWhitespaceToken(input) ||
          this.getCommentToken(input) ||
          this.getStringToken(input) ||
          this.getOpenParenToken(input) ||
    Severity: Minor
    Found in packages/formatter/src/core/Tokenizer.ts and 1 other location - About 30 mins to fix
    packages/formatter/src/core/Tokenizer.ts on lines 320..323

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 45.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

          this.getToplevelReservedToken(input) ||
          this.getNewlineReservedToken(input) ||
          this.getTopLevelReservedTokenNoIndent(input) ||
          this.getPlainReservedToken(input)
    Severity: Minor
    Found in packages/formatter/src/core/Tokenizer.ts and 1 other location - About 30 mins to fix
    packages/formatter/src/core/Tokenizer.ts on lines 159..162

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 45.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    There are no issues that match your filters.

    Category
    Status