Showing 12 of 26 total issues
File move-files.spec.ts
has 360 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import { RuleTester } from 'eslint';
import { existsSync, readFileSync } from 'fs';
import * as mock from 'mock-fs';
import { resolve } from 'path';
import rule from './move-files';
Function create
has 65 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
create: (context) => {
const currentFilePath = context.getFilename();
const dirPath = dirname(currentFilePath);
if (visitedFiles[currentFilePath]) {
Function getValue
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const getValue = (query: string, absPath: string) => {
if (query === 'rootDir') {
return getRootDir();
}
if (query === 'dir') {
Function getValue
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
Open
export const getValue = (query: string, absPath: string) => {
if (query === 'rootDir') {
return getRootDir();
}
if (query === 'dir') {
- 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 updateMovedFile
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const updateMovedFile = (
context: Rule.RuleContext,
fileIndex: FileIndex,
fileDirPath: string,
newFilePath: string,
Avoid too many return
statements within this function. Open
Open
return getIn(getDirsIndex(query), getDirs(absPath), '');
Avoid too many return
statements within this function. Open
Open
return getIn(getAncestorsIndex(query), getAncestors(absPath), '');
Avoid too many return
statements within this function. Open
Open
return getIn(getExtsIndex(query), getExts(absPath), '');
Avoid too many return
statements within this function. Open
Open
return getExt(absPath);
Avoid too many return
statements within this function. Open
Open
return '';
Avoid too many return
statements within this function. Open
Open
return getIn(query.length - 2, getAncestors(absPath), '');
Function create
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
create: (context) => {
const currentFilePath = context.getFilename();
const dirPath = dirname(currentFilePath);
if (visitedFiles[currentFilePath]) {
- 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"