rofrischmann/elodin

View on GitHub

Showing 180 of 180 total issues

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

  it('should correctly replace variables in declarations', () => {
    const file = `style Button { paddingLeft: 10 paddingRight: $spacingXL }`

    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 22..37

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

Parser has 22 functions (exceeds 20 allowed). Consider refactoring.
Open

export default class Parser {
  constructor(config = {}) {
    this.config = config
    this.context = config.context || {}
  }
Severity: Minor
Found in core/parser/src/Parser.js - About 2 hrs to fix

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

      parseCondition() {
        const property = this.parseIdentifier() || this.parseVariable()
    
        if (property) {
          this.updateCurrentToken(1)
    Severity: Major
    Found in core/parser/src/Parser.js - About 2 hrs to fix

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

          const variantMap = variants.reduce((flatVariants, variant) => {
            if (usedVariants[variant.name]) {
              flatVariants[variant.name] = variant.body.map(
                variation => variation.value
              )
      Severity: Major
      Found in generators/javascript-css/src/createGenerator.js and 3 other locations - About 2 hrs to fix
      generators/javascript-fela/src/createGenerator.js on lines 84..92
      generators/javascript-react-native/src/createGenerator.js on lines 51..59
      generators/reason-css/src/createGenerator.js on lines 132..140

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

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

          const variantMap = variants.reduce((flatVariants, variant) => {
            if (usedVariants[variant.name]) {
              flatVariants[variant.name] = variant.body.map(
                (variation) => variation.value
              )
      Severity: Major
      Found in generators/javascript-react-native/src/createGenerator.js and 3 other locations - About 2 hrs to fix
      generators/javascript-css/src/createGenerator.js on lines 97..105
      generators/javascript-fela/src/createGenerator.js on lines 84..92
      generators/reason-css/src/createGenerator.js on lines 132..140

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

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

          const variantMap = variants.reduce((flatVariants, variant) => {
            if (usedVariants[variant.name]) {
              flatVariants[variant.name] = variant.body.map(
                variation => variation.value
              )
      Severity: Major
      Found in generators/javascript-fela/src/createGenerator.js and 3 other locations - About 2 hrs to fix
      generators/javascript-css/src/createGenerator.js on lines 97..105
      generators/javascript-react-native/src/createGenerator.js on lines 51..59
      generators/reason-css/src/createGenerator.js on lines 132..140

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

      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

                          property +
                          ': ' +
                          value.value +
                          '\n^-------\n' +
                          'The property ' +
      Severity: Major
      Found in core/parser/src/Parser.js and 1 other location - About 2 hrs to fix
      core/parser/src/Parser.js on lines 485..506

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

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

          const variantMap = variants.reduce((flatVariants, variant) => {
            if (usedVariants[variant.name]) {
              flatVariants[variant.name] = variant.body.map(
                (variation) => variation.value
              )
      Severity: Major
      Found in generators/reason-css/src/createGenerator.js and 3 other locations - About 2 hrs to fix
      generators/javascript-css/src/createGenerator.js on lines 97..105
      generators/javascript-fela/src/createGenerator.js on lines 84..92
      generators/javascript-react-native/src/createGenerator.js on lines 51..59

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

      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

                          property +
                          ': ' +
                          value.value +
                          '\n' +
                          ' '.repeat(property.length + 2) +
      Severity: Major
      Found in core/parser/src/Parser.js and 1 other location - About 2 hrs to fix
      core/parser/src/Parser.js on lines 448..466

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

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

        parseCondition() {
          const property = this.parseIdentifier() || this.parseVariable()
      
          if (property) {
            this.updateCurrentToken(1)
      Severity: Minor
      Found in core/parser/src/Parser.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 generateValue has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
      Open

      export default function generateValue(
        value,
        property,
        unit = true,
        floatingPercentage = false
      Severity: Minor
      Found in utils/css/src/generateValue.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 validateDeclaration has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
      Open

      export default function validateDeclaration(property, value, rawValue) {
        const propertyDefinition = definitions[property]
      
        if (propertyDefinition) {
          let val = value
      Severity: Minor
      Found in core/parser/src/validateDeclaration.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 generateModifierMap has 51 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export default function generateModifierMap(
        nodes,
        variantMap,
        config,
        modifierMap = {},
      Severity: Major
      Found in utils/javascript/src/generateModifierMap.js - About 2 hrs to fix

        Function parseVariantBody has 49 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          parseVariantBody() {
            const body = []
        
            if (
              this.currentToken.type === 'curly_bracket' &&
        Severity: Minor
        Found in core/parser/src/Parser.js - About 1 hr to fix

          Function generateMediaQueryFromNode has a Cognitive Complexity of 15 (exceeds 5 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

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

          export function compile(filename, opts) {
            const log = (errors) =>
              errors.forEach((error) => {
                const count = ++opts.errorCount
          
          
          Severity: Minor
          Found in core/cli/src/util.js - About 1 hr to fix

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

              it('should use custom js file names', () => {
                const ast = parse(style).ast
            
                expect(
                  createGenerator({
            generators/javascript-css/src/__tests__/createGenerator-test.js on lines 56..64

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

            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

              it('should use custom css file names', () => {
                const ast = parse(style).ast
            
                expect(
                  createGenerator({
            generators/javascript-css/src/__tests__/createGenerator-test.js on lines 66..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 72.

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

            function stringifyStyle(style, out = '', level = 2) {
              Object.keys(style).map((property) => {
                const value = style[property]
            
                if (typeof value === 'object') {
            Severity: Minor
            Found in generators/reason-css/src/createGenerator.js - About 1 hr to fix

              Function parseVariant has 45 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                parseVariant() {
                  if (
                    this.currentToken.type === 'identifier' &&
                    this.currentToken.value === 'variant'
                  ) {
              Severity: Minor
              Found in core/parser/src/Parser.js - About 1 hr to fix
                Severity
                Category
                Status
                Source
                Language