wkdhkr/dedupper

View on GitHub

Showing 303 of 303 total issues

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

  createCanvasAndContext: (w: number, h: number) => Array<any> = (
    w: number,
    h: number
  ) => {
    const c = createCanvas(w, h);
Severity: Major
Found in src/services/deepLearning/CocoSsdService.js and 3 other locations - About 1 hr to fix
src/services/deepLearning/NsfwJsService.js on lines 51..57
src/services/deepLearning/bodyPix/BodyPixService.js on lines 105..111
src/services/deepLearning/poseNet/PoseNetService.js on lines 25..31

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

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",
                ...Array.from({ length: this.config.tagDbLength }).map(
                  (n, i) => `t${i + 1}`
                )
Severity: Major
Found in src/services/db/TagDbService.js and 1 other location - About 1 hr to fix
src/services/db/TagDbService.js on lines 188..193

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

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",
                ...Array.from({ length: this.config.tagDbLength }).map(
                  (n, i) => `$t${i + 1}`
                )
Severity: Major
Found in src/services/db/TagDbService.js and 1 other location - About 1 hr to fix
src/services/db/TagDbService.js on lines 182..187

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

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

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

      uploadAcd: (row: HashRow, folderId: string) => Promise<null> = async (
        row: HashRow,
        folderId: string
      ) => {
        if (await this.fs.pathExists(row.to_path)) {
    Severity: Major
    Found in src/services/amazon/ACDSyncService.js and 1 other location - About 1 hr to fix
    src/services/amazon/ACDSyncService.js on lines 133..141

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

    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

      overrideAcd: (row: HashRow, fileId: string) => Promise<null> = async (
        row: HashRow,
        fileId: string
      ) => {
        if (await this.fs.pathExists(row.to_path)) {
    Severity: Major
    Found in src/services/amazon/ACDSyncService.js and 1 other location - About 1 hr to fix
    src/services/amazon/ACDSyncService.js on lines 123..131

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

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

      Function constructor has 39 lines of code (exceeds 25 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

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

          static markToCharLookup: { [FileNameMark]: string } = {
            [MARK_BLOCK]: FileNameMarkHelper.CHAR_BLOCK,
            [MARK_ERASE]: FileNameMarkHelper.CHAR_ERASE,
            [MARK_DEDUPE]: FileNameMarkHelper.CHAR_DEDUPE,
            [MARK_HOLD]: FileNameMarkHelper.CHAR_HOLD,
        Severity: Major
        Found in src/helpers/FileNameMarkHelper.js and 1 other location - About 1 hr to fix
        src/services/db/FacePPDbService.js on lines 610..618

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

        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

                  emotion: {
                    sadness: row.emotion_sadness,
                    neutral: row.emotion_neutral,
                    disgust: row.emotion_disgust,
                    anger: row.emotion_anger,
        Severity: Major
        Found in src/services/db/FacePPDbService.js and 1 other location - About 1 hr to fix
        src/helpers/FileNameMarkHelper.js on lines 46..54

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

        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 row = {
                    $hash,
                    $pHash,
                    $dHash,
                    $width,
        Severity: Major
        Found in src/services/db/DbService.js and 1 other location - About 1 hr to fix
        src/services/db/DbService.js on lines 484..498

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

        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 {
                    hash: $hash,
                    p_hash: $pHash,
                    d_hash: $dHash,
                    width: $width,
        Severity: Major
        Found in src/services/db/DbService.js and 1 other location - About 1 hr to fix
        src/services/db/DbService.js on lines 501..515

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

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

          constructor(config: Config, path: string, isParent: boolean = true) {
            let { dryrun } = config;
            if (EnvironmentHelper.isTest()) {
              maxListenersExceededWarning();
              dryrun = true;
        Severity: Minor
        Found in src/services/ProcessService.js - About 1 hr to fix

          Function toColoredPartMask has 38 lines of code (exceeds 25 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

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

            export default function(config: Config): any {
              LockHelper.pollPeriod = 5;
              const router = express.Router();
              const log = log4js.getLogger("sqliteUpdate");
              // const ds = new DbService(config);
            Severity: Minor
            Found in src/servers/routes/sqliteUpdateRoute.js - About 1 hr to fix

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

                        (err, rows: ProcessStateRow[]) => {
                          db.close();
                          if (!this.ss.handleEachError(db, err, reject)) {
                            return;
                          }
              Severity: Major
              Found in src/services/db/ProcessStateDbService.js and 1 other location - About 1 hr to fix
              src/services/db/NsfwJsDbService.js on lines 145..151

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

              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

                        (err, rows: NsfwJsHashRow[]) => {
                          db.close();
                          if (!this.ss.handleEachError(db, err, reject)) {
                            return;
                          }
              Severity: Major
              Found in src/services/db/NsfwJsDbService.js and 1 other location - About 1 hr to fix
              src/services/db/ProcessStateDbService.js on lines 84..90

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

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

                async requestDetectFaceApi(
                  buffer: Buffer,
                  retryCount: number = 0
                ): Promise<FacePPResult> {
                  const form = new FormData();
              Severity: Minor
              Found in src/services/deepLearning/facePP/FacePPService.js - About 1 hr to fix

                Function main has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                async function main() {
                  const userConfig = EnvironmentHelper.loadUserConfig();
                  const config = {
                    ...TestHelper.createDummyConfig(),
                    ...userConfig
                Severity: Minor
                Found in bin/faceapitest.js - About 1 hr to fix
                  Severity
                  Category
                  Status
                  Source
                  Language