rofrischmann/elodin

View on GitHub

Showing 180 of 180 total issues

Function default has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
Open

export default async function({ watch, clean, skipInitialBuild }) {
  let config

  const configPath = path.join(process.cwd(), './elodin.config.js')
  try {
Severity: Minor
Found in core/cli/src/command.js - About 4 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 transformFile has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
Open

export default function transformFile(inputPath, config, callback) {
  const { plugins = [], generator, errors = 'throw', log } = config

  if (!generator) {
    if (!log) {
Severity: Minor
Found in core/core/src/transformFile.js - About 4 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 replaceVariable has 94 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export default function replaceVariable(customConfig = {}) {
  const { variables, selector } = {
    ...defaultConfig,
    ...customConfig,
  }
Severity: Major
Found in plugins/replace-variable/src/index.js - About 3 hrs to fix

    Function formatFromAST has 93 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export default function formatFromAST(node, customConfig = {}, level = 1) {
      const config = {
        ...defaultConfig,
        ...customConfig,
      }
    Severity: Major
    Found in core/format/src/formatFromAST.js - About 3 hrs to fix

      File createGenerator.js has 305 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import { getVariablesFromAST, getVariantsFromAST } from '@elodin/utils-core'
      import {
        isPseudoClass,
        isPseudoElement,
        isMediaQuery,
      Severity: Minor
      Found in generators/reason-css/src/createGenerator.js - About 3 hrs to fix

        Function generateClasses has 82 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export default function generateClasses(
          nodes,
          variantMap,
          devMode,
          classes = [],
        Severity: Major
        Found in utils/css/src/generateClasses.js - About 3 hrs to fix

          Function formatFromAST has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
          Open

          export default function formatFromAST(node, customConfig = {}, level = 1) {
            const config = {
              ...defaultConfig,
              ...customConfig,
            }
          Severity: Minor
          Found in core/format/src/formatFromAST.js - About 3 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 parse has 76 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            parse(input) {
              this.tokens = tokenize(input.trim(), ruleMap, 'unknown').filter(
                (token) => token.type !== 'whitespace'
              )
          
          
          Severity: Major
          Found in core/parser/src/Parser.js - About 3 hrs to fix

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

              it('should correctly parse styles', () => {
                const file = `
            style Button {
              backgroundColor: red
              borderColor: rgb(255 255 255)
            Severity: Major
            Found in core/parser/src/__tests__/Parser-test.js and 4 other locations - About 2 hrs to fix
            core/parser/src/__tests__/Parser-test.js on lines 21..36
            core/parser/src/__tests__/Parser-test.js on lines 38..57
            core/parser/src/__tests__/Parser-test.js on lines 59..83
            core/parser/src/__tests__/Parser-test.js on lines 85..104

            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 92.

            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 5 locations. Consider refactoring.
            Open

              it('should correctly parse multiple styles', () => {
                const file = `
            style Button {
              backgroundColor: red
              paddingLeft: 10
            Severity: Major
            Found in core/parser/src/__tests__/Parser-test.js and 4 other locations - About 2 hrs to fix
            core/parser/src/__tests__/Parser-test.js on lines 4..19
            core/parser/src/__tests__/Parser-test.js on lines 38..57
            core/parser/src/__tests__/Parser-test.js on lines 59..83
            core/parser/src/__tests__/Parser-test.js on lines 85..104

            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 92.

            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 5 locations. Consider refactoring.
            Open

              it('should correctly parse env condition', () => {
                const file = `
            style Button {
              [@hover] {
                backgroundColor: red
            Severity: Major
            Found in core/parser/src/__tests__/Parser-test.js and 4 other locations - About 2 hrs to fix
            core/parser/src/__tests__/Parser-test.js on lines 4..19
            core/parser/src/__tests__/Parser-test.js on lines 21..36
            core/parser/src/__tests__/Parser-test.js on lines 38..57
            core/parser/src/__tests__/Parser-test.js on lines 59..83

            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 92.

            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 5 locations. Consider refactoring.
            Open

              it('should correctly parse conditionals', () => {
                const file = `
                variant Mode {
                  Dark
                  Light
            Severity: Major
            Found in core/parser/src/__tests__/Parser-test.js and 4 other locations - About 2 hrs to fix
            core/parser/src/__tests__/Parser-test.js on lines 4..19
            core/parser/src/__tests__/Parser-test.js on lines 21..36
            core/parser/src/__tests__/Parser-test.js on lines 59..83
            core/parser/src/__tests__/Parser-test.js on lines 85..104

            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 92.

            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 5 locations. Consider refactoring.
            Open

              it('should correctly parse comments', () => {
                const file = `
                # variant comment
                variant Foo {
                  Bar
            Severity: Major
            Found in core/parser/src/__tests__/Parser-test.js and 4 other locations - About 2 hrs to fix
            core/parser/src/__tests__/Parser-test.js on lines 4..19
            core/parser/src/__tests__/Parser-test.js on lines 21..36
            core/parser/src/__tests__/Parser-test.js on lines 38..57
            core/parser/src/__tests__/Parser-test.js on lines 85..104

            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 92.

            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 generateJSFiles has 70 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function generateJSFiles(ast, config, fileName) {
              const {
                devMode,
                generateJSFileName,
                generateCSSFileName,
            Severity: Major
            Found in generators/javascript-css/src/createGenerator.js - About 2 hrs to fix

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

              function stringifyDeclaration(declaration) {
                const prop = declaration.property + ': '
              
                if (typeof declaration.value === 'object') {
                  return (
              Severity: Major
              Found in generators/javascript-fela/src/createGenerator.js and 1 other location - About 2 hrs to fix
              generators/javascript-react-native/src/createGenerator.js on lines 29..39

              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 87.

              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

              function stringifyDeclaration(declaration) {
                const prop = declaration.property + ': '
              
                if (typeof declaration.value === 'object') {
                  return (
              Severity: Major
              Found in generators/javascript-react-native/src/createGenerator.js and 1 other location - About 2 hrs to fix
              generators/javascript-fela/src/createGenerator.js on lines 64..74

              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 87.

              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

                      if (type === 'FunctionExpression') {
                        const isValidFunction = validateFunction(param.callee, param.params)
                        const returnType = functions[param.callee].return
              
                        if (typeof returnType === 'function') {
              Severity: Major
              Found in core/parser/src/validateFunction.js and 1 other location - About 2 hrs to fix
              core/parser/src/validateFunction.js on lines 95..104

              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 85.

              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

                    if (type === 'FunctionExpression') {
                      const isValidFunction = validateFunction(param.callee, param.params)
                      const returnType = functions[param.callee].return
              
                      if (typeof returnType === 'function') {
              Severity: Major
              Found in core/parser/src/validateFunction.js and 1 other location - About 2 hrs to fix
              core/parser/src/validateFunction.js on lines 30..39

              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 85.

              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 generateStyles has 59 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function generateStyles(nodes, variantMap, config) {
                const { generateVariantName, generateVariantValue } = config
              
                return arrayReduce(
                  nodes,
              Severity: Major
              Found in generators/javascript-fela/src/createGenerator.js - About 2 hrs to fix

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

                  it('should correctly replace variables in functions', () => {
                    const file = `style Button { paddingLeft: 10 paddingRight: add($spacingXL 1) }`
                
                    const ast = parse(file).ast
                
                
                Severity: Major
                Found in plugins/replace-variable/src/__tests__/index-test.js and 1 other location - About 2 hrs to fix
                plugins/replace-variable/src/__tests__/index-test.js on lines 6..21

                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 82.

                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

                Severity
                Category
                Status
                Source
                Language