Showing 9 of 40 total issues
Function _indexAndAnalyzeRules
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
private _indexAndAnalyzeRules(rawRules: RawRuleFrom<A, Conditions>[]) {
const indexedRules: IndexTree<A, Conditions> = new Map();
let typeOfSubjectType: string | undefined;
for (let i = rawRules.length - 1; i >= 0; i--) {
- 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 rulesToQuery
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
export function rulesToQuery<T extends AnyAbility, R = object>(
ability: T,
action: Parameters<T['rulesFor']>[0],
subjectType: ExtractSubjectType<Parameters<T['rulesFor']>[1]>,
convert: RuleToQueryConverter<T, R>
- 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 run
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
function run(name, args) {
if (!name || !(name in COMMANDS)) {
printHelp();
return;
}
Function _indexAndAnalyzeRules
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
private _indexAndAnalyzeRules(rawRules: RawRuleFrom<A, Conditions>[]) {
const indexedRules: IndexTree<A, Conditions> = new Map();
let typeOfSubjectType: string | undefined;
for (let i = rawRules.length - 1; i >= 0; i--) {
Function validateForCycles
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
function validateForCycles(aliasMap: AliasesMap, reservedAction: string) {
if (reservedAction in aliasMap) {
throw new Error(`Cannot use "${reservedAction}" as an alias because it's reserved action.`);
}
- 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 _addRule
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private _addRule(
action: string | string[],
subject?: SubjectType | SubjectType[],
conditionsOrFields?: string | string[] | Generics<T>['conditions'],
conditions?: Generics<T>['conditions'],
- 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 run
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
function run(name, args) {
if (!name || !(name in COMMANDS)) {
printHelp();
return;
}
- 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 mergePrioritized
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
export function mergePrioritized<T extends { priority: number }>(
array?: T[],
anotherArray?: T[]
): T[] {
if (!array || !array.length) {
- 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 permittedFieldsOf
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export function permittedFieldsOf<T extends AnyAbility>(
ability: T,
action: Parameters<T['can']>[0],
subject: Parameters<T['can']>[1],
options: PermittedFieldsOptions<T>
- 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"