luke-j/switch

View on GitHub

Showing 30 of 30 total issues

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

    ssl() {
        const expression = {
            expressions: []
        };

Severity: Minor
Found in src/syntax/NginxSyntax.js - About 1 hr to fix

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

        auth() {
            const expression = {
                expressions: []
            };
    
    
    Severity: Minor
    Found in src/syntax/NginxSyntax.js - About 1 hr to fix

      Function listDirectories has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          listDirectories() {
              return {
                  expressions: [
                      {
                          type: 'LocationBlock',
      Severity: Minor
      Found in src/syntax/ApacheSyntax.js - About 1 hr to fix

        Function redirect has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            redirect() {
                const expression = {
                    expressions: []
                };
        
        
        Severity: Minor
        Found in src/syntax/ApacheSyntax.js - About 1 hr to fix

          Function _buildConf has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              _buildConf(server) {
                  const config = new Config(this._use, server, this._config[server]);
                  let builder;
          
                  switch (this._use) {
          Severity: Minor
          Found in src/commands/To.js - About 1 hr to fix

            Function _expression has 26 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                _expression(expression) {
                    if (!expression.hasOwnProperty('type')) {
                        throw new Error('Expression must have a type');
                    }
            
            
            Severity: Minor
            Found in src/compiler/NginxCompiler.js - About 1 hr to fix

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

                  static main(scriptArgs = []) {
                      const args = {};
                      for (let x = 0, length = scriptArgs.length; x < length; x += 2) {
                          args[scriptArgs[x].replace(/^\-{2}/, '')] = scriptArgs[x + 1];
                      }
              Severity: Minor
              Found in src/Switch.js - About 1 hr to fix

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

                    headers() {
                        const expression = {
                            expressions: []
                        };
                
                
                Severity: Minor
                Found in src/syntax/NginxSyntax.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 main has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    static main(scriptArgs = []) {
                        const args = {};
                        for (let x = 0, length = scriptArgs.length; x < length; x += 2) {
                            args[scriptArgs[x].replace(/^\-{2}/, '')] = scriptArgs[x + 1];
                        }
                Severity: Minor
                Found in src/Switch.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 _compileContext has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    _compileContext(context) {
                        for (const option in context.Config.options) {
                            if (context.Config.options.hasOwnProperty(option)) {
                                if (typeof context.Syntax[option] !== 'function') {
                                    SpiderMonkey.print(`Invalid option "${option}"`);
                Severity: Minor
                Found in src/Generator.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