Function utf8Length
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Wontfix
export const utf8Length = (str: string) => {
const n = str.length;
let len = 0;
for (let i = 0; i < n; ++i) {
let u = str.charCodeAt(i);
- Read upRead up
- Create a ticketCreate a ticket
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 utf8Encode
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
export const utf8Encode = (src: string, capacity?: number) => {
const n = src.length;
const buf = new Uint8Array(capacity || n << 2);
let pos = 0;
let c: number;
- Read upRead up
- Create a ticketCreate a ticket
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 utf8Decode
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
export const utf8Decode = (buf: Uint8Array, start: number, num: number) => {
const end = start + num;
let i = start;
let result = "";
let c: number;
- Read upRead up
- Create a ticketCreate a ticket
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"