domjtalbot/nx-mesh

View on GitHub

Showing 553 of 553 total issues

Function createFiles has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export function createFiles(tree: Tree, options: NormalizedOptions) {
  if (options.isApp) {
    generateFiles(
      tree,
      path.join(__dirname, '../files/app'),
Severity: Minor
Found in packages/nx-mesh/src/generators/base/lib/create-files.ts - About 1 hr to fix

    Function addLinting has 32 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export async function addLinting(
      host: Tree,
      options: NormalizedOptions
    ): Promise<GeneratorCallback> {
      const linting = await lintProjectGenerator(host, {
    Severity: Minor
    Found in packages/nx-mesh/src/generators/base/lib/add-linting.ts - About 1 hr to fix

      Function addCypress has 32 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export async function addCypress(host: Tree, options: NormalizedOptions) {
        const task = await cypressProjectGenerator(host, {
          ...options,
          directory: options.projectParentDirectory,
          linter: Linter.EsLint,
      Severity: Minor
      Found in packages/nx-mesh/src/generators/base/lib/add-cypress.ts - About 1 hr to fix

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

        export async function getServeLocation(options: StartExecutorSchema) {
          let port = options.port.number ?? 4200;
          const isRange = options.port.range !== undefined;
          const range = getPort.makeRange(
            options.port.range?.from ?? 1024,
        Severity: Minor
        Found in packages/nx-mesh/src/executors/start/lib/get-serve-location.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 getServeLocation has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

        export async function getServeLocation(options: DevExecutorSchema) {
          let port = options.port.number ?? 4200;
          const isRange = options.port.range !== undefined;
          const range = getPort.makeRange(
            options.port.range?.from ?? 1024,
        Severity: Minor
        Found in packages/nx-mesh/src/executors/dev/lib/get-serve-location.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 normalizeOptions has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

        export function normalizeOptions(
          tree: Tree,
          options: BaseOptions
        ): NormalizedOptions {
          const workspace = getWorkspaceLayout(tree);
        Severity: Minor
        Found in packages/nx-mesh/src/generators/base/lib/normalize-options.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 setDefaults has 30 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export function setDefaults(host: Tree, options: NormalizedOptions) {
          const workspace = readWorkspaceConfiguration(host);
        
          if (!workspace.defaultProject) {
            workspace.defaultProject = options.projectName;
        Severity: Minor
        Found in packages/nx-mesh/src/generators/base/lib/set-defaults.ts - About 1 hr to fix

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

          export const nodeGenerator = async (tree: Tree, options: NormalizedOptions) => {
            if (options.isApp) {
              return initGenerator(tree, {
                js: options.js,
                skipFormat: options.skipFormat,
          Severity: Minor
          Found in packages/nx-mesh/src/generators/base/lib/node-generator.ts - About 1 hr to fix

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

            export function addProjectConfig(tree: Tree, options: NormalizedOptions) {
              const {
                codegen,
                isApp,
                isLibrary,
            Severity: Minor
            Found in packages/nx-mesh/src/generators/base/lib/add-project-config.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 compileSwc has 26 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export async function compileSwc(
              context: ExecutorContext,
              normalizedOptions: NormalizedSwcExecutorOptions,
              postCompilationCallback: () => Promise<void>
            ) {

              Function addDependencies has 26 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export function addDependencies(
                host: Tree,
                options: Pick<CreateMeshExampleOptions, 'example' | 'codegen'>
              ) {
                let exampleDeps = {

                Function baseGenerator has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                export async function baseGenerator(tree: Tree, baseOptions: BaseOptions) {
                  const options = normalizeOptions(tree, baseOptions);
                  const { isCypress, isApp, isLibrary, skipFormat } = options;
                
                  const tasks: GeneratorCallback[] = [await nodeGenerator(tree, options)];
                Severity: Minor
                Found in packages/nx-mesh/src/generators/base/base.ts - About 1 hr to fix

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

                  export type BuildSWCExecutorSchema = SwcExecutorSchema &
                    MeshBuildSchema['args'] &
                    MeshBuildSchema['env'] & {
                      /**
                       * GraphQL Codegen config
                  Severity: Minor
                  Found in packages/nx-mesh/src/executors/build-swc/schema.ts and 1 other location - About 55 mins to fix
                  packages/nx-mesh/src/executors/build/schema.ts on lines 16..28

                  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 54.

                  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

                  export type BuildExecutorSchema = TscExecutorSchema &
                    MeshBuildSchema['args'] &
                    MeshBuildSchema['env'] & {
                      /**
                       * GraphQL Codegen config
                  Severity: Minor
                  Found in packages/nx-mesh/src/executors/build/schema.ts and 1 other location - About 55 mins to fix
                  packages/nx-mesh/src/executors/build-swc/schema.ts on lines 18..30

                  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 54.

                  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

                        runMeshCli(
                          'build',
                          {
                            args: {
                              dir,
                  Severity: Minor
                  Found in packages/nx-mesh/src/executors/build/build.ts and 1 other location - About 50 mins to fix
                  packages/nx-mesh/src/executors/build-swc/build-swc.ts on lines 28..43

                  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 52.

                  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

                        runMeshCli(
                          'build',
                          {
                            args: {
                              dir,
                  Severity: Minor
                  Found in packages/nx-mesh/src/executors/build-swc/build-swc.ts and 1 other location - About 50 mins to fix
                  packages/nx-mesh/src/executors/build/build.ts on lines 28..43

                  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 52.

                  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 4 locations. Consider refactoring.
                  Open

                    beforeEach(() => {
                      tree = createTreeWithEmptyWorkspace();
                  
                      const workspace = getWorkspaceLayout(tree);
                  
                  
                  packages/nx-mesh/src/generators/utils/create-mesh-example/add-dependencies.spec.ts on lines 13..19
                  packages/nx-mesh/src/generators/utils/create-mesh-example/create-codegen-files.spec.ts on lines 13..19
                  packages/nx-mesh/src/generators/utils/create-mesh-example/create-shared-files.spec.ts on lines 13..19

                  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

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

                    beforeEach(() => {
                      tree = createTreeWithEmptyWorkspace();
                  
                      const workspace = getWorkspaceLayout(tree);
                  
                  
                  packages/nx-mesh/src/generators/utils/create-mesh-example/add-dependencies.spec.ts on lines 13..19
                  packages/nx-mesh/src/generators/utils/create-mesh-example/create-mesh-example.spec.ts on lines 16..22
                  packages/nx-mesh/src/generators/utils/create-mesh-example/create-shared-files.spec.ts on lines 13..19

                  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

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

                    beforeEach(() => {
                      tree = createTreeWithEmptyWorkspace();
                  
                      const workspace = getWorkspaceLayout(tree);
                  
                  
                  packages/nx-mesh/src/generators/utils/create-mesh-example/create-codegen-files.spec.ts on lines 13..19
                  packages/nx-mesh/src/generators/utils/create-mesh-example/create-mesh-example.spec.ts on lines 16..22
                  packages/nx-mesh/src/generators/utils/create-mesh-example/create-shared-files.spec.ts on lines 13..19

                  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

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

                    beforeEach(() => {
                      tree = createTreeWithEmptyWorkspace();
                  
                      const workspace = getWorkspaceLayout(tree);
                  
                  
                  packages/nx-mesh/src/generators/utils/create-mesh-example/add-dependencies.spec.ts on lines 13..19
                  packages/nx-mesh/src/generators/utils/create-mesh-example/create-codegen-files.spec.ts on lines 13..19
                  packages/nx-mesh/src/generators/utils/create-mesh-example/create-mesh-example.spec.ts on lines 16..22

                  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

                  Severity
                  Category
                  Status
                  Source
                  Language