Showing 77 of 115 total issues
Function render
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
return (
<div className="date-range-select">
<input
type="hidden"
Function cropReducer
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
function cropReducer(state: CropState, action: CropAction): CropState {
const {
crop_start_x,
crop_start_y,
crop_width,
Function ImageEditor
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function ImageEditor(props: ImageEditorProps) {
const [cropState, dispatch, croppedImage] = useCrop(props.image);
const [locale, setLocale] = useState(props.locale);
const [localizations, setLocalizations] = useState({
caption: props.image.caption || {},
Function actions
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
actions() {
const statusLabel = this.node().status != 2 ? "Publish" : "Hide";
const statusIcon = this.node().status != 2 ? "check" : "ban";
if (this.node().editing) {
Function Image
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function Image(props: ImageProps) {
const imageSize = () => {
const { image, cropping, crop_width, crop_height } = props.cropState;
if (cropping) {
return { width: image.real_width, height: image.real_height };
Function render
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const addChild = (id: TreeId, attributes: Attributes) => {
const tree = this.state.tree;
const index = tree.append(attributes, id);
this.reorderChildren(id);
Function EditableImage
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function EditableImage(props: EditableImageProps) {
const [image, setImage] = useState(props.image);
const [src, setSrc] = useState(props.src);
const openModal = useModalStore((state) => state.open);
Function FocalPoint
has a Cognitive Complexity of 14 (exceeds 5 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>({
- 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 TagEditor
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function TagEditor(props: TagEditorProps) {
const [tags, setTags] = useState(props.tags);
const [enabled, setEnabled] = useState(props.enabled);
const tagList = [...tags, ...enabled].filter(onlyUnique);
Function updateNodesPosition
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
updateNodesPosition() {
let top = 1;
let left = 1;
const root = this.getIndex(1);
Function Toast
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function Toast(props: ToastProps) {
const [fadeout, setFadeout] = useState(false);
const { toasts, error, notice, next } = useToastStore((state) => state);
const timerRef = useRef<number | null>(null);
Function useDragUploader
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
export default function useDragUploader(
collections: DragCollection[],
onDragEnd: (dragState: DragState, files: File[]) => void
) {
const initialState: DragState = {
- 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 renderEditNode
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
renderEditNode() {
const { dir, locale } = this.props;
const handleNameChange = (event: ChangeEvent<HTMLInputElement>) => {
this.setState({ newName: event.target.value });
Function build
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
build(obj: N): TreeIndex<N> {
const indexes = this.indexes;
const startId = this.cnt;
const index = { id: startId, node: obj };
Function render
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
return (
<div className="page-dates field">
<input
type="hidden"
Function GridImage
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
export default function GridImage(props: GridImageProps) {
const { attributeName, draggable } = props;
const record = draggable.record;
const image = record.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 Modal
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function Modal() {
const component = useModalStore((state) => state.component);
const close = useModalStore((state) => state.close);
const handleClose = (evt: Event) => {
Function uploadImage
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
const uploadImage = (file: File) => {
const validTypes = [
"image/gif",
"image/jpeg",
"image/pjpeg",
Function renderDateSelect
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
renderDateSelect(key, date, handleChange) {
return (
<div className="date-select">
<select
value={date.getMonth()}
Function FileUploadButton
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function FileUploadButton(props: FileUploadButtonProps) {
const inputRef = useRef<HTMLInputElement>();
const handleChange = (evt: ChangeEvent<HTMLInputElement>) => {
const fileList = evt.target.files;