pavlitsky/vscode-yard

View on GitHub

Showing 3 of 16 total issues

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

    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

    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
      Severity
      Category
      Status
      Source
      Language