martinandert/react-inline

View on GitHub

Showing 14 of 30 total issues

File Button.js has 291 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import React from 'react';
import StyleSheet from 'react-inline';
import classNames from 'classnames';

const {oneOf, bool} = React.PropTypes;
Severity: Minor
Found in example/src/components/Button.js - About 3 hrs to fix

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

    export default function(ast, stylesheets, options) {
      visit(ast, {
        visitCallExpression(path) {
          const node = path.node;
          const parent = path.parentPath.node;
    Severity: Minor
    Found in src/transformAST.js - About 1 hr to fix

      Function visitCallExpression has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          visitCallExpression(path) {
            const node = path.node;
            const parent = path.parentPath.node;
      
            if (!isStyleSheetCreate(node.callee)) {
      Severity: Minor
      Found in src/transformAST.js - About 1 hr to fix

        Function processMediaQuery has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        function processMediaQuery(css, name, query, content, level, options) {
        Severity: Minor
        Found in src/transformSpecificationIntoCSS.js - About 45 mins to fix

          Function canEvaluate has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

          function canEvaluate(expr, context) {
            if (n.Literal.check(expr)) {
              return true;
            } else if (n.Identifier.check(expr) && context.hasOwnProperty(expr.name)) {
              return true;
          Severity: Minor
          Found in src/transformObjectExpressionIntoStyleSheetObject.js - About 45 mins 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 processProperty has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

          function processProperty(key, value, result, context) {
            const name = keyToName(key);
          
            if (canEvaluate(value, context)) {
              const val = context.evaluate(value);
          Severity: Minor
          Found in src/transformObjectExpressionIntoStyleSheetObject.js - About 45 mins 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 processStyle has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          function processStyle(css, name, spec, level, options) {
          Severity: Minor
          Found in src/transformSpecificationIntoCSS.js - About 35 mins to fix

            Function processMediaQueries has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            function processMediaQueries(css, name, mediaQueries, level, options) {
            Severity: Minor
            Found in src/transformSpecificationIntoCSS.js - About 35 mins to fix

              Function processRules has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

              function processRules(css, name, rules, level, options) {
              Severity: Minor
              Found in src/transformSpecificationIntoCSS.js - About 35 mins to fix

                Function processStyleAndMediaQueryAndSelector has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                function processStyleAndMediaQueryAndSelector(styles, styleName, mediaQueryName, selectorName, content) {
                Severity: Minor
                Found in src/transformStyleSheetObjectIntoSpecification.js - About 35 mins to fix

                  Function processSelectors has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                  function processSelectors(css, name, selectors, level, options) {
                  Severity: Minor
                  Found in src/transformSpecificationIntoCSS.js - About 35 mins to fix

                    Avoid too many return statements within this function.
                    Open

                      return false;
                    Severity: Major
                    Found in src/transformObjectExpressionIntoStyleSheetObject.js - About 30 mins to fix

                      Function default has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                      export default function(ast, stylesheets, options) {
                        visit(ast, {
                          visitCallExpression(path) {
                            const node = path.node;
                            const parent = path.parentPath.node;
                      Severity: Minor
                      Found in src/transformAST.js - About 25 mins 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 default has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                      export default function(stylesheets, options) {
                        let css = '';
                      
                        foreach(stylesheets, (stylesheet, name) => {
                          let cssOptions = extend({}, options);
                      Severity: Minor
                      Found in src/buildCSS.js - About 25 mins 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

                      Severity
                      Category
                      Status
                      Source
                      Language