wkdhkr/dedupper

View on GitHub
src/services/judgment/PHashLogic.js

Summary

Maintainability
C
1 day
Test Coverage

File PHashLogic.js has 291 lines of code (exceeds 250 allowed). Consider refactoring.
Open

// @flow
import typeof { Logger } from "log4js";

import AttributeService from "../fs/AttributeService";
import DbService from "../db/DbService";
Severity: Minor
Found in src/services/judgment/PHashLogic.js - About 3 hrs to fix

    Function factors has 74 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          storedFileInfos.map(async info => {
            let isSameDir = false;
            let isAccessible = false;
            if (this.as.isSameDir(info.from_path)) {
              isSameDir = true;
    Severity: Major
    Found in src/services/judgment/PHashLogic.js - About 2 hrs to fix

      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

        Avoid too many return statements within this function.
        Open

            return [this.al.fixAction(isMayBe, action), hitRow, reason];
        Severity: Major
        Found in src/services/judgment/PHashLogic.js - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                return this.fixPHashHitResult(
                  [TYPE_REPLACE, factor.info, TYPE_P_HASH_MATCH],
                  factor.isMayBe,
                  factor.isWillKeep,
                  factor.isKeeping
          Severity: Major
          Found in src/services/judgment/PHashLogic.js - About 30 mins to fix

            There are no issues that match your filters.

            Category
            Status