Glavin001/graphql-sequelize-crud

View on GitHub

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

      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

        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

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

                                      fields: () => {
                                          // Attribute fields
                                          const defaultFields = attributeFields(model, {
                                              exclude: model.excludeFields ? model.excludeFields : [],
                                              globalId: true,
                          Severity: Minor
                          Found in src/getSchema.ts - About 1 hr to fix

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

                                  mutations: (models: Models, modelTypes: ModelTypes) => {
                                    return {
                                      createCustom: {
                                        type: new GraphQLObjectType({
                                          name: "Custom",
                            Severity: Minor
                            Found in demo/index.ts - About 1 hr to fix

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

                                          inputFields: () => {
                                              const fields = attributeFields(model, {
                                                  exclude: model.excludeFields ? model.excludeFields : [],
                                                  commentToDescription: true,
                                                  allowNull: true,
                              Severity: Minor
                              Found in src/OperationFactory.ts - About 1 hr to fix

                                Avoid too many return statements within this function.
                                Open

                                            return camelcase(`${type}_${getTableName(model)}`);
                                Severity: Major
                                Found in src/utils.ts - About 30 mins to fix

                                  Avoid too many return statements within this function.
                                  Open

                                              return camelcase(`delete_${getTableName(model)}`);
                                  Severity: Major
                                  Found in src/utils.ts - About 30 mins to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language