wkdhkr/dedupper

View on GitHub

Showing 119 of 303 total issues

Function collectBlockFiles has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  async collectBlockFiles(targetPath?: string): Promise<string[]> {
    const finalTargetPath = targetPath || this.fs.getSourcePath();
    const csvString = await fs.readFile(finalTargetPath);
    const results: FvcExport[] = await csv.parse(csvString, {
      delimiter: ";",
Severity: Minor
Found in src/services/fs/fvc/FastVideoCatalogerService.js - About 1 hr to fix

    Function fillDeepLearningTable has 30 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      fillDeepLearningTable(hitRows: HashRow[]): Promise<any> {
        return Promise.all(
          hitRows.map(async row => {
            const fileInfo = DbService.rowToInfo(row, TYPE_IMAGE);
            // TODO: version check?
    Severity: Minor
    Found in src/services/db/DbRepairService.js - About 1 hr to fix

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

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

        Function result has 30 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

              const result = await limitForPrepareFolder(async () => {
                const directories = folderPath.replace(/(^\/|\/$)/g, "").split("/");
                const fullPathDirectories = directories.map((d, i) => [
                  Array.from(Array(i + 1).keys()).map(j => directories[j]),
                  d
        Severity: Minor
        Found in src/services/amazon/ACDService.js - About 1 hr to fix

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

            async processAction(
              fileInfo: FileInfo,
              result: JudgeResult
            ): Promise<boolean> {
              const [action, , reason, results] = result;
          Severity: Minor
          Found in src/services/ProcessService.js - About 1 hr to fix

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

                    img.onload = async () => {
                      const [c, ctx] = this.createCanvasAndContext(img.width, img.height);
                      ctx.drawImage(img, 0, 0);
                      // classify
                      if (!net) {
            Severity: Minor
            Found in src/services/deepLearning/bodyPix/BodyPixService.js - About 1 hr to fix

              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

                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

                              Function process has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                              Open

                                async process(): Promise<boolean> {
                                  let result;
                                  if (await this.fileService.isDirectory()) {
                                    result = (await this.processDirectory()).every(Boolean);
                                  } else {
                              Severity: Minor
                              Found in src/services/ProcessService.js - About 55 mins 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 drawMask has 6 arguments (exceeds 4 allowed). Consider refactoring.
                              Open

                                canvas: any,
                                image: any,
                                maskImage: any,
                                maskOpacity: any,
                                maskBlurAmount: any,
                              Severity: Minor
                              Found in src/services/deepLearning/bodyPix/output_rendering_util.js - About 45 mins to fix

                                Function processRegularFile has a Cognitive Complexity of 8 (exceeds 5 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 45 mins 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 drawPoint has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                Open

                                  ctx: any,
                                  y: number,
                                  x: number,
                                  r: number,
                                  color: string
                                Severity: Minor
                                Found in src/services/deepLearning/bodyPix/demo_util.js - About 35 mins to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language