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
- Read upRead up
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
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
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;
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'
- Read upRead up
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';
- Read upRead up
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'
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;
- Read upRead up
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
*/
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;
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';
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'
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) {
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) {
Consider simplifying this complex logical expression. Open
if (
node
&& node.object
&& node.object.type === 'Identifier'
&& node.object.name
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)])
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) => {
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) {
- Read upRead up
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'
- Read upRead up
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;
- Read upRead up
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"