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;
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;
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)) {
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;
- 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 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);
- 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 processMediaQuery
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
function processMediaQuery(css, name, query, content, level, options) {
Function processSelectors
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function processSelectors(css, name, selectors, level, options) {
Function processRules
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function processRules(css, name, rules, level, options) {
Function processStyle
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function processStyle(css, name, spec, level, options) {
Function processMediaQueries
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function processMediaQueries(css, name, mediaQueries, level, options) {
Function processStyleAndMediaQueryAndSelector
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function processStyleAndMediaQueryAndSelector(styles, styleName, mediaQueryName, selectorName, content) {
Avoid too many return
statements within this function. Open
return false;
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;
- 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 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);
- 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"