Showing 83 of 122 total issues
Function ImageGrid
has 197 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function ImageGrid(props) {
const [initPrimary, initImages] = initRecords(props);
const primary = useDragCollection(initPrimary);
const images = useDragCollection(initImages);
const [deleted, setDeleted] = useState([]);
Function Attachments
has 131 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function Attachments(props) {
const collection = useDragCollection(props.records);
const locales =
props.locales && props.locales.length > 0
? Object.keys(props.locales)
Function ImageUploader
has 128 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function ImageUploader(props: ImageUploaderProps) {
const [uploading, setUploading] = useState(false);
const [dragover, setDragover] = useState(false);
const [image, setImage] = useState(props.image);
const [src, setSrc] = useState(props.src);
File Node.tsx
has 353 lines of code (exceeds 250 allowed). Consider refactoring. Open
/*
Based on react-ui-tree
https://github.com/pqx/react-ui-tree
The MIT License (MIT)
Function Attachment
has 95 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function Attachment(props: AttachmentProps) {
const { attributeName, draggable, locales, locale } = props;
const { record } = draggable;
const { attachment, uploading } = record;
Function AttachmentEditor
has 92 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function AttachmentEditor(props: AttachmentEditorProps) {
const { attachment, locales } = props;
const [locale, setLocale] = useState(props.locale);
const [localizations, setLocalizations] = useState({
Function ImageUploader
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
export default function ImageUploader(props: ImageUploaderProps) {
const [uploading, setUploading] = useState(false);
const [dragover, setDragover] = useState(false);
const [image, setImage] = useState(props.image);
const [src, setSrc] = useState(props.src);
- 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 drag
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
drag(e: MouseEvent) {
if (this._start) {
const distance =
Math.abs(e.clientX - this._offsetX) +
Math.abs(e.clientY - this._offsetY);
- 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 GridImage
has 76 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function GridImage(props: GridImageProps) {
const { attributeName, draggable } = props;
const record = draggable.record;
const image = record.image;
Function drag
has 71 lines of code (exceeds 25 allowed). Consider refactoring. Open
drag(e: MouseEvent) {
if (this._start) {
const distance =
Math.abs(e.clientX - this._offsetX) +
Math.abs(e.clientY - this._offsetY);
Function Form
has 69 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function Form(props: FormProps) {
const { alternative, caption, image, locale, locales } = props;
const closeModal = useModalStore((state) => state.close);
const notice = useToastStore((state) => state.notice);
Function Toolbar
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function Toolbar(props: ToolbarProps) {
const { cropping } = props.cropState;
const aspectRatios = [
["Free", null],
Function useDragUploader
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function useDragUploader(
collections: DragCollection[],
onDragEnd: (dragState: DragState, files: File[]) => void
) {
const initialState: DragState = {
Function Attachment
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
export default function Attachment(props: AttachmentProps) {
const { attributeName, draggable, locales, locale } = props;
const { record } = draggable;
const { attachment, uploading } = record;
- 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 ImageCropper
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function ImageCropper(props: ImageCropperProps) {
const containerRef = useRef<HTMLDivElement>();
const [containerSize, setContainerSize] = useState();
const handleResize = () => {
File Draggable.tsx
has 265 lines of code (exceeds 250 allowed). Consider refactoring. Open
/*
Based on react-ui-tree
https://github.com/pqx/react-ui-tree
The MIT License (MIT)
Function FocalPoint
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function FocalPoint(props: FocalPointProps) {
const { width, height, onChange } = props;
const [dragging, setDragging] = useState(false);
const [position, setPosition] = useState<Position>({
Function actions
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
actions() {
const simple = [
{
name: "bold",
className: "bold",
File ImageGrid.jsx
has 255 lines of code (exceeds 250 allowed). Consider refactoring. Open
import React, { useRef, useState } from "react";
import PropTypes from "prop-types";
import FileUploadButton from "./FileUploadButton";
import DragElement from "./ImageGrid/DragElement";
import FilePlaceholder from "./ImageGrid/FilePlaceholder";
Function ImageGrid
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
export default function ImageGrid(props) {
const [initPrimary, initImages] = initRecords(props);
const primary = useDragCollection(initPrimary);
const images = useDragCollection(initImages);
const [deleted, setDeleted] = useState([]);
- 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"