elcharitas/waxe

View on GitHub

Showing 4 of 70 total issues

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

async function main() {
    const app = new docs.Application();
    const pages = {};
    
    app.options.addReader(new docs.TSConfigReader);
Severity: Minor
Found in docs/generate.js - About 1 hr to fix

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

    export function parseString(literal: WaxLiteral, argLiteral?: WaxLiteral, createScope?: boolean): string {
        const list: string[] = literal.split('');
        let inString: string = null;
    
        list.forEach((char: string, index: number, list: string[], nextChar: string = list[index + 1]) => {
    Severity: Minor
    Found in src/compiler/parser.ts - About 1 hr to fix

      Function parsePath has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

      function parsePath(path: string, base_path: string): string {
          
          if(base_path === ''){
              base_path = '/';
          }
      Severity: Minor
      Found in src/compiler/index.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 debugType has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

      function debugType<T>(args: string[], constraint?: T, expected?: WaxPresenter | T): string[] {
          const expectedType: string = typeof expected;
          
          if(typeof constraint !== expectedType){
              args.push((expected as WaxPresenter)?.name || expectedType);
      Severity: Minor
      Found in src/debug/index.ts - About 25 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