Showing 48 of 133 total issues
Function reporter
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
var reporter = function( msg, done, kill ) {
if ( done === 'done' ) {
// total errors
this.cache.msg = 'Stylint: ' + this.cache.errs.length + ' Errors.'
this.cache.msg += this.config.maxErrors ? ' (Max Errors: ' + this.config.maxErrors + ')' : ''
Function parenSpace
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
var parenSpace = function( line, origLine ) {
if ( !parensRe.test( origLine ) ) { return }
var hasStartSpace = parensBeginWithSpaceRe.exec( origLine )
var hasEndSpace = parensEndWithSpaceRe.exec( origLine )
- 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 prefixVarsWithDollar
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
var prefixVarsWithDollar = function( line ) {
if ( this.state.hashOrCSS || ignoreRe.test( line ) ) { return }
var hasDolla = 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 duplicates
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
var duplicates = function( line ) {
var arr = this.splitAndStrip( new RegExp( /[\s\t]/ ), line )
var dupe = false
var dupeIndex
var origFile
- 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 setState
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
var setState = function( line ) {
this.state.context = this.setContext( this.cache.line )
// ignore the current line if @stylint ignore
if ( this.cache.origLine.indexOf( '@stylint ignore' ) !== -1 ) {
Function getFiles
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
var getFiles = function( dir ) {
if ( typeof dir !== 'string' && !( dir instanceof Array ) ) {
throw new TypeError( 'getFiles err. Expected string or array, but received: ' + typeof dir )
}
Function valid
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
module.exports = function valid( line ) {
// from and to are valid keyframes properties, but not outside that context
if ( !this.state.keyframes && line.match( keyRe ) ) { return }
// 1 split by tabs and spaces, tabs mess with pattern matching
- 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 colons
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
var colons = function( line ) {
if ( ignoreRe.test( line ) || this.state.context === 0 ) { return }
var colon
var hasPseudo = false
Function read
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
var read = function( filepath ) {
// if user passes in a glob, we forEach over them
// and pass it into read() as filepath
var path = filepath || this.state.path
Function semicolons
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
var semicolons = function( line ) {
if ( ignoreRe.test( line.trim() ) ) return
if ( this.state.hashOrCss ) return
var semicolon
- 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 efficient
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
var efficient = function( line ) {
// line doesnt have margin or padding then there's nothin to do here
if ( !valueRe.test( line ) ) { return }
var isEfficient = true
Function quotePref
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
var quotePref = function( line, origLine ) {
if ( origLine.indexOf( '"' ) === -1 &&
origLine.indexOf( "'" ) === -1 ) {
return
}
Function colons
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
var colons = function( line ) {
if ( ignoreRe.test( line ) || this.state.context === 0 ) { return }
var colon
var hasPseudo = false
- 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 getExitCode
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
function getExitCode( errsLength, warningsLength, maxErrors, maxWarnings ) {
if ( errsLength > 0 ) {
if ( typeof maxErrors === 'number' ) {
if ( errsLength > maxErrors ) return 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
Avoid deeply nested control flow statements. Open
else if ( this.state.conf === 'lowercase-dash' ) {
// if no - present, or _ present, or A-Z present
if ( arr[0].indexOf( '-' ) === -1 ||
arr[0].indexOf( '_' ) !== -1 ||
upperRe.test( arr[0] ) ) {
Avoid deeply nested control flow statements. Open
if ( arr[0].indexOf( '-' ) !== -1 ||
arr[0].indexOf( '_' ) === -1 ||
upperRe.test( arr[0] ) ) {
badConvention = true
}
Function mixed
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
var mixed = function( line, origLine ) {
var trimRight = origLine.replace( trimRightRe, '' )
var isMixed = false
var indentPref = this.config.indentPref.expect || this.config.indentPref
var isNum = typeof indentPref === 'number'
- 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
Consider simplifying this complex logical expression. Open
if ( this.state.hashOrCSS || // 1
this.state.root || // 1
interpolatedRe.test( this.cache.origLine ) ||
ignoreRe.test( line.trim() ) || // 2
attrOrMixinRe.test( line ) || // 3
Function zeroUnits
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
var zeroUnits = function( line ) {
// if in keyframes dont check
// if no 0 on line dont check
// if relative values like font-weight, dont check
if ( this.state.keyframes ||
- 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 blocks
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
var blocks = function( line ) {
if ( line.indexOf( '=' ) === -1 ) { return }
var block
var index = line.indexOf( '@block' )
- 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"