dmccarthy-dev/swagger-seneca-router

View on GitHub

Showing 208 of 208 total issues

Function validateOptions has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

const validateOptions = function ( options ){

    if ( !options || !options.senecaClient || !options.senecaClient.act ){
        throw new Error( 'senecaClient is required.' );
    }
Severity: Minor
Found in index.js - About 2 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 sendResp has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

const sendResp = function( result, context ){

    const res = context.res;

    if ( result.headers ){
Severity: Minor
Found in index.js - About 1 hr 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 handleErr has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

const handleErr = function( err, context){

    if ( err.seneca ){

        if ( !context.options.senecaErrorMode ) {
Severity: Minor
Found in index.js - About 1 hr 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 validateOptions has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const validateOptions = function ( options ){

    if ( !options || !options.senecaClient || !options.senecaClient.act ){
        throw new Error( 'senecaClient is required.' );
    }
Severity: Minor
Found in index.js - About 1 hr to fix

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

    const handleSenecaError = ( val, err, context ) => {
    
        if ( !val || val === 'error' ){
            return context.next( err );
        }
    Severity: Minor
    Found in index.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

    Trailing spaces
    Open

    - [Skip to Features Section](#features) 
    Severity: Info
    Found in README.md by markdownlint

    MD009 - Trailing spaces

    Tags: whitespace

    Aliases: no-trailing-spaces

    Parameters: br_spaces (number; default: 0)

    This rule is triggered on any lines that end with whitespace. To fix this, find the line that is triggered and remove any trailing spaces from the end.

    The brspaces parameter allows an exception to this rule for a specific amount of trailing spaces used to insert an explicit line break/br element. For example, set brspaces to 2 to allow exactly 2 spaces at the end of a line.

    Note: you have to set brspaces to 2 or higher for this exception to take effect - you can't insert a br element with just a single trailing space, so if you set brspaces to 1, the exception will be disabled, just as if it was set to the default of 0.

    Trailing spaces
    Open

    - [Skip to Matching API calls to Seneca Patterns Section](#matching-api-calls-to-seneca-pattern) 
    Severity: Info
    Found in README.md by markdownlint

    MD009 - Trailing spaces

    Tags: whitespace

    Aliases: no-trailing-spaces

    Parameters: br_spaces (number; default: 0)

    This rule is triggered on any lines that end with whitespace. To fix this, find the line that is triggered and remove any trailing spaces from the end.

    The brspaces parameter allows an exception to this rule for a specific amount of trailing spaces used to insert an explicit line break/br element. For example, set brspaces to 2 to allow exactly 2 spaces at the end of a line.

    Note: you have to set brspaces to 2 or higher for this exception to take effect - you can't insert a br element with just a single trailing space, so if you set brspaces to 1, the exception will be disabled, just as if it was set to the default of 0.

    Trailing spaces
    Open

        license: 
    Severity: Info
    Found in README.md by markdownlint

    MD009 - Trailing spaces

    Tags: whitespace

    Aliases: no-trailing-spaces

    Parameters: br_spaces (number; default: 0)

    This rule is triggered on any lines that end with whitespace. To fix this, find the line that is triggered and remove any trailing spaces from the end.

    The brspaces parameter allows an exception to this rule for a specific amount of trailing spaces used to insert an explicit line break/br element. For example, set brspaces to 2 to allow exactly 2 spaces at the end of a line.

    Note: you have to set brspaces to 2 or higher for this exception to take effect - you can't insert a br element with just a single trailing space, so if you set brspaces to 1, the exception will be disabled, just as if it was set to the default of 0.

    Trailing spaces
    Open

      produces: 
    Severity: Info
    Found in README.md by markdownlint

    MD009 - Trailing spaces

    Tags: whitespace

    Aliases: no-trailing-spaces

    Parameters: br_spaces (number; default: 0)

    This rule is triggered on any lines that end with whitespace. To fix this, find the line that is triggered and remove any trailing spaces from the end.

    The brspaces parameter allows an exception to this rule for a specific amount of trailing spaces used to insert an explicit line break/br element. For example, set brspaces to 2 to allow exactly 2 spaces at the end of a line.

    Note: you have to set brspaces to 2 or higher for this exception to take effect - you can't insert a br element with just a single trailing space, so if you set brspaces to 1, the exception will be disabled, just as if it was set to the default of 0.

    Trailing spaces
    Open

            parameters: 
    Severity: Info
    Found in README.md by markdownlint

    MD009 - Trailing spaces

    Tags: whitespace

    Aliases: no-trailing-spaces

    Parameters: br_spaces (number; default: 0)

    This rule is triggered on any lines that end with whitespace. To fix this, find the line that is triggered and remove any trailing spaces from the end.

    The brspaces parameter allows an exception to this rule for a specific amount of trailing spaces used to insert an explicit line break/br element. For example, set brspaces to 2 to allow exactly 2 spaces at the end of a line.

    Note: you have to set brspaces to 2 or higher for this exception to take effect - you can't insert a br element with just a single trailing space, so if you set brspaces to 1, the exception will be disabled, just as if it was set to the default of 0.

    Trailing spaces
    Open

        Pet: 
    Severity: Info
    Found in README.md by markdownlint

    MD009 - Trailing spaces

    Tags: whitespace

    Aliases: no-trailing-spaces

    Parameters: br_spaces (number; default: 0)

    This rule is triggered on any lines that end with whitespace. To fix this, find the line that is triggered and remove any trailing spaces from the end.

    The brspaces parameter allows an exception to this rule for a specific amount of trailing spaces used to insert an explicit line break/br element. For example, set brspaces to 2 to allow exactly 2 spaces at the end of a line.

    Note: you have to set brspaces to 2 or higher for this exception to take effect - you can't insert a br element with just a single trailing space, so if you set brspaces to 1, the exception will be disabled, just as if it was set to the default of 0.

    Trailing spaces
    Open

              required: 
    Severity: Info
    Found in README.md by markdownlint

    MD009 - Trailing spaces

    Tags: whitespace

    Aliases: no-trailing-spaces

    Parameters: br_spaces (number; default: 0)

    This rule is triggered on any lines that end with whitespace. To fix this, find the line that is triggered and remove any trailing spaces from the end.

    The brspaces parameter allows an exception to this rule for a specific amount of trailing spaces used to insert an explicit line break/br element. For example, set brspaces to 2 to allow exactly 2 spaces at the end of a line.

    Note: you have to set brspaces to 2 or higher for this exception to take effect - you can't insert a br element with just a single trailing space, so if you set brspaces to 1, the exception will be disabled, just as if it was set to the default of 0.

    Trailing spaces
    Open

            code: 
    Severity: Info
    Found in README.md by markdownlint

    MD009 - Trailing spaces

    Tags: whitespace

    Aliases: no-trailing-spaces

    Parameters: br_spaces (number; default: 0)

    This rule is triggered on any lines that end with whitespace. To fix this, find the line that is triggered and remove any trailing spaces from the end.

    The brspaces parameter allows an exception to this rule for a specific amount of trailing spaces used to insert an explicit line break/br element. For example, set brspaces to 2 to allow exactly 2 spaces at the end of a line.

    Note: you have to set brspaces to 2 or higher for this exception to take effect - you can't insert a br element with just a single trailing space, so if you set brspaces to 1, the exception will be disabled, just as if it was set to the default of 0.

    Trailing spaces
    Open

        produces: 
    Severity: Info
    Found in README.md by markdownlint

    MD009 - Trailing spaces

    Tags: whitespace

    Aliases: no-trailing-spaces

    Parameters: br_spaces (number; default: 0)

    This rule is triggered on any lines that end with whitespace. To fix this, find the line that is triggered and remove any trailing spaces from the end.

    The brspaces parameter allows an exception to this rule for a specific amount of trailing spaces used to insert an explicit line break/br element. For example, set brspaces to 2 to allow exactly 2 spaces at the end of a line.

    Note: you have to set brspaces to 2 or higher for this exception to take effect - you can't insert a br element with just a single trailing space, so if you set brspaces to 1, the exception will be disabled, just as if it was set to the default of 0.

    Trailing spaces
    Open

        
    Severity: Info
    Found in README.md by markdownlint

    MD009 - Trailing spaces

    Tags: whitespace

    Aliases: no-trailing-spaces

    Parameters: br_spaces (number; default: 0)

    This rule is triggered on any lines that end with whitespace. To fix this, find the line that is triggered and remove any trailing spaces from the end.

    The brspaces parameter allows an exception to this rule for a specific amount of trailing spaces used to insert an explicit line break/br element. For example, set brspaces to 2 to allow exactly 2 spaces at the end of a line.

    Note: you have to set brspaces to 2 or higher for this exception to take effect - you can't insert a br element with just a single trailing space, so if you set brspaces to 1, the exception will be disabled, just as if it was set to the default of 0.

    Trailing spaces
    Open

            responses: 
    Severity: Info
    Found in README.md by markdownlint

    MD009 - Trailing spaces

    Tags: whitespace

    Aliases: no-trailing-spaces

    Parameters: br_spaces (number; default: 0)

    This rule is triggered on any lines that end with whitespace. To fix this, find the line that is triggered and remove any trailing spaces from the end.

    The brspaces parameter allows an exception to this rule for a specific amount of trailing spaces used to insert an explicit line break/br element. For example, set brspaces to 2 to allow exactly 2 spaces at the end of a line.

    Note: you have to set brspaces to 2 or higher for this exception to take effect - you can't insert a br element with just a single trailing space, so if you set brspaces to 1, the exception will be disabled, just as if it was set to the default of 0.

    Trailing spaces
    Open

                id: 
    Severity: Info
    Found in README.md by markdownlint

    MD009 - Trailing spaces

    Tags: whitespace

    Aliases: no-trailing-spaces

    Parameters: br_spaces (number; default: 0)

    This rule is triggered on any lines that end with whitespace. To fix this, find the line that is triggered and remove any trailing spaces from the end.

    The brspaces parameter allows an exception to this rule for a specific amount of trailing spaces used to insert an explicit line break/br element. For example, set brspaces to 2 to allow exactly 2 spaces at the end of a line.

    Note: you have to set brspaces to 2 or higher for this exception to take effect - you can't insert a br element with just a single trailing space, so if you set brspaces to 1, the exception will be disabled, just as if it was set to the default of 0.

    Trailing spaces
    Open

          required: 
    Severity: Info
    Found in README.md by markdownlint

    MD009 - Trailing spaces

    Tags: whitespace

    Aliases: no-trailing-spaces

    Parameters: br_spaces (number; default: 0)

    This rule is triggered on any lines that end with whitespace. To fix this, find the line that is triggered and remove any trailing spaces from the end.

    The brspaces parameter allows an exception to this rule for a specific amount of trailing spaces used to insert an explicit line break/br element. For example, set brspaces to 2 to allow exactly 2 spaces at the end of a line.

    Note: you have to set brspaces to 2 or higher for this exception to take effect - you can't insert a br element with just a single trailing space, so if you set brspaces to 1, the exception will be disabled, just as if it was set to the default of 0.

    Line length
    Open

    - A middleware for using Swagger resource documents for pre-route validation (Node only)
    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

    Extracting patterns from incoming requests is only half the story; the other half is converting the data emitted from our Seneca micro-service into a http response. The result and error objects can be structured two ways: 1) with the properties code, body, and headers or 2) just plain object. When the code, body, or header is not detected the object is stringified and sent as the http response. By default the http code is set to 200 for a result and 500 for an error.   
    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