rofrischmann/elodin

View on GitHub

Showing 180 of 180 total issues

File Parser.js has 670 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import tokenize from 'tokenize-sync'
import color from 'color'

import validateDeclaration from './validateDeclaration'
import validateFunction from './validateFunction'
Severity: Major
Found in core/parser/src/Parser.js - About 1 day to fix

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

                <Box direction={['column', , 'row']} space={[10, , 15]} wrap="wrap">
                  <Box grow={1} shrink={0} basis={['auto', , 0]} space={1.5}>
                    <Box extend={{ fontSize: 20, fontWeight: 500 }}>
                      Component-based
                    </Box>
    Severity: Major
    Found in website/pages/index.js and 1 other location - About 1 day to fix
    website/pages/index.js on lines 115..137

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

    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

                <Box direction={['column', , 'row']} space={[10, , 15]} wrap="wrap">
                  <Box grow={1} shrink={0} basis={['auto', , 0]} space={1.5}>
                    <Box extend={{ fontSize: 20, fontWeight: 500 }}>
                      Type-safe Properties
                    </Box>
    Severity: Major
    Found in website/pages/index.js and 1 other location - About 1 day to fix
    website/pages/index.js on lines 92..114

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

    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

    describe('Generating CSS values', () => {
      it('should hyphenate values', () => {
        expect(
          generateValue(
            {
    Severity: Major
    Found in utils/css/src/__tests__/generateValue-test.js and 1 other location - About 1 day to fix
    utils/javascript/src/__tests__/generateValue-test.js on lines 43..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 209.

    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

    describe('Generating JavaScript values', () => {
      it('should hyphenate values', () => {
        expect(
          generateValue(
            {
    Severity: Major
    Found in utils/javascript/src/__tests__/generateValue-test.js and 1 other location - About 1 day to fix
    utils/css/src/__tests__/generateValue-test.js on lines 43..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 209.

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

    export default function replaceVariable(customConfig = {}) {
      const { variables, selector } = {
        ...defaultConfig,
        ...customConfig,
      }
    Severity: Minor
    Found in plugins/replace-variable/src/index.js - About 7 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

    File DocLayout.js has 408 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import React, { useState } from 'react'
    import Head from 'next/head'
    import NextLink from 'next/link'
    import { useRouter } from 'next/router'
    import { useFela } from 'react-fela'
    Severity: Minor
    Found in website/components/DocLayout.js - About 5 hrs to fix

      Function parseDeclaration has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
      Open

        parseDeclaration() {
          if (this.currentToken.type === 'identifier') {
            const propertyToken = this.currentToken
            const property = propertyToken.value
            const isRawDeclaration = property.substr(0, 2) === '__'
      Severity: Minor
      Found in core/parser/src/Parser.js - About 5 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

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

      function generateRootFile(ast, { generateFileName, generateStyleName }) {
        // TODO: include fragments
        const styles = ast.body.filter(node => node.type === 'Style')
      
        const imports = styles
      Severity: Major
      Found in generators/javascript-fela/src/createGenerator.js and 1 other location - About 5 hrs to fix
      generators/javascript-css/src/createGenerator.js on lines 52..77

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

      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 generateRootFile(
        ast,
        { generateCSSFileName, generateJSFileName, generateStyleName }
      ) {
        // TODO: include fragments
      Severity: Major
      Found in generators/javascript-css/src/createGenerator.js and 1 other location - About 5 hrs to fix
      generators/javascript-fela/src/createGenerator.js on lines 40..62

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

      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

          files[generateCSSFileName(fileName, module.name) + '.css'] = classes
            .filter((selector) => selector.declarations.length > 0)
            .map((selector) => {
              const css = stringifyRule(
                selector.declarations,
      Severity: Major
      Found in generators/reason-css/src/createGenerator.js and 1 other location - About 4 hrs to fix
      generators/javascript-css/src/createGenerator.js on lines 183..200

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

      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

          files[generateCSSFileName(module.name) + '.css'] = classes
            .filter(selector => selector.declarations.length > 0)
            .map(selector => {
              const css = stringifyRule(
                selector.declarations,
      Severity: Major
      Found in generators/javascript-css/src/createGenerator.js and 1 other location - About 4 hrs to fix
      generators/reason-css/src/createGenerator.js on lines 144..161

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

      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

          modifier: modifier
            .sort((a, b) =>
              variantOrder.indexOf(a[0]) > variantOrder.indexOf(b[0]) ? 1 : -1
            )
            .map(([name, value]) =>
      Severity: Major
      Found in generators/javascript-react-native/src/createGenerator.js and 1 other location - About 4 hrs to fix
      utils/css/src/generateClasses.js on lines 27..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 129.

      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

          modifier: modifier
            .sort((a, b) =>
              variantOrder.indexOf(a[0]) > variantOrder.indexOf(b[0]) ? 1 : -1
            )
            .map(([name, value]) =>
      Severity: Major
      Found in utils/css/src/generateClasses.js and 1 other location - About 4 hrs to fix
      generators/javascript-react-native/src/createGenerator.js on lines 158..170

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

      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

          for (const rule of config.module.rules) {
            if (!rule.oneOf) {
              continue
            }
      
      
      Severity: Major
      Found in examples/react/next.config.js and 1 other location - About 4 hrs to fix
      website/next.config.js on lines 23..38

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

      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

            for (const rule of config.module.rules) {
              if (!rule.oneOf) {
                continue
              }
      
      
      Severity: Major
      Found in website/next.config.js and 1 other location - About 4 hrs to fix
      examples/react/next.config.js on lines 4..19

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

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

      export default function validateFunction(callee, params) {
        const validator = functions[callee]
      
        if (validator) {
          // param list
      Severity: Major
      Found in core/parser/src/validateFunction.js - About 4 hrs to fix

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

        describe('Compiling to React Native', () => {
          it('should return a map of files', () => {
            const { ast } = parse(file)
        
            expect(createGenerator()(ast, 'style.elo')).toMatchSnapshot()
        Severity: Major
        Found in generators/javascript-fela/src/__tests__/generate-test.js and 1 other location - About 4 hrs to fix
        generators/javascript-react-native/src/__tests__/generate-test.js on lines 21..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 124.

        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

        describe('Compiling to React Native', () => {
          it('should return a map of files', () => {
            const { ast } = parse(file)
        
            expect(createGenerator()(ast, 'style.elo')).toMatchSnapshot()
        generators/javascript-fela/src/__tests__/generate-test.js on lines 21..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 124.

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

          parseDeclaration() {
            if (this.currentToken.type === 'identifier') {
              const propertyToken = this.currentToken
              const property = propertyToken.value
              const isRawDeclaration = property.substr(0, 2) === '__'
        Severity: Major
        Found in core/parser/src/Parser.js - About 4 hrs to fix
          Severity
          Category
          Status
          Source
          Language