regevbr/json-expression-eval

View on GitHub
src/lib/typeGuards.ts

Summary

Maintainability
C
7 hrs
Test Coverage
A
100%

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

export const isOrCompareOp = <C extends Context, F extends FunctionsTable<C, CustomEvaluatorFuncRunOptions>,
    Ignore, CustomEvaluatorFuncRunOptions>(expression: unknown):
    expression is OrCompareOp<C, F, Ignore, CustomEvaluatorFuncRunOptions> => {
    return Array.isArray((expression as OrCompareOp<C, F, Ignore, CustomEvaluatorFuncRunOptions>).or);
}
Severity: Major
Found in src/lib/typeGuards.ts and 1 other location - About 3 hrs to fix
src/lib/typeGuards.ts on lines 39..44

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

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

export const isAndCompareOp =
    <C extends Context, F extends FunctionsTable<C, CustomEvaluatorFuncRunOptions>,
        Ignore, CustomEvaluatorFuncRunOptions>(expression: unknown):
        expression is AndCompareOp<C, F, Ignore, CustomEvaluatorFuncRunOptions> => {
        return Array.isArray((expression as AndCompareOp<C, F, Ignore, CustomEvaluatorFuncRunOptions>).and);
Severity: Major
Found in src/lib/typeGuards.ts and 1 other location - About 3 hrs to fix
src/lib/typeGuards.ts on lines 46..50

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

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

export const isNinCompareOp = (op: ExtendedCompareOp<any, any, any>)
    : op is NinCompareOp<any, any, any> => {
    return Array.isArray((op as NinCompareOp<any, any, any>).nin);
}
Severity: Major
Found in src/lib/typeGuards.ts and 1 other location - About 1 hr to fix
src/lib/typeGuards.ts on lines 103..106

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

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

export const isInqCompareOp = (op: ExtendedCompareOp<any, any, any>)
    : op is InqCompareOp<any, any, any> => {
    return Array.isArray((op as InqCompareOp<any, any, any>).inq);
}
Severity: Major
Found in src/lib/typeGuards.ts and 1 other location - About 1 hr to fix
src/lib/typeGuards.ts on lines 108..111

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

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

export const isNotEqualCompareOp = (op: ExtendedCompareOp<any, any, any>)
    : op is NotEqualCompareOp<any, any, any> => {
    return (op as NotEqualCompareOp<any, any, any>).neq !== undefined;
}
Severity: Major
Found in src/lib/typeGuards.ts and 1 other location - About 1 hr to fix
src/lib/typeGuards.ts on lines 93..96

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

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

export const isEqualCompareOp = (op: ExtendedCompareOp<any, any, any>)
    : op is EqualCompareOp<any, any, any> => {
    return (op as EqualCompareOp<any, any, any>).eq !== undefined;
}
Severity: Major
Found in src/lib/typeGuards.ts and 1 other location - About 1 hr to fix
src/lib/typeGuards.ts on lines 98..101

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

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 6 locations. Consider refactoring.
Invalid

export const isGtCompareOp = (op: ExtendedCompareOp<any, any, any>)
    : op is GtCompareOp<any, any> => {
    return (op as GtCompareOp<any, any>).gt !== undefined;
}
Severity: Major
Found in src/lib/typeGuards.ts and 5 other locations - About 1 hr to fix
src/lib/typeGuards.ts on lines 68..71
src/lib/typeGuards.ts on lines 73..76
src/lib/typeGuards.ts on lines 78..81
src/lib/typeGuards.ts on lines 83..86
src/lib/typeGuards.ts on lines 88..91

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

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 6 locations. Consider refactoring.
Invalid

export const isGteCompareOp = (op: ExtendedCompareOp<any, any, any>)
    : op is GteCompareOp<any, any> => {
    return (op as GteCompareOp<any, any>).gte !== undefined;
}
Severity: Major
Found in src/lib/typeGuards.ts and 5 other locations - About 1 hr to fix
src/lib/typeGuards.ts on lines 63..66
src/lib/typeGuards.ts on lines 73..76
src/lib/typeGuards.ts on lines 78..81
src/lib/typeGuards.ts on lines 83..86
src/lib/typeGuards.ts on lines 88..91

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

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 6 locations. Consider refactoring.
Invalid

export const isLtCompareOp = (op: ExtendedCompareOp<any, any, any>)
    : op is LtCompareOp<any, any> => {
    return (op as LtCompareOp<any, any>).lt !== undefined;
}
Severity: Major
Found in src/lib/typeGuards.ts and 5 other locations - About 1 hr to fix
src/lib/typeGuards.ts on lines 63..66
src/lib/typeGuards.ts on lines 68..71
src/lib/typeGuards.ts on lines 73..76
src/lib/typeGuards.ts on lines 83..86
src/lib/typeGuards.ts on lines 88..91

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

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 6 locations. Consider refactoring.
Invalid

export const isRegexiCompareOp = (op: ExtendedCompareOp<any, any, any>)
    : op is RegexiCompareOp<any, any> => {
    return (op as RegexiCompareOp<any, any>).regexpi !== undefined;
}
Severity: Major
Found in src/lib/typeGuards.ts and 5 other locations - About 1 hr to fix
src/lib/typeGuards.ts on lines 63..66
src/lib/typeGuards.ts on lines 68..71
src/lib/typeGuards.ts on lines 73..76
src/lib/typeGuards.ts on lines 78..81
src/lib/typeGuards.ts on lines 83..86

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

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 6 locations. Consider refactoring.
Invalid

export const isRegexCompareOp = (op: ExtendedCompareOp<any, any, any>)
    : op is RegexCompareOp<any, any> => {
    return (op as RegexCompareOp<any, any>).regexp !== undefined;
}
Severity: Major
Found in src/lib/typeGuards.ts and 5 other locations - About 1 hr to fix
src/lib/typeGuards.ts on lines 63..66
src/lib/typeGuards.ts on lines 68..71
src/lib/typeGuards.ts on lines 73..76
src/lib/typeGuards.ts on lines 78..81
src/lib/typeGuards.ts on lines 88..91

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

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 6 locations. Consider refactoring.
Invalid

export const isLteCompareOp = (op: ExtendedCompareOp<any, any, any>)
    : op is LteCompareOp<any, any> => {
    return (op as LteCompareOp<any, any>).lte !== undefined;
}
Severity: Major
Found in src/lib/typeGuards.ts and 5 other locations - About 1 hr to fix
src/lib/typeGuards.ts on lines 63..66
src/lib/typeGuards.ts on lines 68..71
src/lib/typeGuards.ts on lines 78..81
src/lib/typeGuards.ts on lines 83..86
src/lib/typeGuards.ts on lines 88..91

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

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

There are no issues that match your filters.

Category
Status