Showing 77 of 117 total issues
Function FileUploadButton
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function FileUploadButton(props: Props) {
const inputRef = useRef<HTMLInputElement>();
const handleChange = (evt: ChangeEvent<HTMLInputElement>) => {
const fileList = evt.target.files;
Function childNodes
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
childNodes() {
const { index, tree, dragging, dir, locale } = this.props;
if (index.children && index.children.length && !index.node.collapsed) {
const childrenStyles: CSSProperties = {};
Function render
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const props = this.props;
const index = props.index;
const dragging = props.dragging;
const editing = this.node().editing;
Function render
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
let { value, rows } = this.state;
let { id, name } = this.props;
const clickHandler = (fn) => (evt) => {
Function collapseArrow
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
collapseArrow() {
const index = this.props.index;
// Don't collapse the root node
if (!index.parent) {
Function renderNode
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
renderNode() {
const index = this.props.index;
const node = index.node;
let pageName = <span className="name">{this.pageName()}</span>;
Function useCrop
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function useCrop(
image: ImageResource
): [Crop.State, (action: Crop.Action) => void, string] {
const initialState: Crop.State = {
aspect: null,
Function walk
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
const walk = (objs: Tree.Node[], parent: Tree.Index<N>) => {
const children: Tree.Id[] = [];
objs.forEach((obj: N) => {
const index: Tree.Index<N> = {
id: this.cnt,
Method meta_description
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def meta_description(*args)
if args.any?
@meta_description = args.first
else
description = @meta_description
- 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 getFiles
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
function getFiles(dt: DataTransfer): File[] {
const files: File[] = [];
if (dt.items) {
for (let i = 0; i < dt.items.length; i++) {
if (dt.items[i].kind == "file") {
- 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 applyCollapsed
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
applyCollapsed(tree: Tree<Page.Node>) {
const depth = (t: Tree, index: Tree.Index) => {
let depth = 0;
let pointer = t.getIndex(index.parent);
while (pointer) {
- 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 getFiles
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
function getFiles(dt: DataTransfer): File[] {
const files: File[] = [];
if (dt.items) {
for (let i = 0; i < dt.items.length; i++) {
if (dt.items[i].kind == "file") {
- 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 a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
export default function AttachmentEditor(props: AttachmentEditorProps) {
const { attachment, locales } = props;
const [locale, setLocale] = useState(props.locale);
const [localizations, setLocalizations] = 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"
Further reading
Function cropReducer
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
function cropReducer(state: Crop.State, action: Crop.Action): Crop.State {
const {
crop_start_x,
crop_start_y,
crop_width,
- 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 Attachments
has a Cognitive Complexity of 9 (exceeds 5 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)
- 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
Method labelled_check_box
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
attr, label = nil, options = {}, checked = "1", unchecked = "0"
Function render
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
render() {
const props = this.props;
const index = props.index;
const dragging = props.dragging;
const editing = this.node().editing;
- 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 Form
has a Cognitive Complexity of 7 (exceeds 5 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);
- 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 containsFiles
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
function containsFiles(evt: MouseEvent | TouchEvent) {
if ("dataTransfer" in evt) {
const dataTransfer = evt.dataTransfer as DataTransfer;
const types = dataTransfer.types;
for (let i = 0; i < types.length; i++) {
- 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 reorderChildren
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
reorderChildren(id: Tree.Id) {
const tree = this.state.tree;
const index = this.state.tree.getIndex(id);
const node = index.node;
if (!node.news_page) {
- 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"