JamieMason/eslint-plugin-move-files

View on GitHub

Showing 12 of 26 total issues

File move-files.spec.ts has 360 lines of code (exceeds 250 allowed). Consider refactoring.
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';
Severity: Minor
Found in src/move-files.spec.ts - About 4 hrs to fix

    Function create has 65 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      create: (context) => {
        const currentFilePath = context.getFilename();
        const dirPath = dirname(currentFilePath);
    
        if (visitedFiles[currentFilePath]) {
    Severity: Major
    Found in src/move-files.ts - About 2 hrs to fix

      Function getValue has 28 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export const getValue = (query: string, absPath: string) => {
        if (query === 'rootDir') {
          return getRootDir();
        }
        if (query === 'dir') {
      Severity: Minor
      Found in src/lib/path-reader.ts - About 1 hr to fix

        Function getValue has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

        export const getValue = (query: string, absPath: string) => {
          if (query === 'rootDir') {
            return getRootDir();
          }
          if (query === 'dir') {
        Severity: Minor
        Found in src/lib/path-reader.ts - About 1 hr to fix

        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

        const updateMovedFile = (
          context: Rule.RuleContext,
          fileIndex: FileIndex,
          fileDirPath: string,
          newFilePath: string,
        Severity: Minor
        Found in src/move-files.ts - About 1 hr to fix

          Avoid too many return statements within this function.
          Open

              return getIn(getDirsIndex(query), getDirs(absPath), '');
          Severity: Major
          Found in src/lib/path-reader.ts - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                return getIn(getAncestorsIndex(query), getAncestors(absPath), '');
            Severity: Major
            Found in src/lib/path-reader.ts - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                  return getIn(getExtsIndex(query), getExts(absPath), '');
              Severity: Major
              Found in src/lib/path-reader.ts - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                    return getExt(absPath);
                Severity: Major
                Found in src/lib/path-reader.ts - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                    return '';
                  Severity: Major
                  Found in src/lib/path-reader.ts - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                        return getIn(query.length - 2, getAncestors(absPath), '');
                    Severity: Major
                    Found in src/lib/path-reader.ts - About 30 mins to fix

                      Function create has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                        create: (context) => {
                          const currentFilePath = context.getFilename();
                          const dirPath = dirname(currentFilePath);
                      
                          if (visitedFiles[currentFilePath]) {
                      Severity: Minor
                      Found in src/move-files.ts - About 25 mins to fix

                      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

                      Severity
                      Category
                      Status
                      Source
                      Language