src/plugins/run/code.ts
Function smdCode
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const smdCode: unified.Attacher = function () {
return function transform(root) {
let sequentialCodeBlocks: MDAST.Code[] = [];
let lastIndex = -1;
let lastParent: MDAST.Parent | undefined;
Function transform
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
return function transform(root) {
let sequentialCodeBlocks: MDAST.Code[] = [];
let lastIndex = -1;
let lastParent: MDAST.Parent | undefined;
Function parseMeta
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
function parseMeta(metastring?: string | null) {
const props: Record<string, boolean | string> = {};
if (!metastring) return props;
- 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 handleLegacyAnnotations
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
function handleLegacyAnnotations(annotations: MDAST.Code['annotations']) {
if (!annotations) return;
if (annotations.hasOwnProperty('type')) {
// @ts-expect-error type is no longer part of the typings, it is deprecated
- 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"