GCSBOSS/api-joe

View on GitHub

Showing 5 of 5 total issues

Function installServices has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    installServices(app){
        app.global.services = {};
        app.global.domains = {};

        for(let name in app.conf.services){
Severity: Minor
Found in lib/services.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 exports has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

module.exports = () => new Nodecaf({
    api,
    conf: __dirname + '/default.toml',
    shouldParseBody: false,
    alwaysRebuildAPI: true,
Severity: Minor
Found in lib/main.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 SNICallback has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    async SNICallback(domain, cb){
        // this => app

        // TODO IS DOMAIN A SERVICE ?

Severity: Minor
Found in lib/acme.js - About 1 hr to fix

    Function routeRequest has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        routeRequest({ flash, params, headers, services, res, next, req }){
            let [ host ] = headers.host.split(':');
            let [ , prefix, ...path ] = params.path.split('/');
            host = host.toLowerCase();
            flash.service = services[host] || services[prefix];
    Severity: Minor
    Found in lib/services.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 pass has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        pass({ req, res, log, flash, conf }){
    
            let target = flash.service.url + (flash.removePrefix
                ? req.url.substr(flash.service.name.length + 1)
                : req.url);
    Severity: Minor
    Found in lib/proxy.js - About 1 hr to fix
      Severity
      Category
      Status
      Source
      Language