pavlitsky/vscode-yard

View on GitHub

Showing 16 of 16 total issues

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

  constructor(text: string) {
    const match: RegExpExecArray = this.regExp.exec(text);
    if (match) {
      const [, name, params] = match;
      this.parsedName = name;
Severity: Major
Found in src/parsers/definitions/method.ts and 2 other locations - About 2 hrs to fix
src/parsers/definitions/attribute.ts on lines 25..32
src/parsers/definitions/class_or_module.ts on lines 14..21

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 79.

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 3 locations. Consider refactoring.
Open

  constructor(text: string) {
    const match: RegExpExecArray = this.regExp.exec(text);
    if (match) {
      const [, type, name] = match;
      this.parsedType = type;
Severity: Major
Found in src/parsers/definitions/class_or_module.ts and 2 other locations - About 2 hrs to fix
src/parsers/definitions/attribute.ts on lines 25..32
src/parsers/definitions/method.ts on lines 28..35

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 79.

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 3 locations. Consider refactoring.
Open

  constructor(text: string) {
    const match: RegExpExecArray = this.regExp.exec(text);
    if (match) {
      const [, accessor, name] = match;
      this.parsedName = name;
Severity: Major
Found in src/parsers/definitions/attribute.ts and 2 other locations - About 2 hrs to fix
src/parsers/definitions/class_or_module.ts on lines 14..21
src/parsers/definitions/method.ts on lines 28..35

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 79.

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

export class ReturnTag extends TagWithTypes {
  constructor(params: ReturnTag = {} as ReturnTag) {
    super(params);

    const {
Severity: Major
Found in src/tags/return.ts and 1 other location - About 1 hr to fix
src/tags/param.ts on lines 5..15

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 74.

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

export class ParamTag extends TagWithOptions {
  constructor(params: ParamTag = {} as ParamTag) {
    super(params);

    const {
Severity: Major
Found in src/tags/param.ts and 1 other location - About 1 hr to fix
src/tags/return.ts on lines 5..15

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 74.

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

Consider simplifying this complex logical expression.
Open

    if (
      (beforeDescription && this.config.get("beforeDescription")) ||
      (beforeTags && this.config.get("beforeTags")) ||
      (separateTags && this.config.get("separateTags")) ||
      (beforeSingleTag && this.config.get("beforeSingleTag"))
Severity: Critical
Found in src/renderers/snippet_string/spacer_helper.ts - About 1 hr to fix

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

          (beforeDescription && this.config.get("beforeDescription")) ||
          (beforeTags && this.config.get("beforeTags")) ||
          (separateTags && this.config.get("separateTags")) ||
    Severity: Major
    Found in src/renderers/snippet_string/spacer_helper.ts and 1 other location - About 1 hr to fix
    src/renderers/snippet_string/spacer_helper.ts on lines 50..52

    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 57.

    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

          (afterDescription && this.config.get("afterDescription")) ||
          (afterTags && this.config.get("afterTags")) ||
          (afterSingleTag && this.config.get("afterSingleTag"))
    Severity: Major
    Found in src/renderers/snippet_string/spacer_helper.ts and 1 other location - About 1 hr to fix
    src/renderers/snippet_string/spacer_helper.ts on lines 34..36

    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 57.

    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

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

      public beforeEntity(entity: IEntity, entities: IEntity[], index: number) {
        this.updateContext(entity, entities, index);
    
        const beforeDescription = this.isText;
        const beforeTags = this.isFirstTag && !this.isSingleTag;
    Severity: Minor
    Found in src/renderers/snippet_string/spacer_helper.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

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

      public readonly regExp = new RegExp([
          /^\s*/, // whitespace
          /(?:(?:(?:attr|mattr|cattr)_(reader|writer|accessor))|(?:class_attribute))/, // attribute scope and access type
          /\s+/, // whitespace
          /:([a-z][a-zA-Z0-9_]*).*/, // attribute name
    Severity: Minor
    Found in src/parsers/definitions/attribute.ts and 1 other location - About 55 mins to fix
    src/parsers/definitions/method.ts on lines 14..20

    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 53.

    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

      public readonly regExp = new RegExp([
          /(?:def)\s+/, // def
          /(?:self)?\.?/, // self.
          /([a-zA-Z_\u3000-\u303f\u3040-\u309f\u30a0-\u30ff\uff00-\uff9f\u4e00-\u9faf\u3400-\u4dbf][a-zA-Z_0-9\u3000-\u303f\u3040-\u309f\u30a0-\u30ff\uff00-\uff9f\u4e00-\u9faf\u3400-\u4dbf]+[!?=]?|\+|-|\*|\*\*|\/|%|&|\^|>>|<<|==|!=|===|=~|!~|<=>|<|<=|>|>=|\[\]=|\[\]|\+@|-@|!@|~@)?/, // method name
          /(\(.*\)|[^;].*)?/, // method parameters
    Severity: Minor
    Found in src/parsers/definitions/method.ts and 1 other location - About 55 mins to fix
    src/parsers/definitions/attribute.ts on lines 11..17

    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 53.

    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

    Consider simplifying this complex logical expression.
    Open

        if (
          (afterDescription && this.config.get("afterDescription")) ||
          (afterTags && this.config.get("afterTags")) ||
          (afterSingleTag && this.config.get("afterSingleTag"))
        ) {
    Severity: Major
    Found in src/renderers/snippet_string/spacer_helper.ts - About 40 mins to fix

      Line length
      Open

      "yard.tags.paramNameBeforeType" // Print param name before its type (for example '@param username [String]')
      Severity: Info
      Found in README.md by markdownlint

      MD013 - Line length

      Tags: line_length

      Aliases: line-length Parameters: linelength, codeblocks, tables (number; default 80, boolean; default true)

      This rule is triggered when there are lines that are longer than the configured line length (default: 80 characters). To fix this, split the line up into multiple lines.

      This rule has an exception where there is no whitespace beyond the configured line length. This allows you to still include items such as long URLs without being forced to break them in the middle.

      You also have the option to exclude this rule for code blocks and tables. To do this, set the code_blocks and/or tables parameters to false.

      Code blocks are included in this rule by default since it is often a requirement for document readability, and tentatively compatible with code rules. Still, some languages do not lend themselves to short lines.

      Line length
      Open

      "yard.spacers.afterSingleTag" // Append an empty line to directives or single tags (for example constants)
      Severity: Info
      Found in README.md by markdownlint

      MD013 - Line length

      Tags: line_length

      Aliases: line-length Parameters: linelength, codeblocks, tables (number; default 80, boolean; default true)

      This rule is triggered when there are lines that are longer than the configured line length (default: 80 characters). To fix this, split the line up into multiple lines.

      This rule has an exception where there is no whitespace beyond the configured line length. This allows you to still include items such as long URLs without being forced to break them in the middle.

      You also have the option to exclude this rule for code blocks and tables. To do this, set the code_blocks and/or tables parameters to false.

      Code blocks are included in this rule by default since it is often a requirement for document readability, and tentatively compatible with code rules. Still, some languages do not lend themselves to short lines.

      Line length
      Open

      "yard.spacers.separateTags" // Separate method's tags of the same name (@params and @return) with an empty line
      Severity: Info
      Found in README.md by markdownlint

      MD013 - Line length

      Tags: line_length

      Aliases: line-length Parameters: linelength, codeblocks, tables (number; default 80, boolean; default true)

      This rule is triggered when there are lines that are longer than the configured line length (default: 80 characters). To fix this, split the line up into multiple lines.

      This rule has an exception where there is no whitespace beyond the configured line length. This allows you to still include items such as long URLs without being forced to break them in the middle.

      You also have the option to exclude this rule for code blocks and tables. To do this, set the code_blocks and/or tables parameters to false.

      Code blocks are included in this rule by default since it is often a requirement for document readability, and tentatively compatible with code rules. Still, some languages do not lend themselves to short lines.

      Line length
      Open

      "yard.spacers.beforeSingleTag" // Prepend an empty line to directives or single tags (for example constants)
      Severity: Info
      Found in README.md by markdownlint

      MD013 - Line length

      Tags: line_length

      Aliases: line-length Parameters: linelength, codeblocks, tables (number; default 80, boolean; default true)

      This rule is triggered when there are lines that are longer than the configured line length (default: 80 characters). To fix this, split the line up into multiple lines.

      This rule has an exception where there is no whitespace beyond the configured line length. This allows you to still include items such as long URLs without being forced to break them in the middle.

      You also have the option to exclude this rule for code blocks and tables. To do this, set the code_blocks and/or tables parameters to false.

      Code blocks are included in this rule by default since it is often a requirement for document readability, and tentatively compatible with code rules. Still, some languages do not lend themselves to short lines.

      Severity
      Category
      Status
      Source
      Language