Showing 65 of 130 total issues
Function Grid
has 189 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function Grid(props: Props) {
const { primary, images, deleted, setDeleted } = props.state;
const containerRef = useRef();
const error = useToastStore((state) => state.error);
Function PageTree
has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring. Open
export default function PageTree({ dir, locale, pages, permissions }: Props) {
const [state, dispatch] = usePageTree(pages, locale, dir, permissions);
const [dragging, setDragging] = useState(false);
const [dragState, setDragState] = useState<DragState | null>(null);
- 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 ImageUploader
has 132 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 [state, setState] = useState<State>({
image: props.image,
Function Node
has 127 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function Node(props: Props) {
const { state, dispatch } = usePageTreeContext();
const { id, dragging, onDragStart } = props;
const { dir, locale } = state;
const node = state.nodes[id];
Function PageForm
has 122 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function PageForm(props: Props) {
const [state, dispatch] = usePage({
locales: props.locales,
locale: props.locale,
page: props.page,
Function List
has 121 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function List(props: Props) {
const { collection, deleted, setDeleted } = props.state;
const locales = props.locales ? Object.keys(props.locales) : [props.locale];
const uploadAttachment = (file: File) => {
Function Attachment
has 98 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 ImageUploader
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
export default function ImageUploader(props: Props) {
const [uploading, setUploading] = useState(false);
const [dragover, setDragover] = useState(false);
const [state, setState] = useState<State>({
image: props.image,
- 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 AttachmentEditor
has 93 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function AttachmentEditor(props: Props) {
const { attachment, locales } = props;
const [locale, setLocale] = useState(props.locale);
const [localizations, setLocalizations] = useState({
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 Toolbar
has 74 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function Toolbar() {
const { state, dispatch } = useImageCropperContext();
const { cropping, image } = state;
const aspectRatios: Array<[string, Crop.Ratio]> = [
Function applyTabs
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
function applyTabs() {
const tabLinks: HTMLAnchorElement[] = Array.from(
document.querySelectorAll(".content-tabs li a")
);
const tabs: HTMLDivElement[] = Array.from(
- 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 65 lines of code (exceeds 25 allowed). Consider refactoring. Open
(e: MouseEvent) => {
if (!dragState) {
return;
} else if (!dragging) {
const distance =
Function DateRangeSelect
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function DateRangeSelect(props: Props) {
const { disabled, disableTime, objectName } = props;
const [uncontrolledStartsAt, setUncontrolledStartsAt] = useState(
parseDate(props.startsAt)
Function useDragUploader
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function useDragUploader<T>(
collections: Drag.Collection<T>[],
onDragEnd: (dragState: Drag.State<T>, files: File[]) => void
): [Drag.State<T>, StartDrag<T>, Listeners] {
const [dragState, setDragState] = useState<Drag.State<T>>({
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 applyTabs
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
function applyTabs() {
const tabLinks: HTMLAnchorElement[] = Array.from(
document.querySelectorAll(".content-tabs li a")
);
const tabs: HTMLDivElement[] = Array.from(
Function FocalPoint
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function FocalPoint(props: Props) {
const { width, height } = props;
const { state, dispatch } = useImageCropperContext();
const [dragging, setDragging] = useState(false);
Function DateTimeSelect
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function DateTimeSelect(props: Props) {
const { name, disabled, disableTime, onChange, value } = props;
const [timeString, setTimeString] = useState(timeToString(value));
Function Block
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function Block(props: Props) {
const { block, errors, onChange, lang, dir, value } = props;
const handleChange = (
evt: ChangeEvent<HTMLInputElement> | ChangeEvent<HTMLSelectElement>