Intellicode/eslint-plugin-react-native

View on GitHub

Showing 26 of 55 total issues

Function componentRule has a Cognitive Complexity of 89 (exceeds 5 allowed). Consider refactoring.
Open

function componentRule(rule, context) {
  const sourceCode = context.getSourceCode();
  const components = new Components();

  // Utilities for component detection
Severity: Minor
Found in lib/util/Components.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 componentRule has 216 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function componentRule(rule, context) {
  const sourceCode = context.getSourceCode();
  const components = new Components();

  // Utilities for component detection
Severity: Major
Found in lib/util/Components.js - About 1 day to fix

    File stylesheet.js has 393 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    'use strict';
    
    /**
     * StyleSheets represents the StyleSheets found in the source code.
     * @constructor
    Severity: Minor
    Found in lib/util/stylesheet.js - About 5 hrs to fix

      Function create has 91 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function create(context) {
        const order = context.options[0] || 'asc';
        const options = context.options[1] || {};
        const { ignoreClassNames } = options;
        const { ignoreStyleProperties } = options;
      Severity: Major
      Found in lib/rules/sort-styles.js - About 3 hrs to fix

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

        function create(context) {
          const options = context.options[0] || {};
        
          const report = (node) => {
            const errorValue = node.type === 'TemplateLiteral'
        Severity: Minor
        Found in lib/rules/no-raw-text.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 create has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
        Open

        function create(context) {
          let reactComponents = [];
          const androidMessage = 'Android components should be placed in android files';
          const iosMessage = 'IOS components should be placed in ios files';
          const conflictMessage = 'IOS and Android components can\'t be mixed';
        Severity: Minor
        Found in lib/rules/split-platform-components.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

        astHelpers has 25 functions (exceeds 20 allowed). Consider refactoring.
        Open

        const astHelpers = {
          containsStyleSheetObject: function (node, objectNames) {
            return Boolean(
              node
              && node.type === 'CallExpression'
        Severity: Minor
        Found in lib/util/stylesheet.js - About 2 hrs to fix

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

          function create(context) {
            const order = context.options[0] || 'asc';
            const options = context.options[1] || {};
            const { ignoreClassNames } = options;
            const { ignoreStyleProperties } = options;
          Severity: Minor
          Found in lib/rules/sort-styles.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

          File Components.js has 277 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          /**
           * @fileoverview Utility class and functions for React components detection
           * @author Yannick Croissant
           */
          
          
          Severity: Minor
          Found in lib/util/Components.js - About 2 hrs to fix

            Function getRelatedComponent has 63 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                getRelatedComponent: function (node) {
                  let currentNode = node;
                  let i;
                  let j;
                  let k;
            Severity: Major
            Found in lib/util/Components.js - About 2 hrs to fix

              Function create has 61 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function create(context) {
                let reactComponents = [];
                const androidMessage = 'Android components should be placed in android files';
                const iosMessage = 'IOS components should be placed in ios files';
                const conflictMessage = 'IOS and Android components can\'t be mixed';
              Severity: Major
              Found in lib/rules/split-platform-components.js - About 2 hrs to fix

                Function create has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function create(context) {
                  const options = context.options[0] || {};
                
                  const report = (node) => {
                    const errorValue = node.type === 'TemplateLiteral'
                Severity: Minor
                Found in lib/rules/no-raw-text.js - About 1 hr to fix

                  Function create has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  const create = Components.detect((context, components) => {
                    const styleSheets = new StyleSheets();
                    const styleReferences = new Set();
                  
                    function reportUnusedStyles(unusedStyles) {
                  Severity: Minor
                  Found in lib/rules/no-unused-styles.js - About 1 hr to fix

                    Function create has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    const create = Components.detect((context) => {
                      const styleSheets = new StyleSheets();
                    
                      function reportColorLiterals(colorLiterals) {
                        if (colorLiterals) {
                    Severity: Minor
                    Found in lib/rules/no-color-literals.js - About 1 hr to fix

                      Consider simplifying this complex logical expression.
                      Open

                          if (
                            node
                            && node.object
                            && node.object.type === 'Identifier'
                            && node.object.name
                      Severity: Critical
                      Found in lib/util/stylesheet.js - About 1 hr to fix

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

                          function report(array, type, node, prev, current) {
                            const currentName = getStylePropertyIdentifier(current);
                            const prevName = getStylePropertyIdentifier(prev);
                            const hasComments = array
                              .map((prop) => [...sourceCode.getCommentsBefore(prop), ...sourceCode.getCommentsAfter(prop)])
                        Severity: Minor
                        Found in lib/rules/sort-styles.js - About 1 hr to fix

                          Function getStyleObjectFromExpression has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            getStyleObjectFromExpression: function (node) {
                              const obj = {};
                              let invalid = false;
                              if (node.properties && node.properties.length) {
                                node.properties.forEach((p) => {
                          Severity: Minor
                          Found in lib/util/stylesheet.js - About 1 hr to fix

                            Function create has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                            Open

                            const create = Components.detect((context) => {
                              const styleSheets = new StyleSheets();
                            
                              function reportColorLiterals(colorLiterals) {
                                if (colorLiterals) {
                            Severity: Minor
                            Found in lib/rules/no-color-literals.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 elementName has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                            Open

                            const elementName = (node) => {
                              const reversedIdentifiers = [];
                              if (
                                node.type === 'JSXElement'
                                && node.openingElement.type === 'JSXOpeningElement'
                            Severity: Minor
                            Found in lib/rules/no-raw-text.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 markVariableAsUsed has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                            Open

                            function markVariableAsUsed(context, name) {
                              let scope = context.getScope();
                              let variables;
                              let i;
                              let len;
                            Severity: Minor
                            Found in lib/util/variable.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

                            Severity
                            Category
                            Status
                            Source
                            Language