wkdhkr/dedupper

View on GitHub

Showing 119 of 303 total issues

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

    export default function(config: Config): any {
      const streamFlag = false;
      const router = express.Router();
      const log = log4js.getLogger("sqliteAll");
      const ds = new DbService(config);
    Severity: Major
    Found in src/servers/routes/imageDownloadRoute.js - About 2 hrs to fix

      Function detect has 68 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        async detect(
          fileInfo: FileInfo,
          storedFileInfoByHash: ?HashRow,
          storedFileInfoByPHashs: HashRow[],
          storedFileInfoByNames: HashRow[] = []
      Severity: Major
      Found in src/services/judgment/JudgmentService.js - About 2 hrs to fix

        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

          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

                    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

                    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

                      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

                        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

                            Function processRegularFile has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                              async processRegularFile(preferFileInfo?: FileInfo): Promise<boolean> {
                                const fileInfo =
                                  preferFileInfo || (await this.fileService.collectFileInfo());
                                try {
                                  await this.lockForRead(fileInfo);
                            Severity: Minor
                            Found in src/services/ProcessService.js - About 1 hr to fix

                              Function constructor has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                              Open

                                constructor() {
                                  this.cli = new Cli();
                              
                                  const userConfig = EnvironmentHelper.loadUserConfig();
                              
                              
                              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 logResult has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                logResult(
                                  { from_path: fromPath, size, width, height, p_hash: pHash }: FileInfo,
                                  result: JudgeResultSimple | JudgeResult
                                ): JudgeResult {
                                  let message = null;
                              Severity: Minor
                              Found in src/services/judgment/ResultLogic.js - About 1 hr to fix
                                Severity
                                Category
                                Status
                                Source
                                Language