Showing 53 of 97 total issues
File demo.ts
has 782 lines of code (exceeds 250 allowed). Consider refactoring. Open
import * as jsondiffpatch from 'jsondiffpatch/with-text-diffs';
import * as annotatedFormatter from 'jsondiffpatch/formatters/annotated';
import * as htmlFormatter from 'jsondiffpatch/formatters/html';
import 'jsondiffpatch/formatters/styles/html.css';
Function getExampleJson
has 147 lines of code (exceeds 25 allowed). Consider refactoring. Open
const getExampleJson = function () {
const data: Continent = {
name: 'South America',
summary:
'South America (Spanish: América del Sur, Sudamérica or \n' +
File html.ts
has 315 lines of code (exceeds 250 allowed). Consider refactoring. Open
import BaseFormatter from './base.js';
import type { BaseFormatterContext, DeltaType, NodeType } from './base.js';
import type {
AddedDelta,
ArrayDelta,
Function compare
has 70 lines of code (exceeds 25 allowed). Consider refactoring. Open
const compare = function () {
let left, right, error;
document.getElementById('results')!.style.display = 'none';
try {
left = areas.left.parse();
File annotated.ts
has 280 lines of code (exceeds 250 allowed). Consider refactoring. Open
import BaseFormatter from './base.js';
import type { BaseFormatterContext, DeltaType, NodeType } from './base.js';
import type {
AddedDelta,
ArrayDelta,
Function trivialMatchesDiffFilter
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
function trivialMatchesDiffFilter(context) {
if (context.left === context.right) {
context.setResult(undefined).exit();
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 leftright
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
leftright: function (descriptionArg, leftValueArg, rightValueArg) {
try {
const description = decodeURIComponent(descriptionArg || '');
const leftValue = decodeURIComponent(leftValueArg);
const rightValue = decodeURIComponent(rightValueArg);
Function objectsDiffFilter
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
export const objectsDiffFilter: Filter<DiffContext> = (context) => {
if (context.leftIsArray || context.leftType !== 'object') {
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 jsondiffpatchHtmlFormatterAdjustArrows
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
const adjustArrows = function jsondiffpatchHtmlFormatterAdjustArrows(
nodeArg?: Element,
) {
const node = nodeArg || document;
const getElementText = ({ textContent, innerText }: HTMLDivElement) =>
Function compare
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
const compare = function () {
let left, right, error;
document.getElementById('results')!.style.display = 'none';
try {
left = areas.left.parse();
- 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 data
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
data: function (dataArg) {
const data = dataArg || {};
dom.text(document.getElementById('description')!, data.description || '');
if (data.url && trim(data.url).substring(0, 10) !== 'javascript') {
document.getElementById('external-link')!.setAttribute('href', data.url);
- 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 showUnchanged
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const showUnchanged = (
show?: boolean,
node?: Element | null,
delay?: number,
) => {
Function trivialMatchesDiffFilter
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
function trivialMatchesDiffFilter(context) {
if (context.left === context.right) {
context.setResult(undefined).exit();
return;
}
Function gist
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
gist: function (id) {
dom.getJson('https://api.github.com/gists/' + id, function (error, data) {
interface GistError {
message?: string;
}
Function getDiffMatchPatch
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
function getDiffMatchPatch(options: Options | undefined, required?: boolean) {
if (!cachedDiffPatch) {
let instance: dmp;
if (options?.textDiff?.diffMatchPatch) {
instance = new options.textDiff.diffMatchPatch();
- 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 data
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
data: function (dataArg) {
const data = dataArg || {};
dom.text(document.getElementById('description')!, data.description || '');
if (data.url && trim(data.url).substring(0, 10) !== 'javascript') {
document.getElementById('external-link')!.setAttribute('href', data.url);
Function constructor
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
constructor(options?: Options) {
this.processor = new Processor(options);
this.processor.pipe(
new Pipe<DiffContext>('diff')
.append(
Function getDiffMatchPatch
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
function getDiffMatchPatch(options: Options | undefined, required?: boolean) {
if (!cachedDiffPatch) {
let instance: dmp;
if (options?.textDiff?.diffMatchPatch) {
instance = new options.textDiff.diffMatchPatch();
Function textDeltaReverse
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
const textDeltaReverse = function (delta: string) {
let i;
let l;
let line;
let lineTmp;
Function process
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
process<TContext extends Context<any>>(
input: TContext,
pipe?: Pipe<TContext>,
): TContext['result'] | undefined {
let context = input;
- 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"