Showing 23 of 25 total issues
File lit-grid-layout.ts
has 300 lines of code (exceeds 250 allowed). Consider refactoring. Open
import deepClone from "deep-clone-simple";
import {
css,
CSSResult,
customElement,
Consider simplifying this complex logical expression. Open
if (
changedProps.has("parentWidth") ||
changedProps.has("margin") ||
changedProps.has("columns") ||
changedProps.has("containerPadding") ||
File lit-grid-item.ts
has 271 lines of code (exceeds 250 allowed). Consider refactoring. Open
import {
css,
CSSResult,
customElement,
html,
Function updated
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected updated(changedProps: PropertyValues): void {
// Set up all the calculations that are needed in the drag/resize events
// No need to calculate them all the time unless they change
if (
changedProps.has("parentWidth") ||
Function render
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected render(): TemplateResult {
if (!this._layout?.length || !this.itemRenderer) {
return html``;
}
Function render
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected render(): TemplateResult {
let gridItemHTML = html`<slot></slot>`;
if (this.isDraggable) {
gridItemHTML = html`
Function moveItem
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const moveItem = (
layout: Layout,
item: LayoutItem,
newPosX: number | undefined,
newPosY: number | undefined,
Function updated
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
protected updated(changedProps: PropertyValues): void {
// Set up all the calculations that are needed in the drag/resize events
// No need to calculate them all the time unless they change
if (
changedProps.has("parentWidth") ||
- 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 styles
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
static get styles(): CSSResult {
return css`
.grid-item-wrapper {
position: absolute;
transition: var(--grid-item-transition, all 200ms);
Function _dragStart
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
private _dragStart(ev: MouseEvent | TouchEvent): void {
if (
(ev.type.startsWith("mouse") && (ev as MouseEvent).button !== 0) ||
this.disabled
) {
Function firstUpdated
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected firstUpdated(): void {
this.addEventListener("mousedown", this._dragStart.bind(this), {
capture: true,
passive: false,
});
Function render
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected render(): TemplateResult {
return html`
<slot></slot>
${this.disabled
Function styles
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
static get styles(): CSSResult {
return css`
:host {
position: relative;
display: block;
Function moveItemAwayFromIntersect
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const moveItemAwayFromIntersect = (
layout: Layout,
intersectItem: LayoutItem,
itemToMove: LayoutItem,
cols: number,
Function moveItem
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
export const moveItem = (
layout: Layout,
item: LayoutItem,
newPosX: number | undefined,
newPosY: number | undefined,
- 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 _dragStart
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private _dragStart(ev: MouseEvent | TouchEvent): void {
if (
(ev.type.startsWith("mouse") && (ev as MouseEvent).button !== 0) ||
this.disabled
) {
- 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 fixLayoutBounds
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
export const fixLayoutBounds = (
layout: LayoutItem[],
cols: number
): LayoutItem[] => {
for (const item of layout) {
- 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 too many return
statements within this function. Open
return true;
Avoid too many return
statements within this function. Open
return false;
Function resolveIntersection
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export const resolveIntersection = (
layout: LayoutItem[],
item: LayoutItem,
newYPos: number
): void => {
- 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"