mschnee/mister

View on GitHub

Showing 41 of 41 total issues

File PackageCache.ts has 440 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import * as fs from 'fs';
import { EOL } from 'os';
import * as path from 'path';

import chalk from 'chalk';
Severity: Minor
Found in src/lib/PackageCache/PackageCache.ts - About 6 hrs to fix

    Function isPackageThingUpToDate has 110 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private isPackageThingUpToDate(
            packageName: string,
            thing: string,
            thingName: string
        ) {
    Severity: Major
    Found in src/lib/PackageCache/PackageCache.ts - About 4 hrs to fix

      Function isPackageThingUpToDate has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
      Open

          private isPackageThingUpToDate(
              packageName: string,
              thing: string,
              thingName: string
          ) {
      Severity: Minor
      Found in src/lib/PackageCache/PackageCache.ts - About 3 hrs 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

      File PackageManager.ts has 296 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import { SpawnOptions } from 'child_process';
      import * as fs from 'fs';
      import * as path from 'path';
      
      import chalk from 'chalk';
      Severity: Minor
      Found in src/lib/PackageManager/PackageManager.ts - About 3 hrs to fix

        Function arePackageThingDependenciesUpToDate has 70 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public arePackageThingDependenciesUpToDate(
                packageName: string,
                thing: string,
                thingName: string
            ) {
        Severity: Major
        Found in src/lib/PackageCache/PackageCache.ts - About 2 hrs to fix

          Function runProcess has 62 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export default function runProcess(command: string, args: string[], options: SpawnOptions, argv: any, logPrefix?: string) {
              return new Promise((resolve, reject) => {
                  /* istanbul ignore next */
                  if (argv.verbose >= 4 || argv.stdio) {
                      options.stdio = options.stdio || 'inherit';
          Severity: Major
          Found in src/lib/run-process.ts - About 2 hrs to fix

            PackageManager has 21 functions (exceeds 20 allowed). Consider refactoring.
            Open

            export default class PackageManager {
            
                // settings
                private packagePrefix: string;
                private distPrefix: string;
            Severity: Minor
            Found in src/lib/PackageManager/PackageManager.ts - About 2 hrs to fix

              Function getCache has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
              Open

                  public getCache(): BuildCache {
                      if (!this.buildCache) {
                          try {
                              if (fs.existsSync(this.cacheFilePath)) {
                                  this.buildCache = JSON.parse(
              Severity: Minor
              Found in src/lib/PackageCache/PackageCache.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 packCommand has 44 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public packCommand() {
                      const mrjson = this.packageManager.getMonorepoPjson();
                      const manifestFile = {
                          packages: {},
                          version:  mrjson.version,
              Severity: Minor
              Found in src/lib/App/App.ts - About 1 hr to fix

                Function getCache has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public getCache(): BuildCache {
                        if (!this.buildCache) {
                            try {
                                if (fs.existsSync(this.cacheFilePath)) {
                                    this.buildCache = JSON.parse(
                Severity: Minor
                Found in src/lib/PackageCache/PackageCache.ts - About 1 hr to fix

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

                                  if (depTimestamp > refTime) {
                                      if (this.why) {
                                          // tslint:disable-next-line:no-console
                                          console.log(
                                              wrap(
                  Severity: Major
                  Found in src/lib/PackageCache/PackageCache.ts and 1 other location - About 1 hr to fix
                  src/lib/PackageCache/PackageCache.ts on lines 425..440

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

                  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

                                  if (errBuffer && !argv.quiet) {
                                      errBuffer.toString().split(EOL).forEach(l => {
                                          /* tslint:disable-next-line no-console */
                                          console.log(wrap('[]', logPrefix || 'run-process', chalk.bold.red), l);
                                      });
                  Severity: Major
                  Found in src/lib/run-process.ts and 1 other location - About 1 hr to fix
                  src/lib/run-process.ts on lines 71..76

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

                  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

                              if (stat.mtime >= lastSuccessTime) {
                                  if (this.why) {
                                      // tslint:disable-next-line:no-console
                                      console.log(
                                          wrap(
                  Severity: Major
                  Found in src/lib/PackageCache/PackageCache.ts and 1 other location - About 1 hr to fix
                  src/lib/PackageCache/PackageCache.ts on lines 188..203

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

                  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

                                          if (!argv.quiet) {
                                              errBuffer.toString().split(EOL).forEach(l => {
                                                  /* tslint:disable-next-line no-console */
                                                  console.log(wrap('[]', logPrefix || 'run-process', chalk.bold.red), l);
                                              });
                  Severity: Major
                  Found in src/lib/run-process.ts and 1 other location - About 1 hr to fix
                  src/lib/run-process.ts on lines 55..60

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

                  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 doTasksOnAll has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public doTasksOnAll(packages: string[]) {
                          return packages.reduce((accum, packageName) => {
                              const tasks  = this.packageManager.getMatchingPackageTasks(packageName, this.args.tasks || this.args._)
                              return tasks.reduce((a: any, task) => {
                                  return a.then(async (previousSuccess) => {
                  Severity: Minor
                  Found in src/lib/App/App.ts - About 1 hr to fix

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

                    export async function handler(argv) {
                        const app = new App(argv);
                        const result = await app.packCommand();
                        if (!result) {
                            process.exit(-1);
                    Severity: Major
                    Found in src/commands/pack.ts and 2 other locations - About 1 hr to fix
                    src/commands/do.ts on lines 24..30
                    src/commands/zip.ts on lines 8..14

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

                    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

                    export async function handler(argv) {
                        const app = new App(argv);
                        const result = await app.doCommand();
                        if (!result) {
                            process.exit(-1);
                    Severity: Major
                    Found in src/commands/do.ts and 2 other locations - About 1 hr to fix
                    src/commands/pack.ts on lines 16..22
                    src/commands/zip.ts on lines 8..14

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

                    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

                    export async function handler(argv) {
                        const app = new App(argv);
                        const result = await app.zipCommand();
                        if (!result) {
                            process.exit(-1)
                    Severity: Major
                    Found in src/commands/zip.ts and 2 other locations - About 1 hr to fix
                    src/commands/do.ts on lines 24..30
                    src/commands/pack.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 61.

                    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 async function handler(argv) {
                        const app = new App(argv);
                        const result = await app.cleanCommand();
                        if (!result) {
                            return process.exit(-1);
                    Severity: Major
                    Found in src/commands/clean.ts and 1 other location - About 1 hr to fix
                    src/commands/do-all.ts on lines 8..14

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

                    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 async function handler(argv) {
                        const app = new App(argv);
                        const result = await app.doCommandOnAll();
                        if (!result) {
                            return process.exit(-1);
                    Severity: Major
                    Found in src/commands/do-all.ts and 1 other location - About 1 hr to fix
                    src/commands/clean.ts on lines 8..14

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

                    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