MartyO256/find-files-by-patterns

View on GitHub

Showing 7 of 225 total issues

Function constrainedDownwardFiles has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

async function* constrainedDownwardFiles(
  startDirectory: string,
  maximumDepth: number,
): AsyncIterable<string> {
  const start = startingDirectory(resolve(startDirectory));
Severity: Minor
Found in src/files.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 constrainedDownwardFilesSync has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

function* constrainedDownwardFilesSync(
  startDirectory: string,
  maximumDepth: number,
): Iterable<string> {
  const start = startingDirectory(resolve(startDirectory));
Severity: Minor
Found in src/files.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 unconstrainedDownwardFiles has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

async function* unconstrainedDownwardFiles(
  startDirectory: string,
): AsyncIterable<string> {
  const start = resolve(startDirectory);
  const pendingFiles: Array<AsyncIterable<string>> = [readdir(start)];
Severity: Minor
Found in src/files.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 unconstrainedDownwardFilesSync has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

function* unconstrainedDownwardFilesSync(
  startDirectory: string,
): Iterable<string> {
  const start = resolve(startDirectory);
  const pendingFiles: Array<Iterable<string>> = [readdirSync(start)];
Severity: Minor
Found in src/files.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 findOnlyFileSync has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export function findOnlyFileSync(
  directories?: string | Iterable<string> | FilterSync<string>,
  ...filters: Array<FilterSync<string>>
): string | null {
  [directories, filters] = handleFunctionOverloadSync(directories, filters);
Severity: Minor
Found in src/fileFinders.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

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

export async function findOnlyFile(
  directories?:
    | string
    | AsyncIterable<string>
    | Iterable<string>
Severity: Minor
Found in src/fileFinders.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

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

export async function* multiMap<T, U>(
  iterable: Iterable<T> | AsyncIterable<T>,
  map: (element: T) => Promise<U | Iterable<U> | AsyncIterable<U>>,
): AsyncIterable<U> {
  for await (const element of iterable) {
Severity: Minor
Found in src/map.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