rofrischmann/elodin

View on GitHub

Showing 180 of 180 total issues

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

function stringifyObject(obj, indent = 2, startIndent = 0) {
  const fullIndent = indent + startIndent

  const items = arrayMap(Object.keys(obj), property => {
    const value = obj[property]
Severity: Minor
Found in generators/javascript-fela/src/createGenerator.js - About 1 hr to fix

    Function generateValue has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

    export default function generateValue(node, property, dynamic) {
      const floatingPercentage = property === 'opacity'
    
      if (!dynamic) {
        return wrapInString(generateCSSValue(node, property))
    Severity: Minor
    Found in utils/reason/src/generateValue.js - About 55 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

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

            node.comments
              .map((comment) => '# ' + comment.trim() + '\n' + ident.repeat(level))
              .join('') +
            (node.raw ? '__' : '') +
    Severity: Minor
    Found in core/format/src/formatFromAST.js and 1 other location - About 55 mins to fix
    core/format/src/formatFromAST.js on lines 69..72

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 53.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

            node.comments
              .map((comment) => '# ' + comment.trim() + '\n' + ident.repeat(level))
              .join('') +
            '[' +
    Severity: Minor
    Found in core/format/src/formatFromAST.js and 1 other location - About 55 mins to fix
    core/format/src/formatFromAST.js on lines 91..94

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 53.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

    const add = (a, b) => ({
      type: 'FunctionExpression',
      callee: 'add',
      params: [
        {
    Severity: Minor
    Found in utils/css/src/__tests__/generateValue-test.js and 1 other location - About 55 mins to fix
    utils/javascript/src/__tests__/generateValue-test.js on lines 22..35

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 53.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

    const add = (a, b) => ({
      type: 'FunctionExpression',
      callee: 'add',
      params: [
        {
    Severity: Minor
    Found in utils/javascript/src/__tests__/generateValue-test.js and 1 other location - About 55 mins to fix
    utils/css/src/__tests__/generateValue-test.js on lines 22..35

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 53.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

                if (typeof value === 'string') {
                  path.replaceNode({
                    ...path.node,
                    dynamic: false,
                    value: {
    Severity: Minor
    Found in plugins/replace-variable/src/index.js and 1 other location - About 55 mins to fix
    plugins/replace-variable/src/index.js on lines 83..92

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 53.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

                if (typeof value === 'number') {
                  path.replaceNode({
                    ...path.node,
                    dynamic: false,
                    value: {
    Severity: Minor
    Found in plugins/replace-variable/src/index.js and 1 other location - About 55 mins to fix
    plugins/replace-variable/src/index.js on lines 94..103

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 53.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Function generateClasses has 7 arguments (exceeds 4 allowed). Consider refactoring.
    Open

      nodes,
      variantMap,
      devMode,
      classes = [],
      modifier = [],
    Severity: Major
    Found in utils/css/src/generateClasses.js - About 50 mins to fix

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

                if (keywords.indexOf(path.node.value.toLowerCase()) !== -1) {
                  path.node.value += '_'
                }
      Severity: Minor
      Found in utils/reason/src/escapeKeywords.js and 1 other location - About 50 mins to fix
      utils/reason/src/escapeKeywords.js on lines 16..18

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 51.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

        return base.map((declaration) => ({
          property: declaration.property,
          value: generateValue(declaration.value, declaration.property, true),
          dynamic: declaration.dynamic,
        }))
      Severity: Minor
      Found in generators/javascript-react-native/src/createGenerator.js and 1 other location - About 50 mins to fix
      generators/javascript-react-native/src/createGenerator.js on lines 171..175

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 51.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

          declarations: base.map((declaration) => ({
            property: declaration.property,
            value: generateValue(declaration.value, declaration.property, true),
            dynamic: declaration.dynamic,
          })),
      Severity: Minor
      Found in generators/javascript-react-native/src/createGenerator.js and 1 other location - About 50 mins to fix
      generators/javascript-react-native/src/createGenerator.js on lines 138..142

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 51.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

                if (keywords.indexOf(path.node.name.toLowerCase()) !== -1) {
                  path.node.name += '_'
                }
      Severity: Minor
      Found in utils/reason/src/escapeKeywords.js and 1 other location - About 50 mins to fix
      utils/reason/src/escapeKeywords.js on lines 29..31

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 51.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Avoid deeply nested control flow statements.
      Open

                    if (variation) {
                      if (!styles.extend) {
                        styles.extend = []
                      }
      
      
      Severity: Major
      Found in generators/javascript-fela/src/createGenerator.js - About 45 mins to fix

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

          parseVariant() {
            if (
              this.currentToken.type === 'identifier' &&
              this.currentToken.value === 'variant'
            ) {
        Severity: Minor
        Found in core/parser/src/Parser.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

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

        export default function traverseNode(node, visitor, parentPath) {
          const methods = visitor[node.type]
        
          const nodePath = createPath(node, parentPath, parentPath.context)
        
        
        Severity: Minor
        Found in core/traverser/src/traverseNode.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 (
                      validation.type === 'value' &&
                      value.type !== 'Variable' &&
                      value.type !== 'RawValue'
                    ) {
        Severity: Major
        Found in core/parser/src/Parser.js - About 45 mins to fix

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

          export default function getVariantsFromAST(ast) {
            const vars = {}
          
            traverse(ast, [
              {
          Severity: Minor
          Found in utils/core/src/getVariantsFromAST.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

          Function generateModifierMap has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

            nodes,
            variantMap,
            config,
            modifierMap = {},
            variations = {},
          Severity: Minor
          Found in utils/javascript/src/generateModifierMap.js - About 45 mins to fix

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

              parse(input) {
                this.tokens = tokenize(input.trim(), ruleMap, 'unknown').filter(
                  (token) => token.type !== 'whitespace'
                )
            
            
            Severity: Minor
            Found in core/parser/src/Parser.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

            Severity
            Category
            Status
            Source
            Language