Showing 15 of 25 total issues
Function generateFieldWithHookFunc
has 81 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const generateFieldWithHookFunc = (
build: GraphileBuild,
innerTable: PgClass,
joinCallback: (qb1: QueryBuilder, qb2: QueryBuilder) => void,
isUnique: boolean = true,
Function addBackwardPolyAssociation
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const addBackwardPolyAssociation = (builder: SchemaBuilder, option: Options) => {
// const { pgSimpleCollections } = option;
// const hasConnections = pgSimpleCollections !== 'only';
builder.hook('GraphQLObjectType:fields', (fields, build, context) => {
Function backwardRelationFields
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
.reduce((acc, currentPoly) => {
const foreignTable = currentPoly.from;
if (!foreignTable || omit(foreignTable, 'read')) {
return acc;
}
Function addForwardPolyAssociation
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const addForwardPolyAssociation = (builder: SchemaBuilder, option: Options) => {
builder.hook('inflection', inflection => ({
...inflection,
forwardRelationByPolymorphic(table: PgClass, polymorphicName: string) {
return this.camelCase(`${this.singularize(table.name)}-as-${polymorphicName}`);
Function addForwardPolyRelationFilter
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const addForwardPolyRelationFilter = (builder: SchemaBuilder) => {
builder.hook('GraphQLInputObjectType:fields', (fields, build, context) => {
const {
extend,
inflection,
Function columnToPolyConstraint
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const columnToPolyConstraint = (build: GraphileBuild, attr: PgAttribute) => {
const {
name,
tags: { polymorphicTo = [], isPolymorphic },
} = attr;
Function backwardPolyAssociation
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
.reduce((memo, currentPoly) => {
// const { name } = currentPoly;
const foreignTable = currentPoly.from;
if (omit(foreignTable, 'read')) {
return memo;
Function addBackwardPolyAssociation
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
export const addBackwardPolyAssociation = (builder: SchemaBuilder, option: Options) => {
// const { pgSimpleCollections } = option;
// const hasConnections = pgSimpleCollections !== 'only';
builder.hook('GraphQLObjectType:fields', (fields, build, context) => {
- Read upRead up
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 pgQuery
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
pgQuery: (queryBuilder: QueryBuilder) => {
queryBuilder.select(() => {
const resolveData = getDataFromParsedResolveInfoFragment(
parsedResolveInfoFragment,
returnType,
Function forwardPolyRelationSpec
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
.reduce((memo, currentPoly) => {
const { name } = currentPoly;
const fieldsPerPolymorphicConstraint = currentPoly.to.reduce((acc, polyC) => {
const { pgClass: foreignTable,
name: mName,
Function addForwardPolyRelationFilter
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
export const addForwardPolyRelationFilter = (builder: SchemaBuilder) => {
builder.hook('GraphQLInputObjectType:fields', (fields, build, context) => {
const {
extend,
inflection,
- Read upRead up
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 columnToPolyConstraint
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
export const columnToPolyConstraint = (build: GraphileBuild, attr: PgAttribute) => {
const {
name,
tags: { polymorphicTo = [], isPolymorphic },
} = attr;
- Read upRead up
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
Avoid too many return
statements within this function. Open
return true;
Avoid too many return
statements within this function. Open
return sql.query`not exists(${sqlSelectWhereKeysMatch} and (${sqlFragment}))`;
Avoid too many return
statements within this function. Open
if (!c.keyAttributes.find(a => a.name === sourceTableType)) return false;