iccicci/sedentary

View on GitHub

Showing 22 of 22 total issues

File local.ts has 688 lines of code (exceeds 500 allowed). Consider refactoring.
Open

import { DatabaseError, Pool } from "pg";

if(! process.env.SPG) throw "Missing SPG!";

export const connection = JSON.parse(process.env.SPG);
Severity: Major
Found in packages/sedentary-pg/test/local.ts - About 6 hrs to fix

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

      describe("Boolean", function() {
        helper(expected.types_boolean, async db => {
          db.model("test1", {
            a: db.Boolean,
            b: db.Boolean,
    Severity: Major
    Found in packages/sedentary/test/03data_types.test.ts and 2 other locations - About 3 hrs to fix
    packages/sedentary/test/03data_types.test.ts on lines 87..107
    packages/sedentary/test/03data_types.test.ts on lines 157..177

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

    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 3 locations. Consider refactoring.
    Open

      describe("Number", function() {
        helper(expected.types_number, async db => {
          db.model("test1", {
            a: db.Number,
            b: db.Number,
    Severity: Major
    Found in packages/sedentary/test/03data_types.test.ts and 2 other locations - About 3 hrs to fix
    packages/sedentary/test/03data_types.test.ts on lines 109..129
    packages/sedentary/test/03data_types.test.ts on lines 157..177

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

    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 3 locations. Consider refactoring.
    Open

      describe("None", function() {
        helper(expected.types_none, async db => {
          db.model("test1", {
            a: db.None,
            b: db.None,
    Severity: Major
    Found in packages/sedentary/test/03data_types.test.ts and 2 other locations - About 3 hrs to fix
    packages/sedentary/test/03data_types.test.ts on lines 87..107
    packages/sedentary/test/03data_types.test.ts on lines 109..129

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

    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

    PGDB has 23 functions (exceeds 20 allowed). Consider refactoring.
    Open

    export class PGDB extends DB<TransactionPG> {
      private _client: PoolClient = {} as PoolClient;
      private indexes: string[] = [];
      private oidLoad: Record<number, (ids: unknown[]) => Promise<EntryBase[]>> = {};
      private pool: Pool;
    Severity: Minor
    Found in packages/sedentary-pg/pgdb.ts - About 2 hrs to fix

      File local.ts has 512 lines of code (exceeds 500 allowed). Consider refactoring.
      Open

      import { promises } from "fs";
      
      const { unlink } = promises;
      
      export const connection = "test.json";
      Severity: Major
      Found in packages/sedentary/test/local.ts - About 2 hrs to fix

        Function xref has 7 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        def xref(typ, rawtext, text, lineno, inliner, options={}, content=[]):
        Severity: Major
        Found in docs/xref.py - About 50 mins to fix

          Avoid deeply nested control flow statements.
          Open

                      if(adsrc) dropDefault();
          Severity: Major
          Found in packages/sedentary-pg/pgdb.ts - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                      if(this.sync) field.default = defaultValue;
            Severity: Major
            Found in packages/sedentary/test/testDb.ts - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                      } else if(! adsrc || this.defaultNeq(adsrc, defaultValue)) await setDefault(attnotnull);
              Severity: Major
              Found in packages/sedentary-pg/pgdb.ts - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                            if(this.sync) await this._client.query(statement);
                Severity: Major
                Found in packages/sedentary-pg/pgdb.ts - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                            if(adsrc) dropDefault();
                  Severity: Major
                  Found in packages/sedentary-pg/pgdb.ts - About 45 mins to fix

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

                          helper(expected.types_date_time_changes, true, async db => {
                            db.model("test1", {
                              a: db.DateTime,
                              b: db.VarChar,
                              c: db.DateTime,
                    Severity: Minor
                    Found in packages/sedentary/test/03data_types.test.ts and 1 other location - About 40 mins to fix
                    packages/sedentary/test/03data_types.test.ts on lines 60..70

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

                    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

                        helper(expected.types_date_time, async db => {
                          db.model("test1", {
                            a: db.DateTime,
                            b: db.DateTime,
                            c: db.VarChar,
                    Severity: Minor
                    Found in packages/sedentary/test/03data_types.test.ts and 1 other location - About 40 mins to fix
                    packages/sedentary/test/03data_types.test.ts on lines 73..83

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

                    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

                    Avoid too many return statements within this function.
                    Open

                      for(const [i, [key, value]] of entriesA.entries()) if(key !== entriesB[i][0] || deepDiff(value, entriesB[i][1])) return true;
                    Severity: Major
                    Found in packages/sedentary/db.ts - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                        if(entriesA.length !== entriesB.length) return true;
                      Severity: Major
                      Found in packages/sedentary/db.ts - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                          return false;
                        Severity: Major
                        Found in packages/sedentary/db.ts - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                              return false;
                          Severity: Major
                          Found in packages/sedentary/db.ts - About 30 mins to fix

                            Avoid too many return statements within this function.
                            Open

                                if(! (b instanceof Array)) return true;
                            Severity: Major
                            Found in packages/sedentary/db.ts - About 30 mins to fix

                              Avoid too many return statements within this function.
                              Open

                                  for(const [i, value] of a.entries()) if(deepDiff(value, b[i])) return true;
                              Severity: Major
                              Found in packages/sedentary/db.ts - About 30 mins to fix
                                Severity
                                Category
                                Status
                                Source
                                Language