Showing 27 of 27 total issues
Function build_CFSM
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
private build_CFSM(): CharacteristicFiniteStateMachine {
const s0 = this.compute_s0();
const startState = new CFSMState(s0);
const cfsm = new CharacteristicFiniteStateMachine(startState);
const S = new Stack<ISet<LR0Configuration>>();
Function markLambda
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
private markLambda(): void {
let changes: boolean;
do {
changes = false;
- 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 deeply nested control flow statements. Open
for (let i = p.rhs.length - 1; i >= 0; --i) {
if ((p.rhs[i] as GrammarSymbol) !== GrammarSymbol.Lambda) {
// Push semantic actions, and any symbols except Lambda.
parseStack.push(p.rhs[i]);
}
Function fillParseTable
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private fillParseTable(): ReadonlyMap<string, IProduction> {
const parseTable = new Map<string, IProduction>();
for (const p of this.grammar.productions) {
const pValue = this.predict.get(p);
- 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 deeply nested control flow statements. Open
} else if (symbolX === tokenAsSymbol) {
// console.log(`Matched token/symbol ${X}`);
if (parse) {
this.grammar.pushTokenOntoSemanticStack(
Function fillPredict
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private fillPredict(): ReadonlyMap<IProduction, IImmutableSet<GrammarSymbol>> {
const predict = new Map<IProduction, IImmutableSet<GrammarSymbol>>();
for (const p of this.grammar.productions) {
let s = this.computeFirst(p.getRHSWithNoSemanticActions());
- 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 build_go_to_table
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private build_go_to_table(): void {
this.GoToTable.clear();
for (const S of this.machine.StateList) {
for (const X of S.Transitions.keys()) {
- 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"