rofrischmann/bredon

View on GitHub

Showing 47 of 459 total issues

Function generate has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

  generate(node: ASTNode): string {
    const generateValue = this.generate.bind(this)
    const customGenerator = this.generators[node.type]

    if (customGenerator) {
Severity: Minor
Found in packages/bredon/src/Generator.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 parseFloat has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  parseFloat(integerPart?: number, isNegative?: boolean = false): FloatNode {
    // floats can also start with a floating point
    // if the integer part is 0
    if (this.currentToken.type === 'floating_point') {
      const nextToken = this.getNextToken(1)
Severity: Minor
Found in packages/bredon/src/Parser.js - About 1 hr to fix

    Function traverseNode has 33 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      traverseNode(visitor: Object, node: ASTNode, parentPath: Path) {
        const methods = visitor[node.type]
    
        const nodePath = createPath(node, parentPath, this.context)
    
    
    Severity: Minor
    Found in packages/bredon/src/Traverser.js - About 1 hr to fix

      Function parseOperator has 32 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        parseOperator(): SimpleNode {
          if (this.currentToken.type === 'operator') {
            if (this.scope === 'expression') {
              return operator(this.currentToken.value)
            }
      Severity: Minor
      Found in packages/bredon/src/Parser.js - About 1 hr to fix

        Function createPath has 32 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export default function createPath(
          node: ASTNode,
          parentPath?: Path,
          context?: Object = {}
        ): Path {
        Severity: Minor
        Found in packages/bredon/src/utils/createPath.js - About 1 hr to fix

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

            walkTokens(): Node {
              this.updateCurrentToken()
          
              // the following token do not return a node
              // but rather add some flags
          Severity: Minor
          Found in packages/bredon/src/Parser.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 parseNumber has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

            parseNumber(
              isNegative?: boolean = false
            ): SimpleNode | DimensionNode | FloatNode {
              if (this.currentToken.type === 'number') {
                const nextToken = this.getNextToken(1)
          Severity: Minor
          Found in packages/bredon/src/Parser.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 unitPlugin has 28 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export default function unitPlugin(config?: Object = {}): Object {
            const configFormats = config.formats || {}
            const precision = config.precision || 4
          
            const formats = {
          Severity: Minor
          Found in packages/bredon-plugin-unit/src/index.js - About 1 hr to fix

            Function parseHex has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

              parseHex(): SimpleNode {
                if (this.currentToken.type === 'hex') {
                  this.updateCurrentToken(1)
                  let hexValue = ''
            
            
            Severity: Minor
            Found in packages/bredon/src/Parser.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 isPosition has 27 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export default function isPosition(node, isMultiValue) {
              if (isMultiValue) {
                return (
                  (node.length === 2 &&
                    (((isLengthPercentage(node[0]) ||
            Severity: Minor
            Found in packages/bredon-validate/src/types/isPosition.js - About 1 hr to fix

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

              export default function initialPlugin(config?: Object = {}): Object {
                const useShorter = config.useShorter || false
              
                return ({ generate, parse, types }) => ({
                  Identifier({ node, context, replaceNode }) {
              Severity: Minor
              Found in packages/bredon-plugin-initial/src/index.js - About 1 hr to fix

                Function textShadow has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                  textShadow: (node, isMultiValue) => {
                    if (isMultiValue) {
                      if (node.length === 2) {
                        return validateNodeList(isLength)(node)
                      }
                Severity: Minor
                Found in packages/bredon-validate/src/propertyValidators.js - About 45 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

                Avoid deeply nested control flow statements.
                Open

                            if (!isValidUnit(innerNextToken.value)) {
                              throw new SyntaxError(
                                `A float (${this.currentToken
                                  .value}) must be followed by a valid unit. Instead found "${innerNextToken.value}" of type "${innerNextToken.type}".`
                              )
                Severity: Major
                Found in packages/bredon/src/Parser.js - About 45 mins to fix

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

                    parseFunctionExpression(callee: string): FunctionNode {
                      this.updateCurrentToken(2)
                      ++this.parenBalance
                  
                      const startParenBalance = this.parenBalance
                  Severity: Minor
                  Found in packages/bredon/src/Parser.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 parseImportant has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                    parseImportant(): any {
                      if (this.currentToken.type === 'exclamation_mark') {
                        const nextToken = this.getNextToken(1)
                  
                        if (nextToken) {
                  Severity: Minor
                  Found in packages/bredon/src/Parser.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 createPath has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                  export default function createPath(
                    node: ASTNode,
                    parentPath?: Path,
                    context?: Object = {}
                  ): Path {
                  Severity: Minor
                  Found in packages/bredon/src/utils/createPath.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

                  Avoid too many return statements within this function.
                  Open

                          return false
                  Severity: Major
                  Found in packages/bredon-validate/src/isValidProperty.js - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                      return false
                    Severity: Major
                    Found in packages/bredon-validate/src/isValidProperty.js - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                            return validator(ast.body, true, isList)
                      Severity: Major
                      Found in packages/bredon-validate/src/isValidProperty.js - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                            return (
                              // global values are always valid
                              isGlobal(node) ||
                              // also check for any keyword value
                              matchesKeyword(property)(node) ||
                        Severity: Major
                        Found in packages/bredon-validate/src/isValidProperty.js - About 30 mins to fix
                          Severity
                          Category
                          Status
                          Source
                          Language