martinandert/babel-plugin-css-in-js

View on GitHub

Showing 16 of 51 total issues

Function visitor has 60 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function visitor(context) {
  const t = context.types;

  return {
    Program: {
Severity: Major
Found in src/index.js - About 2 hrs to fix

    Function visitor has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

    function visitor(context) {
      const t = context.types;
    
      return {
        Program: {
    Severity: Minor
    Found in src/index.js - About 1 hr 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 CallExpression has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        CallExpression(path) {
          if (!t.isIdentifier(path.node.callee, { name: this.cssInJS.options.identifier })) {
            return;
          }
    
    
    Severity: Minor
    Found in src/index.js - About 1 hr to fix

      Function processProperty has a Cognitive Complexity of 9 (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 55 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 processMediaQuery has 7 arguments (exceeds 4 allowed). Consider refactoring.
      Open

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

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

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

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

          function processMediaQueries(css, name, mediaQueries, level, parent, 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 (t.isLiteral(expr)) {
                return true;
              } else if (t.isIdentifier(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 processStyle has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

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

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

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

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

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

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

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

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

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

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

                      function processStyleAndSelector(styles, styleName, selectorName, content, parent) {
                      Severity: Minor
                      Found in src/transformStyleSheetObjectIntoSpecification.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 buildCSS has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                          Open

                          export default function buildCSS(stylesheets, options) {
                            let css = '';
                          
                            foreach(stylesheets, (stylesheet, name) => {
                              const 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