Showing 77 of 117 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: Props) {
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 363 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 drag
has a Cognitive Complexity of 27 (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 Attachment
has 95 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function Attachment(props: Props) {
const { attributeName, draggable, locales, locale } = props;
const { record } = draggable;
const { attachment, uploading } = record;
Function AttachmentEditor
has 93 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: Props) {
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 GridImage
has 76 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function GridImage(props: Props) {
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: Props) {
const { alternative, caption, image, locale, locales } = props;
const closeModal = useModalStore((state) => state.close);
const notice = useToastStore((state) => state.notice);
Function useDragUploader
has 65 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function useDragUploader(
collections: Drag.Collection[],
onDragEnd: (dragState: Drag.State, files: File[]) => void
) {
const initialState: Drag.State = {
Function Toolbar
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function Toolbar(props: Props) {
const { cropping } = props.cropState;
const aspectRatios: Array<[string, Ratio]> = [
["Free", null],
Function Attachment
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
export default function Attachment(props: Props) {
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: Props) {
const containerRef = useRef<HTMLDivElement>();
const [containerSize, setContainerSize] = useState<Crop.Size>();
const handleResize = () => {
Function FocalPoint
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function FocalPoint(props: Props) {
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 Draggable.tsx
has 261 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)
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"