rofrischmann/fela

View on GitHub

Showing 412 of 412 total issues

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

    style={[
      styles.root,
      {
        borderBottomColor: color,
        borderRightWidth: `${size / 2}px`,
Severity: Major
Found in benchmarks/src/implementations/radium/Dot.js and 1 other location - About 3 hrs to fix
benchmarks/src/implementations/reactxp/Dot.js on lines 8..18

Duplicated Code

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

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

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

Tuning

This issue has a mass of 102.

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

export default function getNodeSibling(
  nodes,
  { type, media, support },
  sortMediaQuery
) {
Severity: Minor
Found in packages/fela-dom/src/dom/connection/getNodeSibling.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 renderFn has 80 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        createElement(FelaTheme, undefined, (_felaTheme) => {
          if (!renderer) {
            throw new Error(
              "createComponent() can't render styles without the renderer in the context. Missing react-fela's <Provider /> at the app root?"
            )
Severity: Major
Found in packages/fela-bindings/src/createComponentFactory.js - About 3 hrs to fix

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

      it('should render media queries', () => {
        const rule = () => ({
          color: 'red',
          '@media (min-height:300px)': {
            color: 'blue',
    Severity: Major
    Found in packages/fela-monolithic/src/__tests__/monolithic-test.js and 3 other locations - About 3 hrs to fix
    packages/fela-monolithic/src/__tests__/monolithic-test.js on lines 90..104
    packages/fela-monolithic/src/__tests__/monolithic-test.js on lines 154..168
    packages/fela-monolithic/src/__tests__/monolithic-test.js on lines 170..184

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

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

      it('should render child selectors', () => {
        const rule = () => ({
          color: 'red',
          '>div': {
            color: 'blue',
    Severity: Major
    Found in packages/fela-monolithic/src/__tests__/monolithic-test.js and 3 other locations - About 3 hrs to fix
    packages/fela-monolithic/src/__tests__/monolithic-test.js on lines 90..104
    packages/fela-monolithic/src/__tests__/monolithic-test.js on lines 154..168
    packages/fela-monolithic/src/__tests__/monolithic-test.js on lines 223..237

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

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

      it('should render pseudo classes', () => {
        const rule = () => ({
          color: 'red',
          ':hover': {
            color: 'blue',
    Severity: Major
    Found in packages/fela-monolithic/src/__tests__/monolithic-test.js and 3 other locations - About 3 hrs to fix
    packages/fela-monolithic/src/__tests__/monolithic-test.js on lines 154..168
    packages/fela-monolithic/src/__tests__/monolithic-test.js on lines 170..184
    packages/fela-monolithic/src/__tests__/monolithic-test.js on lines 223..237

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

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

      it('should render attribute selectors', () => {
        const rule = () => ({
          color: 'red',
          '[bool=true]': {
            color: 'blue',
    Severity: Major
    Found in packages/fela-monolithic/src/__tests__/monolithic-test.js and 3 other locations - About 3 hrs to fix
    packages/fela-monolithic/src/__tests__/monolithic-test.js on lines 90..104
    packages/fela-monolithic/src/__tests__/monolithic-test.js on lines 170..184
    packages/fela-monolithic/src/__tests__/monolithic-test.js on lines 223..237

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

    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

    File App.js has 294 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import Benchmark from './Benchmark'
    import {
      Picker,
      StyleSheet,
      ScrollView,
    Severity: Minor
    Found in benchmarks/src/app/App.js - About 3 hrs to fix

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

      module.exports = {
        cache: true,
        devtool: 'source-map',
        entry: {
          app: './client.js',
      Severity: Major
      Found in examples/example-inferno/webpack.config.js and 2 other locations - About 3 hrs to fix
      examples/example-preact/webpack.config.js on lines 3..24
      examples/example-react/webpack.config.js on lines 3..24

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

      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

          serverRenderer.renderRule(() => ({
            color: 'yellow',
            backgroundColor: 'red',
            flex: 1,
            '& #id > .foo ~ bar': {
      Severity: Major
      Found in packages/fela-dom/src/dom/__tests__/rehydrate-test.js and 1 other location - About 3 hrs to fix
      packages/fela-dom/src/dom/__tests__/rehydrate-test.js on lines 114..136

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

      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

          serverRenderer.renderRule(() => ({
            color: 'yellow',
            backgroundColor: 'red',
            flex: 1,
            '& #id > .foo ~ bar': {
      Severity: Major
      Found in packages/fela-dom/src/dom/__tests__/rehydrate-test.js and 1 other location - About 3 hrs to fix
      packages/fela-dom/src/dom/__tests__/rehydrate-test.js on lines 23..45

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

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

      module.exports = {
        cache: true,
        devtool: 'source-map',
        entry: {
          app: './client.js',
      Severity: Major
      Found in examples/example-preact/webpack.config.js and 2 other locations - About 3 hrs to fix
      examples/example-inferno/webpack.config.js on lines 3..24
      examples/example-react/webpack.config.js on lines 3..24

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

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

      module.exports = {
        cache: true,
        devtool: 'source-map',
        entry: {
          app: './client.js',
      Severity: Major
      Found in examples/example-react/webpack.config.js and 2 other locations - About 3 hrs to fix
      examples/example-inferno/webpack.config.js on lines 3..24
      examples/example-preact/webpack.config.js on lines 3..24

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

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

              render() {
                const { extend, _felaRules, ...otherProps } = this.props
      
                const allRules = [rules]
                if (_felaRules) {
      Severity: Major
      Found in packages/fela-bindings/src/connectFactory.js - About 2 hrs to fix

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

                  ol: ({ children }) => (
                    <Box
                      as="ol"
                      space={1}
                      marginTop={2.5}
        Severity: Major
        Found in website/components/DocLayout.js and 1 other location - About 2 hrs to fix
        website/components/DocLayout.js on lines 140..154

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

        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

                  ul: ({ children }) => (
                    <Box
                      as="ul"
                      space={1}
                      marginTop={2.5}
        Severity: Major
        Found in website/components/DocLayout.js and 1 other location - About 2 hrs to fix
        website/components/DocLayout.js on lines 155..169

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

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

        export default function getFontFormat(src) {
          if (isBase64(src)) {
            let mime = ''
            for (let i = 5; ; i++) {
              // 'data:'.length === 5
        Severity: Minor
        Found in packages/fela/src/getFontFormat.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 renderToMarkup has 69 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export default function renderToMarkup(renderer) {
          const cacheCluster = clusterCache(renderer.cache, renderer.ruleOrder)
        
          const rehydrationIndex = getRehydrationIndex(renderer)
        
        
        Severity: Major
        Found in packages/fela-dom/src/server/renderToMarkup.js - About 2 hrs to fix

          Function embeddedPlugin has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
          Open

          function embeddedPlugin(style, type, renderer, props) {
            for (const property in style) {
              const value = style[property]
          
              if (property === 'fontFace' && typeof value === 'object') {
          Severity: Minor
          Found in packages/fela-plugin-embedded/src/index.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

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

              const Button = ({ children, style, ...props }) => (
                <FelaComponent style={[rule, style]} {...props}>
                  {({ className }) => (
                    <button type="button" className={className}>
                      {children}
          packages/fela-integration/src/jest-react-fela_react-fela/__tests__/FelaComponent-test.js on lines 170..178

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

          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