Showing 77 of 117 total issues
Function Image
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
export default function Image(props: Props) {
const imageSize = () => {
const { image, cropping, crop_width, crop_height } = props.cropState;
if (cropping) {
return { width: image.real_width, height: image.real_height };
- 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 collapseArrow
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
collapseArrow() {
const index = this.props.index;
// Don't collapse the root node
if (!index.parent) {
- 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 connect
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
connect() {
const tabs = this.tabNames();
if (tabs.length > 0) {
let initTab: string = null;
const tabExpression = /#(.*)$/;
- 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 FileUploadButton
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
export default function FileUploadButton(props: Props) {
const inputRef = useRef<HTMLInputElement>();
const handleChange = (evt: ChangeEvent<HTMLInputElement>) => {
const fileList = evt.target.files;
- 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 redirect_path
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def redirect_path(params = {})
path = redirect_to.dup
if path.start_with? "/"
params.each do |key, value|
unless value.is_a?(String) || value.is_a?(Symbol)
- 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 DragElement
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export default function DragElement(props: Props) {
const { draggable, dragState, container } = props;
if (draggable === "Files") {
return "";
- 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 move
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
move(fromId: Tree.Id, toId: Tree.Id, placement: MovePlacement) {
if (fromId === toId || toId === 1) {
return;
}
- 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 hovering
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function hovering(
dragState: Drag.State,
target: Drag.Item | React.MutableRefObject<HTMLDivElement>
) {
const { x, y } = 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 handleKeyPress
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
handleKeyPress(evt) {
let key;
if (evt.which >= 65 && evt.which <= 90) {
key = String.fromCharCode(evt.keyCode).toLowerCase();
} else if (evt.keyCode === 13) {
- 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 a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export default function ImageCropper(props: Props) {
const containerRef = useRef<HTMLDivElement>();
const [containerSize, setContainerSize] = useState<Crop.Size>();
const handleResize = () => {
- 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 relativeUrl
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
relativeUrl(str) {
let url = null;
if (!str.match(/^https:\/\//) || !document || !document.location) {
return str;
- 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 setting
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def self.setting(key, type, default = nil)
settings[key] = SettingStruct.new(type, default)
define_method key do |*args|
args.any? ? set(key, *args) : get(key)
- 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 actions
has a Cognitive Complexity of 6 (exceeds 5 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) {
- 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 modifyDate
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
modifyDate(original, options = {}) {
var newDate = new Date(original);
if (Object.prototype.hasOwnProperty.call(options, "year")) {
newDate.setFullYear(options.year);
}
- 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 collectionOrder
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export function collectionOrder(
collection: Drag.Collection,
dragState: Drag.State
) {
const { draggables, ref } = collection;
- 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 getNodeByTop
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
getNodeByTop(top: Tree.Id) {
const indexes = this.indexes;
for (const id in indexes) {
if (Object.prototype.hasOwnProperty.call(indexes, id)) {
if (indexes[id].top === top) {
- 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 a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export default function Modal() {
const component = useModalStore((state) => state.component);
const close = useModalStore((state) => state.close);
const handleClose = (evt: KeyboardEvent | MouseEvent) => {
- 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"