wkdhkr/dedupper

View on GitHub

Showing 303 of 303 total issues

Function calculate has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  calculate(targetPath: string): Promise<string> {
    const classifyType = this.as.detectClassifyType(targetPath);
    const shasum = crypto.createHash(this.config.hashAlgorithm);
    if (
      [
Severity: Minor
Found in src/services/fs/contents/HashService.js - About 1 hr to fix

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

    export function drawPoint(
      ctx: any,
      y: number,
      x: number,
      r: number,
    Severity: Major
    Found in src/services/deepLearning/bodyPix/demo_util.js and 1 other location - About 1 hr to fix
    src/services/deepLearning/poseNet/demo_util.js on lines 85..90

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

    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

    export function drawPoint(ctx, y, x, r, color) {
      ctx.beginPath();
      ctx.arc(x, y, r, 0, 2 * Math.PI);
      ctx.fillStyle = color;
      ctx.fill();
    Severity: Major
    Found in src/services/deepLearning/poseNet/demo_util.js and 1 other location - About 1 hr to fix
    src/services/deepLearning/bodyPix/demo_util.js on lines 29..40

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

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

      async processImportedFile(): Promise<boolean> {
        const sourcePath = this.fileService.getSourcePath();
        const toPath = FileNameMarkHelper.strip(sourcePath);
        const type = AttributeService.detectClassifyTypeByConfig(this.config);
        if (this.fileService.isLibraryPlace(toPath) === false) {
    Severity: Minor
    Found in src/services/ProcessService.js - About 1 hr to fix

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

        async delete(targetPath?: string, isRetry: boolean = false) {
          const finalTargetPath = this.getSourcePath(targetPath);
          if (!(await pathExists(finalTargetPath))) {
            return;
          }
      Severity: Minor
      Found in src/services/fs/FileService.js - 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 run has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

        async run() {
          let isError = false;
      
          this.registerErrorCallback();
      
      
      Severity: Minor
      Found in src/App.js - 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 escapeForQuery has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      const escapeForQuery = (str: string) => {
        let escapedStr = str;
        [
          " ",
          "+",
      Severity: Minor
      Found in src/services/amazon/ACDService.js - About 1 hr to fix

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

          queryByValue(
            column: string,
            $value: number | string,
            type: ClassifyType
          ): Promise<HashRow[]> {
        Severity: Minor
        Found in src/services/db/DbService.js - About 1 hr to fix

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

            queryByValue(column: string, $value: number | string): Promise<FacePPRow[]> {
              return new Promise((resolve, reject) => {
                const db = this.spawnDb();
                const rows = [];
                db.serialize(async () => {
          Severity: Minor
          Found in src/services/db/FacePPDbService.js - About 1 hr to fix

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

              searchAndGo(
                type: ClassifyType = TYPE_IMAGE,
                processLimit: number = 1
              ): Promise<number> {
                const limit = pLimit(parseInt(this.config.maxWorkers / 2, 10));
            Severity: Minor
            Found in src/services/amazon/ACDSyncService.js - About 1 hr to fix

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

                queryByValue(column: string, $value: number | string): Promise<any[]> {
                  return new Promise((resolve, reject) => {
                    const db = this.ss.spawn<any>(this.ss.detectDbFilePath(TYPE_IMAGE));
                    const rows = [];
                    db.serialize(async () => {
              Severity: Minor
              Found in src/services/db/TagDbService.js - About 1 hr to fix

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

                  async download(name: FaceApiModelName) {
                    const urls = this.getModelUrlsByName(name);
                    if (DeepLearningHelper.isFaceApiModelDownloaded(name)) {
                      return;
                    }
                Severity: Minor
                Found in src/services/deepLearning/faceApi/FaceApiModelService.js - About 1 hr to fix

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

                    static decodeGlass(rawGlass: number): FacePPGlass {
                      const key = FacePPHelper.reverseGlassLookup[String(rawGlass)];
                      if (key) {
                        return key;
                      }
                  Severity: Major
                  Found in src/helpers/FacePPHelper.js and 1 other location - About 1 hr to fix
                  src/helpers/FacePPHelper.js on lines 50..56

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

                  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

                    static decodeGender(rawGender: number): FacePPGender {
                      const key = FacePPHelper.reverseGenderLookup[String(rawGender)];
                      if (key) {
                        return key;
                      }
                  Severity: Major
                  Found in src/helpers/FacePPHelper.js and 1 other location - About 1 hr to fix
                  src/helpers/FacePPHelper.js on lines 25..31

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

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

                      it("png", async () => {
                        expect(
                          await subject.calculate(TestHelper.sampleFile.image.png.default)
                        ).toBe("54086765383280");
                      });
                  Severity: Major
                  Found in __tests__/services/fs/contents/PHashService.test.js and 8 other locations - About 55 mins to fix
                  __tests__/services/fs/contents/DHashService.test.js on lines 14..18
                  __tests__/services/fs/contents/DHashService.test.js on lines 20..24
                  __tests__/services/fs/contents/HashService.test.js on lines 16..20
                  __tests__/services/fs/contents/HashService.test.js on lines 21..25
                  __tests__/services/fs/contents/HashService.test.js on lines 26..30
                  __tests__/services/fs/contents/HashService.test.js on lines 31..35
                  __tests__/services/fs/contents/HashService.test.js on lines 36..40
                  __tests__/services/fs/contents/PHashService.test.js on lines 27..31

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

                      it("jpg", async () => {
                        expect(
                          await subject.calculate(TestHelper.sampleFile.image.jpg.default)
                        ).toBe("7856513260241168089");
                      });
                  Severity: Major
                  Found in __tests__/services/fs/contents/PHashService.test.js and 8 other locations - About 55 mins to fix
                  __tests__/services/fs/contents/DHashService.test.js on lines 14..18
                  __tests__/services/fs/contents/DHashService.test.js on lines 20..24
                  __tests__/services/fs/contents/HashService.test.js on lines 16..20
                  __tests__/services/fs/contents/HashService.test.js on lines 21..25
                  __tests__/services/fs/contents/HashService.test.js on lines 26..30
                  __tests__/services/fs/contents/HashService.test.js on lines 31..35
                  __tests__/services/fs/contents/HashService.test.js on lines 36..40
                  __tests__/services/fs/contents/PHashService.test.js on lines 21..25

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

                      it("unknown", async () => {
                        expect(
                          await subject.calculate(TestHelper.sampleFile.misc.unknown.default)
                        ).toBe("");
                      });
                  Severity: Major
                  Found in __tests__/services/fs/contents/HashService.test.js and 8 other locations - About 55 mins to fix
                  __tests__/services/fs/contents/DHashService.test.js on lines 14..18
                  __tests__/services/fs/contents/DHashService.test.js on lines 20..24
                  __tests__/services/fs/contents/HashService.test.js on lines 16..20
                  __tests__/services/fs/contents/HashService.test.js on lines 21..25
                  __tests__/services/fs/contents/HashService.test.js on lines 26..30
                  __tests__/services/fs/contents/HashService.test.js on lines 31..35
                  __tests__/services/fs/contents/PHashService.test.js on lines 21..25
                  __tests__/services/fs/contents/PHashService.test.js on lines 27..31

                  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

                                  blur: {
                                    blurness: {
                                      threshold: 50,
                                      value: 0.682
                                    },
                  Severity: Minor
                  Found in __tests__/services/db/FacePPDbService.test.js and 1 other location - About 55 mins to fix
                  __tests__/services/db/FacePPDbService.test.js on lines 890..894

                  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

                            const res = await this.limitDetect(() =>
                              axios
                                .post(this.detectApiUrl("faceDetectWithGenderApi"), data, {
                                  headers: form.getHeaders()
                                })
                  Severity: Minor
                  Found in src/services/deepLearning/RudeCarnieService.js and 1 other location - About 55 mins to fix
                  src/services/deepLearning/RudeCarnieService.js on lines 127..133

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

                      it("jpg", async () => {
                        expect(
                          await subject.calculate(TestHelper.sampleFile.image.jpg.default)
                        ).toBe("dd82c626ec0047df4caf1309b8e4008b072e2627");
                      });
                  Severity: Major
                  Found in __tests__/services/fs/contents/HashService.test.js and 8 other locations - About 55 mins to fix
                  __tests__/services/fs/contents/DHashService.test.js on lines 14..18
                  __tests__/services/fs/contents/DHashService.test.js on lines 20..24
                  __tests__/services/fs/contents/HashService.test.js on lines 16..20
                  __tests__/services/fs/contents/HashService.test.js on lines 21..25
                  __tests__/services/fs/contents/HashService.test.js on lines 31..35
                  __tests__/services/fs/contents/HashService.test.js on lines 36..40
                  __tests__/services/fs/contents/PHashService.test.js on lines 21..25
                  __tests__/services/fs/contents/PHashService.test.js on lines 27..31

                  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

                  Severity
                  Category
                  Status
                  Source
                  Language