Colonise/Config

View on GitHub

Showing 6 of 10 total issues

Function copyDefaultFilesToRoot has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

export function copyDefaultFilesToRoot(): void {
    if (!fs.existsSync(absoluteCurrentDefaultDirectory)) {
        throw new Error(`Could not find default configuration path '${absoluteCurrentDefaultDirectory}'.`);
    }

Severity: Minor
Found in source/helpers.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 reportMissingAndUnknownRules has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export function reportMissingAndUnknownRules(eslintOptions: ESLint.Options & {rules: Record<string, unknown>;}): void {
    const linter = new Linter(eslintOptions);

    const eslintRuleNames = linter.getRules().keys();

Severity: Minor
Found in source/lint.ts - About 1 hr to fix

Function copyDefaultFilesToRoot has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export function copyDefaultFilesToRoot(): void {
    if (!fs.existsSync(absoluteCurrentDefaultDirectory)) {
        throw new Error(`Could not find default configuration path '${absoluteCurrentDefaultDirectory}'.`);
    }

Severity: Minor
Found in source/helpers.ts - About 1 hr to fix

Function migrate has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export function migrate(fromVersion: number, toVersion: number): void {
    log(`Migrating from ${fromVersion} to ${toVersion}.`);

    let previousVersion = fromVersion;

Severity: Minor
Found in source/migrate.ts - About 1 hr to fix

Function reportMissingAndUnknownRules has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

export function reportMissingAndUnknownRules(eslintOptions: ESLint.Options & {rules: Record<string, unknown>;}): void {
    const linter = new Linter(eslintOptions);

    const eslintRuleNames = linter.getRules().keys();

Severity: Minor
Found in source/lint.ts - About 45 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 migrate has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

export function migrate(fromVersion: number, toVersion: number): void {
    log(`Migrating from ${fromVersion} to ${toVersion}.`);

    let previousVersion = fromVersion;

Severity: Minor
Found in source/migrate.ts - About 45 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