pixelass/phony

View on GitHub

Showing 6 of 808 total issues

Function buildRoot has 54 lines of code (exceeds 40 allowed). Consider refactoring.
Open

export function buildRoot(data: Database, plainData: Database, names: NameMap, config): Root {
    const {
        queryConfig: {
            internalFields: { created, updated }
        },
Severity: Major
Found in packages/graphql/src/utils/root.ts - About 1 hr to fix

    Function phonyql has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

    async function phonyql(filePath: string, flags: AnyFlags): Promise<boolean> {
        const cwd = process.cwd();
        const { port, database, schema } = flags;
        const { config = {}} = await explorer();
        const mergedConfig = merge(defaultConfig, config, { port, database, schema });
    Severity: Minor
    Found in packages/cli/src/phonyql.ts - 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 buildTypeDef has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    export function buildTypeDef(
        { all, required }: { all: Entry; required: Entry },
        name: string,
        typeDefs: string[]
    ): string[] {
    Severity: Minor
    Found in packages/graphql/src/utils/schema.ts - About 45 mins 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 buildFilterFields has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    export function buildFilterFields(fields: Entry, name: string, phonyInputs: string[] = []): string {
        const typeDef = buildTypeDefStr(
            "input",
            name,
            Object.entries(fields)
    Severity: Minor
    Found in packages/graphql/src/utils/filter.ts - About 45 mins 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 getType has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

    export function getType(value: any): string {
        if (isDate(value)) {
            return "date";
        }
        if (isNumber(value)) {
    Severity: Minor
    Found in packages/graphql/src/utils/type.ts - About 35 mins 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

    Avoid too many return statements within this function.
    Open

            return "object";
    Severity: Major
    Found in packages/graphql/src/utils/type.ts - About 30 mins to fix
      Severity
      Category
      Status
      Source
      Language