wkdhkr/dedupper

View on GitHub

Showing 303 of 303 total issues

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

            if (guiState.estimate === "partmap") {
              const segmentation = await this.estimatePartSegmentation(
                DeepLearningHelper.getTf().node.decodeImage(
                  // await fs.readFile(targetPath)
                  buffer
Severity: Major
Found in src/services/deepLearning/bodyPix/BodyPixService.js and 1 other location - About 2 hrs to fix
src/services/deepLearning/bodyPix/BodyPixService.js on lines 436..447

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

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

  detectApiUrl: (kind?: string) => string = (
    kind: string = "faceSpinnerApi"
  ): string => {
    apiPoolOffsetLookup[kind] += 1;
    const currentApi = this.config.deepLearningConfig[kind][
Severity: Major
Found in src/services/deepLearning/FaceSpinnerService.js and 1 other location - About 2 hrs to fix
src/services/deepLearning/RudeCarnieService.js on lines 57..69

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

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

  const fillField = async (items: { hash: string }[], param: any) => {
    if (items.length && param.type === "TYPE_IMAGE") {
      const hashs = items.map(i => i.hash);
      let columns = [
        "distinct hash.hash",
Severity: Major
Found in src/servers/routes/sqliteAllRoute.js - About 2 hrs to fix

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

      constructor(config: Config) {
        this.log = config.getLogger(this);
        this.config = config;
        this.rl = new ReasonLogic(config);
        this.as = new AttributeService(config);
    Severity: Major
    Found in src/services/judgment/StateLogic.js and 2 other locations - About 2 hrs to fix
    src/services/judgment/PathLogic.js on lines 53..58
    src/services/judgment/ReasonLogic.js on lines 42..47

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

    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

      constructor(config: Config) {
        this.log = config.getLogger(this);
        this.config = config;
        this.cl = new ContentsLogic(config);
        this.as = new AttributeService(config);
    Severity: Major
    Found in src/services/judgment/ReasonLogic.js and 2 other locations - About 2 hrs to fix
    src/services/judgment/PathLogic.js on lines 53..58
    src/services/judgment/StateLogic.js on lines 31..36

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

    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

      constructor(config: Config) {
        this.log = config.getLogger(this);
        this.config = config;
        this.rl = new ResultLogic(config);
        this.as = new AttributeService(config);
    Severity: Major
    Found in src/services/judgment/PathLogic.js and 2 other locations - About 2 hrs to fix
    src/services/judgment/ReasonLogic.js on lines 42..47
    src/services/judgment/StateLogic.js on lines 31..36

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

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

          mat.drawLine(
            new cv.Point(corners[0][0], corners[0][1]),
            new cv.Point(corners[1][0], corners[1][1]),
            {
              color: green,
    Severity: Major
    Found in src/services/deepLearning/FaceSpinnerService.js and 3 other locations - About 1 hr to fix
    src/services/deepLearning/FaceSpinnerService.js on lines 197..204
    src/services/deepLearning/FaceSpinnerService.js on lines 205..212
    src/services/deepLearning/FaceSpinnerService.js on lines 213..220

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

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

          mat.drawLine(
            new cv.Point(corners[1][0], corners[1][1]),
            new cv.Point(corners[2][0], corners[2][1]),
            {
              color: green,
    Severity: Major
    Found in src/services/deepLearning/FaceSpinnerService.js and 3 other locations - About 1 hr to fix
    src/services/deepLearning/FaceSpinnerService.js on lines 189..196
    src/services/deepLearning/FaceSpinnerService.js on lines 205..212
    src/services/deepLearning/FaceSpinnerService.js on lines 213..220

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

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

          mat.drawLine(
            new cv.Point(corners[2][0], corners[2][1]),
            new cv.Point(corners[3][0], corners[3][1]),
            {
              color: green,
    Severity: Major
    Found in src/services/deepLearning/FaceSpinnerService.js and 3 other locations - About 1 hr to fix
    src/services/deepLearning/FaceSpinnerService.js on lines 189..196
    src/services/deepLearning/FaceSpinnerService.js on lines 197..204
    src/services/deepLearning/FaceSpinnerService.js on lines 213..220

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

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

          mat.drawLine(
            new cv.Point(corners[3][0], corners[3][1]),
            new cv.Point(corners[0][0], corners[0][1]),
            {
              color: red,
    Severity: Major
    Found in src/services/deepLearning/FaceSpinnerService.js and 3 other locations - About 1 hr to fix
    src/services/deepLearning/FaceSpinnerService.js on lines 189..196
    src/services/deepLearning/FaceSpinnerService.js on lines 197..204
    src/services/deepLearning/FaceSpinnerService.js on lines 205..212

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

    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 toColoredPartMask has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

    export function toColoredPartMask(
      partSegmentation: any,
      passedPartColors: any
    ): ImageData | null {
      let partColors = passedPartColors;
    Severity: Minor
    Found in src/services/deepLearning/bodyPix/output_rendering_util.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 colorizeReasonType has 47 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      static colorizeReasonType(type: string): string {
        const typeLabel = type.padStart(TYPE_P_HASH_REJECT_LOW_RESOLUTION.length);
        switch (type) {
          // may be result
          case TYPE_P_HASH_MAY_BE:
    Severity: Minor
    Found in src/helpers/ReportHelper.js - About 1 hr to fix

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

                    eyegaze: {
                      left_eye_gaze: {
                        position_x_coordinate: 0.619,
                        position_y_coordinate: 0.359,
                        vector_x_component: 0.136,
      Severity: Major
      Found in __tests__/services/db/FacePPDbService.test.js and 1 other location - About 1 hr to fix
      __tests__/services/db/FacePPDbService.test.js on lines 442..457

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

      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

                      eyegaze: {
                        right_eye_gaze: {
                          position_x_coordinate: 0.628,
                          vector_z_component: 0.865,
                          vector_x_component: 0.382,
      Severity: Major
      Found in __tests__/services/db/FacePPDbService.test.js and 1 other location - About 1 hr to fix
      __tests__/services/db/FacePPDbService.test.js on lines 905..920

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

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

          const results = factors.map((factor): JudgeResultSimple => {
            this.log.trace(JSON.stringify(factor, null, 2));
            if (factor.isValidDistance === false) {
              return [TYPE_HOLD, factor.info, TYPE_PROCESS_ERROR];
            }
      Severity: Minor
      Found in src/services/judgment/PHashLogic.js - About 1 hr to fix

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

          async readInfo(): Promise<ImageContentsInfo> {
            switch (this.as.detectClassifyType()) {
              case TYPE_IMAGE: {
                const info = await this.imageMagickService.identify(
                  this.as.getSourcePath()
        Severity: Minor
        Found in src/services/fs/contents/ContentsService.js - About 1 hr to fix

          Function detect has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
          Open

            async detect(
              fileInfo: FileInfo,
              storedFileInfoByHash: ?HashRow,
              storedFileInfoByPHashs: HashRow[],
              storedFileInfoByNames: HashRow[] = []
          Severity: Minor
          Found in src/services/judgment/JudgmentService.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

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

            createCanvasAndContext: (w: number, h: number) => Array<any> = (
              w: number,
              h: number
            ) => {
              const c = createCanvas(w, h);
          Severity: Major
          Found in src/services/deepLearning/NsfwJsService.js and 3 other locations - About 1 hr to fix
          src/services/deepLearning/CocoSsdService.js on lines 21..27
          src/services/deepLearning/bodyPix/BodyPixService.js on lines 105..111
          src/services/deepLearning/poseNet/PoseNetService.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 69.

          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

            createCanvasAndContext: (w: number, h: number) => Array<any> = (
              w: number,
              h: number
            ) => {
              const c = createCanvas(w, h);
          Severity: Major
          Found in src/services/deepLearning/poseNet/PoseNetService.js and 3 other locations - About 1 hr to fix
          src/services/deepLearning/CocoSsdService.js on lines 21..27
          src/services/deepLearning/NsfwJsService.js on lines 51..57
          src/services/deepLearning/bodyPix/BodyPixService.js on lines 105..111

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

          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

            createCanvasAndContext: (w: number, h: number) => Array<any> = (
              w: number,
              h: number
            ) => {
              const c = createCanvas(w, h);
          Severity: Major
          Found in src/services/deepLearning/bodyPix/BodyPixService.js and 3 other locations - About 1 hr to fix
          src/services/deepLearning/CocoSsdService.js on lines 21..27
          src/services/deepLearning/NsfwJsService.js on lines 51..57
          src/services/deepLearning/poseNet/PoseNetService.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 69.

          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