aureooms/texshake

View on GitHub

Showing 11 of 22 total issues

File shaker.js has 566 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import { StopIteration } from '@aureooms/js-itertools' ;
import { ast } from '@aureooms/js-grammar' ;
import tape from '@aureooms/js-tape' ;

import visitor from './visitor' ;
Severity: Major
Found in src/transform/shaker.js - About 1 day to fix

    Function _tokens has a Cognitive Complexity of 59 (exceeds 5 allowed). Consider refactoring.
    Open

    async function* _tokens ( tape ) {
    
      let line = FIRST_LINE ;
      let position = FIRST_POSITION;
    
    
    Severity: Minor
    Found in src/tokens.js - About 1 day 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 _tokens has 126 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    async function* _tokens ( tape ) {
    
      let line = FIRST_LINE ;
      let position = FIRST_POSITION;
    
    
    Severity: Major
    Found in src/tokens.js - About 5 hrs to fix

      Function begin-environment has 30 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          "begin-environment": async ( tree , match , ctx ) => {
      
            const it = iter(tree.children) ;
      
            const begincmd = await next(it) ; // \begin
      Severity: Minor
      Found in src/transform/shaker.js - About 1 hr to fix

        Function end-environment has 29 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            "end-environment": async ( tree , match , ctx ) => {
        
              const it = iter(tree.children) ;
        
              const endcmd = await next(it) ; // \end
        Severity: Minor
        Found in src/transform/shaker.js - About 1 hr to fix

          Avoid deeply nested control flow statements.
          Open

                  if ( d === tape.eof || d === '\n' ) break ;
          Severity: Major
          Found in src/tokens.js - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                  if ( cmd === '\\' ) {
                    // single character command name (any character)
                    cmd += d;
                  }
                  else {
            Severity: Major
            Found in src/tokens.js - About 45 mins to fix

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

                  "ifcmd": async ( tree , match , ctx ) => {
              
                    const it = iter(tree.children) ;
              
                    const ifcmd = await next(it) ; // \if...
              Severity: Minor
              Found in src/transform/shaker.js - 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 othercmd has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                  "othercmd": async ( tree , match , ctx ) => {
              
                    const it = iter(tree.children) ;
              
                    const othercmd = await next(it) ;
              Severity: Minor
              Found in src/transform/shaker.js - 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 begin-environment has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  "begin-environment": async ( tree , match , ctx ) => {
              
                    const it = iter(tree.children) ;
              
                    const begincmd = await next(it) ; // \begin
              Severity: Minor
              Found in src/transform/shaker.js - 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

              Function chain has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

              async function* chain ( iterables ) {
              
                for ( const iterable of iterables ) {
                  if ( iterable[Symbol.iterator] ) yield* iterable ;
                  else for await ( const item of iterable ) yield item ;
              Severity: Minor
              Found in src/transform/shaker.js - 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