wkdhkr/dedupper

View on GitHub

Showing 303 of 303 total issues

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

  loadFaceExpressionModel: () => Promise<void> = async () => {
    if (DeepLearningHelper.isFaceApiModelLoaded(MODEL_FACE_EXPRESSION)) {
      return;
    }
    LockHelper.lockProcess();
Severity: Major
Found in src/services/deepLearning/faceApi/FaceApiService.js and 3 other locations - About 3 hrs to fix
src/services/deepLearning/faceApi/FaceApiService.js on lines 40..50
src/services/deepLearning/faceApi/FaceApiService.js on lines 64..72
src/services/deepLearning/faceApi/FaceApiService.js on lines 86..96

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

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

    if (isImageHashNeeded && !fileInfo.p_hash) {
      const pHash = await this.cs.calculatePHash();
      if (!pHash) {
        throw new Error(`cannot fill pHash = ${fileInfo.from_path}`);
      }
Severity: Major
Found in src/services/fs/FileService.js and 1 other location - About 3 hrs to fix
src/services/fs/FileService.js on lines 337..347

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

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

    if (isImageHashNeeded && !fileInfo.d_hash) {
      const dHash = await this.cs.calculateDHash();
      if (!dHash) {
        throw new Error(`cannot fill dHash path = ${fileInfo.from_path}`);
      }
Severity: Major
Found in src/services/fs/FileService.js and 1 other location - About 3 hrs to fix
src/services/fs/FileService.js on lines 326..336

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

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 checkedItems = await Promise.all(
        items.map(async item => {
          if (item.to_path) {
            item._isNotExists = !(await fs.pathExists(item.to_path));
            setTimeout(() => limit(() => updateDb(item, psds)), 1000);
Severity: Major
Found in src/servers/routes/sqliteAllRoute.js and 1 other location - About 3 hrs to fix
src/servers/routes/sqliteAllRoute.js on lines 141..149

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

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 checkedItems = await Promise.all(
        items.map(async item => {
          if (item.to_path) {
            item._isNotExists = !(await fs.pathExists(item.to_path));
            setTimeout(() => limit(() => updateDb(item, psds)), 1000);
Severity: Major
Found in src/servers/routes/sqliteAllRoute.js and 1 other location - About 3 hrs to fix
src/servers/routes/sqliteAllRoute.js on lines 119..127

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

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

  classifyTypeByExtension: (() => {
    const lookup = {};
    const assignFn = (ext, type) => {
      lookup[ext] = type;
    };
Severity: Major
Found in src/defaultConfig.js - About 3 hrs to fix

    Function queryByPHash has 75 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      queryByPHash({
        p_hash: pHash,
        d_hash: dHash,
        from_path: fromPath,
        type,
    Severity: Major
    Found in src/services/db/DbService.js - About 3 hrs to fix

      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

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

        // @flow
        import typeof { Logger } from "log4js";
        import { STATE_ACCEPTED, STATE_KEEPING } from "../../types/FileStates";
        import SQLiteService from "./SQLiteService";
        import { TYPE_IMAGE } from "../../types/ClassifyTypes";
        Severity: Minor
        Found in src/services/db/NsfwJsDbService.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

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

                    ((server: any).listen: any)(this.config.serverPort, host, () => {
                      this.log.info(
                        `Server running on http://${host}:${
                          server.address().port
                        } with pid ${process.pid} with wid ${worker.id}`
            Severity: Major
            Found in src/servers/index.js and 1 other location - About 2 hrs to fix
            src/servers/index.js on lines 107..117

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

            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

                    ((httpsServer: any).listen: any)(
                      this.config.serverHttpsPort,
                      host,
                      () => {
                        this.log.info(
            Severity: Major
            Found in src/servers/index.js and 1 other location - About 2 hrs to fix
            src/servers/index.js on lines 118..124

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

            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

                        (async (err, rows: HashRow[]) => {
                          if (err) {
                            reject(err);
                          } else {
                            await Promise.all(
            Severity: Major
            Found in src/services/db/DbFillService.js and 1 other location - About 2 hrs to fix
            src/services/amazon/ACDSyncService.js on lines 295..304

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

            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

                        (async (err, rows: ProcessStateRow[]) => {
                          if (err) {
                            reject(err);
                          } else {
                            await Promise.all(
            Severity: Major
            Found in src/services/amazon/ACDSyncService.js and 1 other location - About 2 hrs to fix
            src/services/db/DbFillService.js on lines 217..226

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

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

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

                  createRowBind: (row: any) => { ... } = (row: Object) => {
                    const newRow = {};
                
                    Object.keys(row).forEach(key => {
                      newRow[`$${key}`] = row[key] !== undefined ? row[key] : null;
                Severity: Major
                Found in src/services/db/TagDbService.js and 1 other location - About 2 hrs to fix
                src/services/db/ProcessStateDbService.js on lines 136..144

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

                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

                  createRowBind: (row: ProcessStateRow) => { ... } = (row: ProcessStateRow) => {
                    const newRow = {};
                
                    Object.keys(row).forEach(key => {
                      newRow[`$${key}`] = row[key] !== undefined ? row[key] : null;
                Severity: Major
                Found in src/services/db/ProcessStateDbService.js and 1 other location - About 2 hrs to fix
                src/services/db/TagDbService.js on lines 132..140

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

                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

                export function drawSegment([ay, ax], [by, bx], color, scale, ctx) {
                  ctx.beginPath();
                  ctx.moveTo(ax * scale, ay * scale);
                  ctx.lineTo(bx * scale, by * scale);
                  ctx.lineWidth = lineWidth;
                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 45..58

                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: any, ctx: any) {
                  const boundingBox = posenet.getBoundingBox(keypoints);
                
                  ctx.rect(
                    boundingBox.minX,
                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 145..157

                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

                Severity
                Category
                Status
                Source
                Language