Showing 7 of 39 total issues

Function generateJS has a Cognitive Complexity of 168 (exceeds 5 allowed). Consider refactoring.
Open

function generateJS( ast, session, options ) {

    const op = session.opcodes;

    /* Features that should be generated in the parser. */
Severity: Minor
Found in packages/pegjs/lib/compiler/passes/generate-js.js - About 3 days 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 generateBytecode has a Cognitive Complexity of 91 (exceeds 5 allowed). Consider refactoring.
Open

function generateBytecode( ast, session ) {

    const op = session.opcodes;

    const literals = [];
Severity: Minor
Found in packages/pegjs/lib/compiler/passes/generate-bytecode.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 inferenceMatchResult has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
Open

function inferenceMatchResult( ast, session ) {

    let inference;
    function sometimesMatch( node ) {

Severity: Minor
Found in packages/pegjs/lib/compiler/passes/inference-match-result.js - About 4 hrs 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 addExtraOptions has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
Open

function addExtraOptions( config ) {

    if ( typeof config === "string" ) {

        try {
Severity: Minor
Found in packages/pegjs/bin/options.js - About 3 hrs 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 appendResult has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

    function appendResult( klass, title, url, inputSize, parseTime ) {
Severity: Minor
Found in tools/benchmark/browser.stub.js - About 35 mins to fix

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

    function publish( id ) {
    
        // paths
    
        const packagejson = require.resolve( id + "/package.json" );
    Severity: Minor
    Found in tools/publish-dev/publish.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 reportIncorrectPlucking has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

    function reportIncorrectPlucking( ast, session ) {
    
        session.buildVisitor( {
    
            action( node ) {
    Severity: Minor
    Found in packages/pegjs/lib/compiler/passes/report-incorrect-plucking.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