rofrischmann/fela

View on GitHub

Showing 105 of 412 total issues

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

export default function createComponentFactory(
  createElement,
  RendererContext,
  FelaTheme,
  withProxy = 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

Function createRenderer has 294 lines of code (exceeds 25 allowed). Consider refactoring.
Open

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

    File DocLayout.js has 540 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

      Function Page has 198 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 7 hrs to fix

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

        export default function createRenderer(config = {}) {
          let renderer = {
            listeners: [],
            keyframePrefixes: config.keyframePrefixes || ['-webkit-', '-moz-'],
            plugins: config.plugins || [],
        Severity: Minor
        Found in packages/fela/src/createRenderer.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

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

          render() {
            const { tests } = this.props
            const {
              currentBenchmarkName,
              status,
        Severity: Major
        Found in benchmarks/src/app/App.js - About 5 hrs to fix

          Function useMonolithicRenderer has 120 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

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

            Function createComponentFactory has 103 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export default function createComponentFactory(
              createElement,
              RendererContext,
              FelaTheme,
              withProxy = false,
            Severity: Major
            Found in packages/fela-bindings/src/createComponentFactory.js - About 4 hrs to fix

              Function createComponent has 101 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                return function createComponent(rule, type = 'div', passThroughProps = []) {
                  const displayName = rule.name ? rule.name : 'FelaComponent'
              
                  const FelaComponent = ({
                    children,
              Severity: Major
              Found in packages/fela-bindings/src/createComponentFactory.js - About 4 hrs to fix

                Function _renderStyleToClassNames has 99 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    _renderStyleToClassNames(style, pseudo = '', media = '', support = '') {
                      let classNames = ''
                
                      const applyPlugin = (processed, plugin) => plugin(processed, renderer)
                
                
                Severity: Major
                Found in packages/fela/src/createRenderer.js - About 3 hrs to fix

                  File createRenderer.js has 329 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  import { cssifyDeclaration } from 'css-in-js-utils'
                  import { arrayEach, arrayReduce, arrayFilter } from 'fast-loops'
                  import isPlainObject from 'isobject'
                  
                  import {
                  Severity: Minor
                  Found in packages/fela/src/createRenderer.js - About 3 hrs to fix

                    Function connectFactory has 95 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    export default function connectFactory(
                      BaseComponent,
                      createElement,
                      RendererContext,
                      ThemeContext
                    Severity: Major
                    Found in packages/fela-bindings/src/connectFactory.js - About 3 hrs to fix

                      Function connect has 93 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        return function connect(rules, config = {}) {
                          const connectConfig = {
                            ...defaultConfig,
                            ...config,
                          }
                      Severity: Major
                      Found in packages/fela-bindings/src/connectFactory.js - About 3 hrs to fix

                        Function transformer has 89 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        export default function transformer(file, api) {
                          const j = api.jscodeshift
                        
                          const importName = getImportName(j, file.source, pkg, component)
                        
                        
                        Severity: Major
                        Found in packages/fela-codemods/src/v10/FelaComponent.js - About 3 hrs to fix

                          Function useMonolithicRenderer has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
                          Open

                          function useMonolithicRenderer(renderer, prettySelectors = false) {
                            renderer.prettySelectors = prettySelectors
                          
                            renderer._renderStyleToCache = (
                              className,
                          Severity: Minor
                          Found in packages/fela-monolithic/src/index.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 addStatistics has 84 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          function addStatistics(renderer) {
                            const statistics = {
                              count: {
                                classes: 0,
                                pseudoClasses: 0,
                          Severity: Major
                          Found in packages/fela-statistics/src/index.js - About 3 hrs to fix

                            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

                              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

                                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
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language