luke-j/switch

View on GitHub

Showing 30 of 30 total issues

File ApacheSyntax.js has 620 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/**
 * @license
 *
 * Copyright 2016- Luke Jones (https://github.com/luke-j)
 *
Severity: Major
Found in src/syntax/ApacheSyntax.js - About 1 day to fix

    File NginxSyntax.js has 598 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /**
     * @license
     *
     * Copyright 2016- Luke Jones (https://github.com/luke-j)
     *
    Severity: Major
    Found in src/syntax/NginxSyntax.js - About 1 day to fix

      Function proxy has 135 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          proxy() {
              const expression = {
                  expressions: []
              };
      
      
      Severity: Major
      Found in src/syntax/NginxSyntax.js - About 5 hrs to fix

        Function fastcgi has 103 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            fastcgi() {
                const expression = {
                    expressions: []
                };
        
        
        Severity: Major
        Found in src/syntax/ApacheSyntax.js - About 4 hrs to fix

          Function _deepAssign has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
          Open

              _deepAssign(target, source) {
                  const deeplyAssigned = {};
                  for (const option in target) {
                      if (target.hasOwnProperty(option)) {
                          if (source.hasOwnProperty(option)) {
          Severity: Minor
          Found in src/Config.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 proxy has 68 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              proxy() {
                  const expression = {
                      expressions: []
                  };
          
          
          Severity: Major
          Found in src/syntax/ApacheSyntax.js - About 2 hrs to fix

            Function compress has 61 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                compress() {
                    const expression = {
                        expressions: []
                    };
            
            
            Severity: Major
            Found in src/syntax/NginxSyntax.js - About 2 hrs to fix

              Function constructor has 54 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  constructor(type, server, config) {
                      this._defaults = {
                          name: server,
                          ssl: {
                              enable: false,
              Severity: Major
              Found in src/Config.js - About 2 hrs to fix

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

                    auth() {
                        const expression = {
                            expressions: []
                        };
                
                
                Severity: Major
                Found in src/syntax/ApacheSyntax.js - About 2 hrs to fix

                  Function fastcgi has 51 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      fastcgi() {
                          const expression = {
                              expressions: []
                          };
                  
                  
                  Severity: Major
                  Found in src/syntax/NginxSyntax.js - About 2 hrs to fix

                    Function caching has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

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

                      Function headers has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

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

                        Function checkValidity has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                                function checkValidity(expression) {
                                    switch (expression.type) {
                                        case 'AssignmentExpression':
                                            expect(expression.left).to.exist;
                                            expect(expression.right).to.exist;
                        Severity: Minor
                        Found in test/lib/syntax/ApacheSyntax.js - About 1 hr to fix

                          Function headers has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

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

                            Function caching has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

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

                              Function compress has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

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

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

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

                                  Function _expression has 32 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/ApacheCompiler.js - About 1 hr to fix

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

                                        _parseLocations(config) {
                                            const locations = {};
                                            for (const option in config) {
                                                if (config.hasOwnProperty(option)) {
                                                    // locations must be objects
                                    Severity: Minor
                                    Found in src/Config.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 checkValidity has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                            function checkValidity(expression) {
                                                switch (expression.type) {
                                                    case 'AssignmentExpression':
                                                        expect(expression.left).to.exist;
                                                        expect(expression.right).to.exist;
                                    Severity: Minor
                                    Found in test/lib/syntax/NginxSyntax.js - About 1 hr to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language