Showing 4 of 22 total issues
Function choose
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
choose(ctx: AutoTalkRequestContext<State>): AutoTalk<State> {
const targetWeight = Math.random() * this.childrenWeightSum(ctx);
let weight = 0;
for (const talk of this.talks) {
const talkWeight = talk instanceof AutoTalks ? talk.weight(ctx) : 1;
- 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 saveLoadMiddleware
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
function saveLoadMiddleware<SaveData>(
filePath: string
): shiorack.ShioriMiddlewareWithState<
DefaultState,
saveLoadMiddleware.SaveDataState<SaveData>
- 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 allTags
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
get allTags() {
const set = new Set(this.tags || []);
for (const talk of this.talks) {
if (talk instanceof AutoTalks) {
for (const tag of talk.allTags) set.add(tag);
- 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 autoTalkMiddleware
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
) => ShioriMiddlewareWithState<State, AutoTalksState<State>> = <State>(
options: autoTalkMiddleware.Options<State>
) => ({
request: async function autoTalkRequestMiddleware(ctx, next) {
const id = ctx.request.headers.ID as string;
- 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"