XasCode/terrafile-backend-lib

View on GitHub

Showing 67 of 67 total issues

Similar blocks of code found in 2 locations. Consider refactoring.
Open

it.each([
  {
    source: `git@github.com:terraform-aws-modules/terraform-aws-vpc.git//examples/replace-me`,
    path: `/examples/simple-vpc`,
    rewritten: `git@github.com:terraform-aws-modules/terraform-aws-vpc.git//examples/simple-vpc`,
Severity: Minor
Found in __tests__/replace/replacePath.replace.spec.ts and 1 other location - About 45 mins to fix
__tests__/replace/replaceVersion.rename.spec.ts on lines 6..29

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 50.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

it.each([
  {
    source: `https://github.com/terraform-aws-modules/terraform-aws-vpc.git?ref=v2.78.0`,
    version: `v2.79.0`,
    rewritten: `https://github.com/terraform-aws-modules/terraform-aws-vpc.git?ref=v2.79.0`,
Severity: Minor
Found in __tests__/replace/replaceVersion.rename.spec.ts and 1 other location - About 45 mins to fix
__tests__/replace/replacePath.replace.spec.ts on lines 6..24

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 50.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Identical blocks of code found in 2 locations. Consider refactoring.
Open

  beforeEach(() => {
    fsHelpers.rimrafDir(fsHelpers.getAbsolutePath(`bar`).value);
    spy.clear();
  });
Severity: Minor
Found in __tests__/fsHelpers.mock.spec.ts and 1 other location - About 45 mins to fix
__tests__/fsHelpers.mock.spec.ts on lines 95..98

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 50.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Identical blocks of code found in 2 locations. Consider refactoring.
Open

  beforeEach(() => {
    fsHelpers.rimrafDir(fsHelpers.getAbsolutePath(`bar`).value);
    spy.clear();
  });
Severity: Minor
Found in __tests__/fsHelpers.mock.spec.ts and 1 other location - About 45 mins to fix
__tests__/fsHelpers.mock.spec.ts on lines 31..34

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 50.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

async function scopeRepo(
  [, repoDir]: RepoLocation,
  fullDest: Path,
  cloner: (_: string[], __?: Path) => Promise<ExecResult>,
): Promise<ExecResult> {
Severity: Minor
Found in src/backend/moduleSources/common/cloneRepo.ts and 1 other location - About 40 mins to fix
src/backend/moduleSources/common/cloneRepo.ts on lines 65..75

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 49.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

async function checkoutCommit(
  [, , , commit]: RepoLocation,
  fullDest: Path,
  cloner: (_: string[], __?: Path) => Promise<ExecResult>,
): Promise<ExecResult> {
Severity: Minor
Found in src/backend/moduleSources/common/cloneRepo.ts and 1 other location - About 40 mins to fix
src/backend/moduleSources/common/cloneRepo.ts on lines 53..63

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 49.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Function fetchModules has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

    contents: [string, Record<string, string>][],
    dir: Path,
    fetcher: (_: Config) => Promise<RetString>,
    cloner: (_: string[], __?: Path) => Promise<ExecResult>,
    fsHelpers: FsHelpers,
Severity: Minor
Found in src/backend/processFile.ts - About 35 mins to fix

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

    const cleanUpTestDirs = () => {
      return testDirs.forEach((testDir) => {
        return rimrafDir(getAbsolutePath(testDir).value);
      });
    };
    Severity: Minor
    Found in __tests__/backend.axiosUndefError.mocked.spec.ts and 1 other location - About 35 mins to fix
    __tests__/backend.axiosNoXTFGetError.mocked.spec.ts on lines 16..20

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 46.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

    const cleanUpTestDirs = () => {
      return testDirs.forEach((testDir) => {
        return rimrafDir(getAbsolutePath(testDir).value);
      });
    };
    Severity: Minor
    Found in __tests__/backend.axiosNoXTFGetError.mocked.spec.ts and 1 other location - About 35 mins to fix
    __tests__/backend.axiosUndefError.mocked.spec.ts on lines 16..20

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 46.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 3 locations. Consider refactoring.
    Open

    const cleanUpTestDirs = () => {
      testDirs.forEach((testDir) => {
        rimrafDir(getAbsolutePath(testDir).value);
      });
    };
    Severity: Minor
    Found in __tests__/backend.axiosFormatError.mocked.spec.ts and 2 other locations - About 35 mins to fix
    __tests__/backend.axios500Error.mocked.spec.ts on lines 16..20
    __tests__/backend.gitError.mocked.spec.ts on lines 16..20

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 46.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 3 locations. Consider refactoring.
    Open

    const cleanUpTestDirs = () => {
      testDirs.forEach((testDir) => {
        rimrafDir(getAbsolutePath(testDir).value);
      });
    };
    Severity: Minor
    Found in __tests__/backend.gitError.mocked.spec.ts and 2 other locations - About 35 mins to fix
    __tests__/backend.axios500Error.mocked.spec.ts on lines 16..20
    __tests__/backend.axiosFormatError.mocked.spec.ts on lines 16..20

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 46.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 3 locations. Consider refactoring.
    Open

    const cleanUpTestDirs = () => {
      testDirs.forEach((testDir) => {
        rimrafDir(getAbsolutePath(testDir).value);
      });
    };
    Severity: Minor
    Found in __tests__/backend.axios500Error.mocked.spec.ts and 2 other locations - About 35 mins to fix
    __tests__/backend.axiosFormatError.mocked.spec.ts on lines 16..20
    __tests__/backend.gitError.mocked.spec.ts on lines 16..20

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 46.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

        expect(console.error).toHaveBeenLastCalledWith(`Error creating dir: ${fsHelpers.getAbsolutePath(`LICENSE`).value}`);
    Severity: Minor
    Found in __tests__/fsHelpers.mock.spec.ts and 1 other location - About 30 mins to fix
    __tests__/fsHelpers.mock.spec.ts on lines 86..86

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 45.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

        expect(console.error).toHaveBeenLastCalledWith(`Error deleting dir: ${fsHelpers.getAbsolutePath(`LICENSE`).value}`);
    Severity: Minor
    Found in __tests__/fsHelpers.mock.spec.ts and 1 other location - About 30 mins to fix
    __tests__/fsHelpers.mock.spec.ts on lines 49..49

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 45.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

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

    async function install(options: CliOptions): Promise<void> {
      console.log(chalk.blue(`Plan: (${options.file}) --> (${options.directory})`));
      const createResult = createTargetDirectory(options);
      if (!createResult.success) {
        console.error(chalk.red(`  ! Failed - create target directory: ${options.directory}`));
    Severity: Minor
    Found in src/backend/index.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

    Ordered list item prefix
    Open

    3. npm link ../terrafile-backend-lib
    Severity: Info
    Found in CONTRIBUTING.md by markdownlint

    MD029 - Ordered list item prefix

    Tags: ol

    Aliases: ol-prefix

    Parameters: style ("one", "ordered"; default "one")

    This rule is triggered on ordered lists that do not either start with '1.' or do not have a prefix that increases in numerical order (depending on the configured style, which defaults to 'one').

    Example valid list if the style is configured as 'one':

    1. Do this.
    1. Do that.
    1. Done.

    Example valid list if the style is configured as 'ordered':

    1. Do this.
    2. Do that.
    3. Done.

    Ordered list item prefix
    Open

    3. npm ci
    Severity: Info
    Found in CONTRIBUTING.md by markdownlint

    MD029 - Ordered list item prefix

    Tags: ol

    Aliases: ol-prefix

    Parameters: style ("one", "ordered"; default "one")

    This rule is triggered on ordered lists that do not either start with '1.' or do not have a prefix that increases in numerical order (depending on the configured style, which defaults to 'one').

    Example valid list if the style is configured as 'one':

    1. Do this.
    1. Do that.
    1. Done.

    Example valid list if the style is configured as 'ordered':

    1. Do this.
    2. Do that.
    3. Done.

    Ordered list item prefix
    Open

    2. npm link
    Severity: Info
    Found in CONTRIBUTING.md by markdownlint

    MD029 - Ordered list item prefix

    Tags: ol

    Aliases: ol-prefix

    Parameters: style ("one", "ordered"; default "one")

    This rule is triggered on ordered lists that do not either start with '1.' or do not have a prefix that increases in numerical order (depending on the configured style, which defaults to 'one').

    Example valid list if the style is configured as 'one':

    1. Do this.
    1. Do that.
    1. Done.

    Example valid list if the style is configured as 'ordered':

    1. Do this.
    2. Do that.
    3. Done.

    Ordered list item prefix
    Open

    5. npm run build
    Severity: Info
    Found in CONTRIBUTING.md by markdownlint

    MD029 - Ordered list item prefix

    Tags: ol

    Aliases: ol-prefix

    Parameters: style ("one", "ordered"; default "one")

    This rule is triggered on ordered lists that do not either start with '1.' or do not have a prefix that increases in numerical order (depending on the configured style, which defaults to 'one').

    Example valid list if the style is configured as 'one':

    1. Do this.
    1. Do that.
    1. Done.

    Example valid list if the style is configured as 'ordered':

    1. Do this.
    2. Do that.
    3. Done.

    Ordered list item prefix
    Open

    7. npm publish --access=public
    Severity: Info
    Found in CONTRIBUTING.md by markdownlint

    MD029 - Ordered list item prefix

    Tags: ol

    Aliases: ol-prefix

    Parameters: style ("one", "ordered"; default "one")

    This rule is triggered on ordered lists that do not either start with '1.' or do not have a prefix that increases in numerical order (depending on the configured style, which defaults to 'one').

    Example valid list if the style is configured as 'one':

    1. Do this.
    1. Do that.
    1. Done.

    Example valid list if the style is configured as 'ordered':

    1. Do this.
    2. Do that.
    3. Done.
    Severity
    Category
    Status
    Source
    Language