wkdhkr/dedupper

View on GitHub

Showing 303 of 303 total issues

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

export function drawSegment(
  [ay, ax]: [number, number],
  [by, bx]: [number, number],
  color: string,
  scale: number,
Severity: Major
Found in src/services/deepLearning/bodyPix/demo_util.js and 1 other location - About 2 hrs to fix
src/services/deepLearning/poseNet/demo_util.js on lines 95..102

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

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 drawBoundingBox(keypoints, ctx) {
  const boundingBox = posenet.getBoundingBox(keypoints);

  ctx.rect(
    boundingBox.minX,
Severity: Major
Found in src/services/deepLearning/poseNet/demo_util.js and 1 other location - About 2 hrs to fix
src/services/deepLearning/bodyPix/demo_util.js on lines 117..129

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

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

File ACDSyncService.js has 272 lines of code (exceeds 250 allowed). Consider refactoring.
Open

// @flow
import path from "path";
import pLimit from "p-limit";
import typeof { Logger } from "log4js";
import TagDbService from "../db/TagDbService";
Severity: Minor
Found in src/services/amazon/ACDSyncService.js - About 2 hrs to fix

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

      prepareTable: (db: Database<NsfwJsHashRow>) => Promise<void> = async (
        db: Database<NsfwJsHashRow>
      ) =>
        this.ss.prepareTable(
          db,
    Severity: Major
    Found in src/services/db/NsfwJsDbService.js and 1 other location - About 2 hrs to fix
    src/services/db/FacePPDbService.js on lines 50..57

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

    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

      prepareTable: (db: Database<FacePPRow>) => Promise<void> = async (
        db: Database<FacePPRow>
      ) =>
        this.ss.prepareTable(
          db,
    Severity: Major
    Found in src/services/db/FacePPDbService.js and 1 other location - About 2 hrs to fix
    src/services/db/NsfwJsDbService.js on lines 39..46

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

    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 infoToRow: FileInfo => HashRow = ({
        hash,
        p_hash, // eslint-disable-line camelcase
        d_hash, // eslint-disable-line camelcase
        width,
    Severity: Major
    Found in src/services/db/DbService.js and 1 other location - About 2 hrs to fix
    src/services/db/DbService.js on lines 366..380

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

    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

        {
          hash,
          p_hash, // eslint-disable-line camelcase
          d_hash, // eslint-disable-line camelcase
          width,
    Severity: Major
    Found in src/services/db/DbService.js and 1 other location - About 2 hrs to fix
    src/services/db/DbService.js on lines 335..349

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

    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

    File FaceSpinnerService.js has 264 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    // @flow
    // import cv from "opencv4nodejs-prebuilt";
    import pLimit from "p-limit";
    import FormData from "form-data";
    import axios from "axios";
    Severity: Minor
    Found in src/services/deepLearning/FaceSpinnerService.js - About 2 hrs to fix

      File ProcessStateDbService.js has 263 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      // @flow
      import typeof { Logger } from "log4js";
      import type { Database } from "./SQLiteService";
      import DeepLearningHelper from "../../helpers/DeepLearningHelper";
      import DbHelper from "../../helpers/DbHelper";
      Severity: Minor
      Found in src/services/db/ProcessStateDbService.js - About 2 hrs to fix

        Function handleFileNameMark has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
        Open

          async handleFileNameMark(
            fileInfo: FileInfo,
            storedFileInfoByHash: ?HashRow,
            storedFileInfoByPHashs: HashRow[],
            storedFileInfoByNames: HashRow[],
        Severity: Minor
        Found in src/services/judgment/PathLogic.js - About 2 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

        Function parseBody has 55 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        const parseBody = (body: any, table: string): any => {
          const stringColumns = ["meta", "trim"];
          const numberColumns = [
            "missing",
            "orientation",
        Severity: Major
        Found in src/servers/routes/sqliteUpdateRoute.js - About 2 hrs to fix

          Function default has 55 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export default function(config: Config): any {
            const router = express.Router();
            // const log = log4js.getLogger("sqliteChannelCrud");
            const cds = new ChannelDbService(config);
            cds.init();
          Severity: Major
          Found in src/servers/routes/sqliteChannelCrudRoute.js - About 2 hrs to fix

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

            export default class FileService {
              log: typeof Logger;
            
              config: Config;
            
            
            Severity: Minor
            Found in src/services/fs/FileService.js - About 2 hrs to fix

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

                              eyestatus: {
                                left_eye_status: {
                                  normal_glass_eye_open: 4.976,
                                  no_glass_eye_close: 0,
                                  occlusion: 0.011,
              Severity: Major
              Found in __tests__/services/db/FacePPDbService.test.js and 1 other location - About 2 hrs to fix
              __tests__/services/db/FacePPDbService.test.js on lines 921..938

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

              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

                            eyestatus: {
                              left_eye_status: {
                                dark_glasses: 0.092,
                                no_glass_eye_close: 0.002,
                                no_glass_eye_open: 94.919,
              Severity: Major
              Found in __tests__/services/db/FacePPDbService.test.js and 1 other location - About 2 hrs to fix
              __tests__/services/db/FacePPDbService.test.js on lines 417..434

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

              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 values = [
                              "$hash",
                              "$image_id",
                              "$face_token",
                              "$face_num",
              Severity: Major
              Found in src/services/db/FacePPDbService.js and 1 other location - About 2 hrs to fix
              src/services/db/FacePPDbService.js on lines 748..810

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

              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 columns = [
                              "hash",
                              "image_id",
                              "face_token",
                              "face_num",
              Severity: Major
              Found in src/services/db/FacePPDbService.js and 1 other location - About 2 hrs to fix
              src/services/db/FacePPDbService.js on lines 811..873

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

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

                async rename(
                  from: string,
                  to?: string,
                  isRetry: boolean = false,
                  isCopy: boolean = false
              Severity: Minor
              Found in src/services/fs/FileService.js - About 2 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

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

                          if (guiState.estimate === "segmentation") {
                            const segmentation = await this.estimateSegmentation(
                              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 448..459

              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

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

              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

              Severity
              Category
              Status
              Source
              Language