Showing 47 of 459 total issues
Function generate
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
generate(node: ASTNode): string {
const generateValue = this.generate.bind(this)
const customGenerator = this.generators[node.type]
if (customGenerator) {
- 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 parseFloat
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
parseFloat(integerPart?: number, isNegative?: boolean = false): FloatNode {
// floats can also start with a floating point
// if the integer part is 0
if (this.currentToken.type === 'floating_point') {
const nextToken = this.getNextToken(1)
Function traverseNode
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
traverseNode(visitor: Object, node: ASTNode, parentPath: Path) {
const methods = visitor[node.type]
const nodePath = createPath(node, parentPath, this.context)
Function parseOperator
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
parseOperator(): SimpleNode {
if (this.currentToken.type === 'operator') {
if (this.scope === 'expression') {
return operator(this.currentToken.value)
}
Function createPath
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function createPath(
node: ASTNode,
parentPath?: Path,
context?: Object = {}
): Path {
Function walkTokens
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
walkTokens(): Node {
this.updateCurrentToken()
// the following token do not return a node
// but rather add some flags
- 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 parseNumber
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
parseNumber(
isNegative?: boolean = false
): SimpleNode | DimensionNode | FloatNode {
if (this.currentToken.type === 'number') {
const nextToken = this.getNextToken(1)
- 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 unitPlugin
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function unitPlugin(config?: Object = {}): Object {
const configFormats = config.formats || {}
const precision = config.precision || 4
const formats = {
Function parseHex
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
parseHex(): SimpleNode {
if (this.currentToken.type === 'hex') {
this.updateCurrentToken(1)
let hexValue = ''
- 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 isPosition
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function isPosition(node, isMultiValue) {
if (isMultiValue) {
return (
(node.length === 2 &&
(((isLengthPercentage(node[0]) ||
Function initialPlugin
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function initialPlugin(config?: Object = {}): Object {
const useShorter = config.useShorter || false
return ({ generate, parse, types }) => ({
Identifier({ node, context, replaceNode }) {
Function textShadow
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
textShadow: (node, isMultiValue) => {
if (isMultiValue) {
if (node.length === 2) {
return validateNodeList(isLength)(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
Avoid deeply nested control flow statements. Open
if (!isValidUnit(innerNextToken.value)) {
throw new SyntaxError(
`A float (${this.currentToken
.value}) must be followed by a valid unit. Instead found "${innerNextToken.value}" of type "${innerNextToken.type}".`
)
Function parseFunctionExpression
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
parseFunctionExpression(callee: string): FunctionNode {
this.updateCurrentToken(2)
++this.parenBalance
const startParenBalance = this.parenBalance
- 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 parseImportant
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
parseImportant(): any {
if (this.currentToken.type === 'exclamation_mark') {
const nextToken = this.getNextToken(1)
if (nextToken) {
- 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 createPath
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
export default function createPath(
node: ASTNode,
parentPath?: Path,
context?: Object = {}
): Path {
- 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
Avoid too many return
statements within this function. Open
return false
Avoid too many return
statements within this function. Open
return false
Avoid too many return
statements within this function. Open
return validator(ast.body, true, isList)
Avoid too many return
statements within this function. Open
return (
// global values are always valid
isGlobal(node) ||
// also check for any keyword value
matchesKeyword(property)(node) ||