rofrischmann/fela

View on GitHub

Showing 297 of 297 total issues

Function createComponentFactory has a Cognitive Complexity of 86 (exceeds 5 allowed). Consider refactoring.
Open

export default function createComponentFactory(
  createElement: Function,
  RendererContext: any,
  FelaTheme: Function,
  withProxy: boolean = false,
Severity: Minor
Found in packages/fela-bindings/src/createComponentFactory.js - About 1 day 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

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

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

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 as="h3" extend={{ fontSize: 20, fontWeight: 500 }}>
                  Predictable Styling
                </Box>
Severity: Major
Found in website/pages/index.js and 1 other location - About 1 day to fix
website/pages/index.js on lines 110..139

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

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

export default function createRenderer(
  config: DOMRendererConfig = {}
): DOMRenderer {
  let renderer: DOMRenderer = {
    listeners: [],
Severity: Major
Found in packages/fela/src/createRenderer.js - About 1 day to fix

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

    import React, { useState, useEffect, useLayoutEffect, useRef } from 'react'
    import Head from 'next/head'
    import NextLink from 'next/link'
    import { useRouter } from 'next/router'
    import { useFela } from 'react-fela'
    Severity: Major
    Found in website/components/DocLayout.js - About 1 day to fix

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

      export default class Input extends Component {
        constructor(props, context) {
          super(props, context)
          this.state = { size: 50 }
          this.setSize = this.setSize.bind(this)
      Severity: Major
      Found in examples/example-preact/containers/Input.js and 1 other location - About 1 day to fix
      examples/example-react/containers/Input.js on lines 6..29

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

      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

      export default class Input extends Component {
        constructor(props, context) {
          super(props, context)
          this.state = { size: 50 }
          this.setSize = this.setSize.bind(this)
      Severity: Major
      Found in examples/example-react/containers/Input.js and 1 other location - About 1 day to fix
      examples/example-preact/containers/Input.js on lines 6..29

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

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

      export default function Page() {
        const { theme } = useFela()
      
        return (
          <main id="main" role="main" aria-label="Main content">
      Severity: Major
      Found in website/pages/index.js - About 1 day to fix

        Function createRenderer has a Cognitive Complexity of 52 (exceeds 5 allowed). Consider refactoring.
        Open

        export default function createRenderer(
          config: DOMRendererConfig = {}
        ): DOMRenderer {
          let renderer: DOMRenderer = {
            listeners: [],
        Severity: Minor
        Found in packages/fela/src/createRenderer.js - About 1 day 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

          it('should return the correct format', () => {
            expect(getFontFormat('foo.ttf')).toEqual('truetype')
            expect(getFontFormat('foo.eot')).toEqual('embedded-opentype')
            expect(getFontFormat('foo.woff')).toEqual('woff')
            expect(getFontFormat('foo.woff2')).toEqual('woff2')
        Severity: Major
        Found in packages/fela/src/__tests__/getFontFormat-test.js and 1 other location - About 6 hrs to fix
        packages/fela/src/__tests__/getFontFormat-test.js on lines 26..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 165.

        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 return the correct format for fonts with queries', () => {
            expect(getFontFormat('foo.woff2?somequery')).toEqual('woff2')
            expect(getFontFormat('foo.woff2?someq?uery')).toEqual('woff2')
            expect(getFontFormat('foo.woff?someq?uery')).toEqual('woff')
            expect(getFontFormat('foo.ttf?somequery')).toEqual('truetype')
        Severity: Major
        Found in packages/fela/src/__tests__/getFontFormat-test.js and 1 other location - About 6 hrs to fix
        packages/fela/src/__tests__/getFontFormat-test.js on lines 4..17

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

        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

        const Dot = ({ size, x, y, children, color }) => (
          <div
            className={css(styles.root, {
              borderBottomColor: color,
              borderRightWidth: `${size / 2}px`,
        Severity: Major
        Found in benchmarks/src/implementations/glamor/Dot.js and 1 other location - About 6 hrs to fix
        benchmarks/src/implementations/emotion/Dot.js on lines 5..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 156.

        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

        const Dot = ({ size, x, y, children, color }) => (
          <div
            className={css(styles.root, {
              borderBottomColor: color,
              borderRightWidth: `${size / 2}px`,
        Severity: Major
        Found in benchmarks/src/implementations/emotion/Dot.js and 1 other location - About 6 hrs to fix
        benchmarks/src/implementations/glamor/Dot.js on lines 5..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 156.

        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

        export default function useFela(props: Object = {}): HookInterface {
          const renderer = useContext(RendererContext)
          const theme = useContext(ThemeContext) || {}
        
          if (!renderer) {
        Severity: Major
        Found in packages/preact-fela/src/useFela.js and 1 other location - About 5 hrs to fix
        packages/react-fela/src/useFela.js on lines 14..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 152.

        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

        export default function useFela(props: Object = {}): HookInterface {
          const renderer = useContext(RendererContext)
          const theme = useContext(ThemeContext) || {}
        
          if (!renderer) {
        Severity: Major
        Found in packages/react-fela/src/useFela.js and 1 other location - About 5 hrs to fix
        packages/preact-fela/src/useFela.js on lines 14..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 152.

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

        app.get('/', (req, res) => {
          const renderer = createRenderer()
        
          const indexHTML = fs.readFileSync(`${__dirname}/index.html`).toString()
          const appHtml = renderToString(
        Severity: Major
        Found in examples/example-react/server.js and 2 other locations - About 5 hrs to fix
        examples/example-inferno/server.js on lines 18..35
        examples/example-preact/server.js on lines 18..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 147.

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

        app.get('/', (req, res) => {
          const renderer = createRenderer()
        
          const indexHTML = fs.readFileSync(`${__dirname}/index.html`).toString()
          const appHtml = renderToString(
        Severity: Major
        Found in examples/example-inferno/server.js and 2 other locations - About 5 hrs to fix
        examples/example-preact/server.js on lines 18..35
        examples/example-react/server.js on lines 18..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 147.

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

        app.get('/', (req, res) => {
          const renderer = createRenderer()
        
          const indexHTML = fs.readFileSync(`${__dirname}/index.html`).toString()
          const appHtml = render(
        Severity: Major
        Found in examples/example-preact/server.js and 2 other locations - About 5 hrs to fix
        examples/example-inferno/server.js on lines 18..35
        examples/example-react/server.js on lines 18..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 147.

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

        function useMonolithicRenderer(
          renderer: DOMRenderer,
          prettySelectors: boolean = false
        ): MonolithicRenderer {
          renderer.prettySelectors = prettySelectors
        Severity: Major
        Found in packages/fela-monolithic/src/index.js - About 5 hrs to fix

          Function render has 123 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            render() {
              const { tests } = this.props;
              const { currentBenchmarkName, status, currentLibraryName, results } = this.state;
              const currentImplementation = tests[currentBenchmarkName][currentLibraryName];
              const { Component, Provider, getComponentProps, sampleCount } = currentImplementation;
          Severity: Major
          Found in benchmarks/src/app/App.js - About 4 hrs to fix
            Severity
            Category
            Status
            Source
            Language