rofrischmann/elodin

View on GitHub

Showing 180 of 180 total issues

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

export default function generateValue(node, property, dynamic = true) {
  const floatingPercentage = property === 'opacity'

  if (!dynamic) {
    return wrapInString(generateCSSValue(node, property))
Severity: Minor
Found in utils/javascript/src/generateValue.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 escapeKeywords has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

export default function escapeKeywords(
  ast,
  baseKeywords = [],
  caseSensitive = false
) {
Severity: Minor
Found in utils/reason/src/escapeKeywords.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 generateMediaQueryFromNode has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export default function generateMediaQueryFromNode(value, property, operator) {
  if (operator && value) {
    const dimension = property.indexOf('Height') !== -1 ? 'height' : 'width'

    if (operator === '=') {
Severity: Minor
Found in utils/css/src/generateMediaQueryFromNode.js - About 1 hr to fix

    Function parseIdentifier has 29 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      parseIdentifier() {
        if (this.currentToken.type === 'identifier') {
          const ident = this.currentToken.value
          const nextToken = this.getNextToken(1)
          if (nextToken.type === 'round_bracket' && nextToken.value === '(') {
    Severity: Minor
    Found in core/parser/src/Parser.js - About 1 hr to fix

      Function transform has 29 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        const transform = file => write => {
          const parsed = parse(file, {
            context: {
              path: inputPath,
              source: file,
      Severity: Minor
      Found in core/core/src/transformFile.js - About 1 hr to fix

        Function generateValue has 29 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export default function generateValue(
          value,
          property,
          unit = true,
          floatingPercentage = false
        Severity: Minor
        Found in utils/css/src/generateValue.js - About 1 hr to fix

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

                enter(path) {
                  if (
                    path.node.value.type === 'Variable' &&
                    !path.node.value.environment
                  ) {
          Severity: Minor
          Found in plugins/replace-variable/src/index.js - About 1 hr to fix

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

              const modules = styles.reduce((modules, module) => {
                const usedVariants = getVariantsFromAST(module)
                const variantMap = variants.reduce((flatVariants, variant) => {
                  if (usedVariants[variant.name]) {
                    flatVariants[variant.name] = variant.body.map(
            Severity: Minor
            Found in generators/javascript-react-native/src/createGenerator.js - About 1 hr to fix

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

                it('should only generate js files', () => {
                  const ast = parse(style).ast
              
                  expect(
                    createGenerator({ extractCSS: false })(ast, 'style.elo')
              generators/javascript-css/src/__tests__/createGenerator-test.js on lines 38..44
              generators/javascript-css/src/__tests__/createGenerator-test.js on lines 76..82
              generators/reason-css/src/__tests__/createGenerator-test.js on lines 38..44
              generators/reason-css/src/__tests__/createGenerator-test.js on lines 77..83
              generators/reason-css/src/__tests__/createGenerator-test.js on lines 93..99

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

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

                it('should generate readable classnames in devMode', () => {
                  const ast = parse(style).ast
              
                  expect(
                    createGenerator({ devMode: true })(ast, 'style.elo')
              generators/javascript-css/src/__tests__/createGenerator-test.js on lines 76..82
              generators/javascript-css/src/__tests__/createGenerator-test.js on lines 92..98
              generators/reason-css/src/__tests__/createGenerator-test.js on lines 38..44
              generators/reason-css/src/__tests__/createGenerator-test.js on lines 77..83
              generators/reason-css/src/__tests__/createGenerator-test.js on lines 93..99

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

              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

                it('should add reset class names', () => {
                  const ast = parse(style).ast
              
                  expect(
                    createGenerator({ baseClassName: 'elo' })(ast, 'style.elo')
              generators/reason-css/src/__tests__/createGenerator-test.js on lines 85..91

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

              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

                it('should add reset class names', () => {
                  const ast = parse(style).ast
              
                  expect(
                    createGenerator({ baseClassName: 'elo' })(ast, 'style.elo')
              Severity: Major
              Found in generators/reason-css/src/__tests__/createGenerator-test.js and 1 other location - About 1 hr to fix
              generators/javascript-css/src/__tests__/createGenerator-test.js on lines 84..90

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

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

                it('should use dynamic imports', () => {
                  const ast = parse(style).ast
              
                  expect(
                    createGenerator({ dynamicImport: true })(ast, 'style.elo')
              generators/javascript-css/src/__tests__/createGenerator-test.js on lines 38..44
              generators/javascript-css/src/__tests__/createGenerator-test.js on lines 92..98
              generators/reason-css/src/__tests__/createGenerator-test.js on lines 38..44
              generators/reason-css/src/__tests__/createGenerator-test.js on lines 77..83
              generators/reason-css/src/__tests__/createGenerator-test.js on lines 93..99

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

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

                it('should use dynamic imports', () => {
                  const ast = parse(style).ast
              
                  expect(
                    createGenerator({ dynamicImport: true })(ast, 'style.elo')
              generators/javascript-css/src/__tests__/createGenerator-test.js on lines 38..44
              generators/javascript-css/src/__tests__/createGenerator-test.js on lines 76..82
              generators/javascript-css/src/__tests__/createGenerator-test.js on lines 92..98
              generators/reason-css/src/__tests__/createGenerator-test.js on lines 38..44
              generators/reason-css/src/__tests__/createGenerator-test.js on lines 93..99

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

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

                it('should generate readable classnames in devMode', () => {
                  const ast = parse(style).ast
              
                  expect(
                    createGenerator({ devMode: true })(ast, 'style.elo')
              generators/javascript-css/src/__tests__/createGenerator-test.js on lines 38..44
              generators/javascript-css/src/__tests__/createGenerator-test.js on lines 76..82
              generators/javascript-css/src/__tests__/createGenerator-test.js on lines 92..98
              generators/reason-css/src/__tests__/createGenerator-test.js on lines 77..83
              generators/reason-css/src/__tests__/createGenerator-test.js on lines 93..99

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

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

                it('should only generate a reason file', () => {
                  const ast = parse(style).ast
              
                  expect(
                    createGenerator({ extractCSS: false })(ast, 'style.elo')
              generators/javascript-css/src/__tests__/createGenerator-test.js on lines 38..44
              generators/javascript-css/src/__tests__/createGenerator-test.js on lines 76..82
              generators/javascript-css/src/__tests__/createGenerator-test.js on lines 92..98
              generators/reason-css/src/__tests__/createGenerator-test.js on lines 38..44
              generators/reason-css/src/__tests__/createGenerator-test.js on lines 77..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 57.

              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 parseStyleBody has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

                parseStyleBody() {
                  const body = []
              
                  if (
                    this.currentToken.type === 'curly_bracket' &&
              Severity: Minor
              Found in core/parser/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 generateFunction has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

              function generateFunction(value, property, unit, floatingPercentage = false) {
                if (value.callee === 'raw') {
                  return generateValue(value.params[0], property, false)
                }
              
              
              Severity: Minor
              Found in utils/css/src/generateValue.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 enter has 27 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                    enter(path) {
                      if (
                        !path.node.boolean &&
                        path.node.value.type === 'Variable' &&
                        !path.node.value.environment
              Severity: Minor
              Found in plugins/replace-variable/src/index.js - About 1 hr to fix

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

                export default function createGenerator(customConfig = {}) {
                  const config = {
                    ...defaultConfig,
                    ...customConfig,
                  }
                Severity: Minor
                Found in generators/reason-css/src/createGenerator.js - About 1 hr to fix
                  Severity
                  Category
                  Status
                  Source
                  Language