Function lintFiles
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
async function* lintFiles(patterns, options) {
const opts = { dirs: [], cwd: process.cwd(), ...options };
opts.exclude = opts.exclude || DEFAULT_IGNORE;
opts.extensions = opts.extensions || DEFAULT_EXTENSIONS;
opts.cacheLocation =
- Read upRead up
- Create a ticketCreate a ticket
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 lintFiles
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
async function* lintFiles(patterns, options) {
const opts = { dirs: [], cwd: process.cwd(), ...options };
opts.exclude = opts.exclude || DEFAULT_IGNORE;
opts.extensions = opts.extensions || DEFAULT_EXTENSIONS;
opts.cacheLocation =
- Create a ticketCreate a ticket
File api.js
has 252 lines of code (exceeds 250 allowed). Consider refactoring. Open
/* eslint-disable global-require */
/* eslint-disable import/no-dynamic-require */
/* eslint-disable no-restricted-syntax */
/* eslint-disable max-statements */
- Create a ticketCreate a ticket
Function injectIntoLinter
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
function injectIntoLinter(config, linter) {
if (!config) {
return linter;
}
- Create a ticketCreate a ticket
Function lint
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
function lint(options) {
const opts = { ...options };
const cfg = { ...opts.config, filename: opts.filename };
const linter = opts.linter || new Linter();
const filter = (x) =>
- Read upRead up
- Create a ticketCreate a ticket
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 (ctx.changed) {
const dirname = path.dirname(ctx.file.path);
if (opts.dirs.includes(dirname)) {
eslintConfig = await resolveConfig(ctx.file.path, 0, {
...opts,
- Create a ticketCreate a ticket
Function injectIntoLinter
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
function injectIntoLinter(config, linter) {
if (!config) {
return linter;
}
- Read upRead up
- Create a ticketCreate a ticket
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"