Glavin001/graphql-sequelize-crud

View on GitHub

Showing 37 of 37 total issues

File OperationFactory.ts has 570 lines of code (exceeds 250 allowed). Consider refactoring.
Open

// tslint:disable-next-line:no-reference
/// <reference path="./@types/graphql-sequelize/index.d.ts" />

import {
    GraphQLObjectType,
Severity: Major
Found in src/OperationFactory.ts - About 1 day to fix

    Function getSchema has 212 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export function getSchema(sequelize: Sequelize) {
    
        const { nodeInterface, nodeField, nodeTypeMapper } = sequelizeNodeInterface(sequelize);
    
        const models: Models = sequelize.models as any;
    Severity: Major
    Found in src/getSchema.ts - About 1 day to fix

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

                      _.each(associationsToModel[getTableName(model)], (association) => {
                          const {
                              from,
                              type: atype,
                              key: field
      Severity: Major
      Found in src/OperationFactory.ts and 1 other location - About 7 hrs to fix
      src/OperationFactory.ts on lines 448..465

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

      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

                      _.each(associationsToModel[getTableName(model)], (association) => {
                          const {
                              from,
                              type: atype,
                              key: field
      Severity: Major
      Found in src/OperationFactory.ts and 1 other location - About 7 hrs to fix
      src/OperationFactory.ts on lines 301..318

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

      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

                      _.each(associationsFromModel[getTableName(model)], (association) => {
                          const {
                              to,
                              type: atype,
                              foreignKey,
      Severity: Major
      Found in src/OperationFactory.ts and 2 other locations - About 7 hrs to fix
      src/OperationFactory.ts on lines 134..154
      src/OperationFactory.ts on lines 319..339

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

      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

                      _.each(associationsFromModel[getTableName(model)], (association) => {
                          const {
                              to,
                              type: atype,
                              foreignKey,
      Severity: Major
      Found in src/OperationFactory.ts and 2 other locations - About 7 hrs to fix
      src/OperationFactory.ts on lines 134..154
      src/OperationFactory.ts on lines 466..486

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

      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

                      _.each(associationsFromModel[getTableName(model)], (association) => {
                          const {
                              to,
                              type: atype,
                              foreignKey,
      Severity: Major
      Found in src/OperationFactory.ts and 2 other locations - About 7 hrs to fix
      src/OperationFactory.ts on lines 319..339
      src/OperationFactory.ts on lines 466..486

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

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

          public updateRecords({
              mutations,
              model,
              modelType,
          }: {
      Severity: Major
      Found in src/OperationFactory.ts - About 4 hrs to fix

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

                        output[camelcase(`new_${getTableName(model)}`)] = {
                            type: modelType,
                            description: `The new ${getTableName(model)}, if successfully created.`,
                            // tslint:disable-next-line:max-func-args
                            resolve: (args: any, arg2: any, context: any, info: any) => {
        Severity: Major
        Found in src/OperationFactory.ts and 2 other locations - About 4 hrs to fix
        src/OperationFactory.ts on lines 288..298
        src/OperationFactory.ts on lines 435..445

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

        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

                        output[camelcase(`new_${getTableName(model)}`)] = {
                            type: modelType,
                            description: `The new ${getTableName(model)}, if successfully created.`,
                            // tslint:disable-next-line max-func-args
                            resolve: (args: any, arg2: any, context: any, info: any) => {
        Severity: Major
        Found in src/OperationFactory.ts and 2 other locations - About 4 hrs to fix
        src/OperationFactory.ts on lines 100..110
        src/OperationFactory.ts on lines 435..445

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

        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

                        output[camelcase(`new_${getTableName(model)}`)] = {
                            type: modelType,
                            description: `The new ${getTableName(model)}, if successfully created.`,
                            // tslint:disable-next-line max-func-args
                            resolve: (args: any, arg2: any, context: any, info: any) => {
        Severity: Major
        Found in src/OperationFactory.ts and 2 other locations - About 4 hrs to fix
        src/OperationFactory.ts on lines 100..110
        src/OperationFactory.ts on lines 288..298

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

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

            public updateRecord({
                mutations,
                model,
                modelType,
            }: {
        Severity: Major
        Found in src/OperationFactory.ts - About 4 hrs to fix

          Function modelTypes has 81 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              const modelTypes: ModelTypes = Object.keys(models).reduce((types: ModelTypes, key: string) => {
                  const model: Model = models[key];
                  const modelType = new GraphQLObjectType({
                      name: getTableName(model),
                      fields: () => {
          Severity: Major
          Found in src/getSchema.ts - About 3 hrs to fix

            Function createRecord has 74 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public createRecord({
                    mutations,
                    model,
                    modelType,
                }: {
            Severity: Major
            Found in src/OperationFactory.ts - About 2 hrs to fix

              Function outputFields has 64 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                          outputFields: () => {
                              const output: GraphQLFieldConfigMap<any, any> = {};
                              // New Record
                              output[camelcase(`new_${getTableName(model)}`)] = {
                                  type: modelType,
              Severity: Major
              Found in src/OperationFactory.ts - About 2 hrs to fix

                File getSchema.ts has 251 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                // tslint:disable-next-line:no-reference
                /// <reference path="./@types/graphql-sequelize/index.d.ts" />
                
                import {
                    GraphQLObjectType,
                Severity: Minor
                Found in src/getSchema.ts - About 2 hrs to fix

                  Function outputFields has 50 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                              outputFields: () => {
                                  const output: GraphQLFieldConfigMap<any, any> = {};
                                  // New Record
                                  output[camelcase(`new_${getTableName(model)}`)] = {
                                      type: modelType,
                  Severity: Minor
                  Found in src/OperationFactory.ts - About 2 hrs to fix

                    Function deleteRecords has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public deleteRecords({
                            mutations,
                            model,
                            modelType,
                        }: {
                    Severity: Minor
                    Found in src/OperationFactory.ts - About 1 hr to fix

                      Function outputFields has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                                  outputFields: () => {
                                      const output: GraphQLFieldConfigMap<any, any> = {};
                                      // New Record
                                      output[camelcase(`new_${getTableName(model)}`)] = {
                                          type: modelType,
                      Severity: Minor
                      Found in src/OperationFactory.ts - About 1 hr to fix

                        Function deleteRecord has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public deleteRecord({
                                mutations,
                                model,
                                modelType,
                            }: {
                        Severity: Minor
                        Found in src/OperationFactory.ts - About 1 hr to fix
                          Severity
                          Category
                          Status
                          Source
                          Language