Showing 71 of 137 total issues
Function Block
has a Cognitive Complexity of 7 (exceeds 5 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>
- 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 DateRangeSelect
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
export default function DateRangeSelect(props: Props) {
const { disabled, disableTime, objectName } = props;
const [uncontrolledStartsAt, setUncontrolledStartsAt] = useState(
parseDate(props.startsAt)
- 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 collectionOrder
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export function collectionOrder<T>(
collection: Drag.Collection<T>,
dragState: Drag.State<T>
): Array<Drag.Item<T>> {
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 relativeUrl
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function relativeUrl(str: string): string {
let url: 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
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 unconfiguredBlocks
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export function unconfiguredBlocks(state: PageEditor.State): Template.Block[] {
const allBlocks: Record<string, Template.Block> = state.templates
.flatMap((t) => t.blocks)
.reduce((bs, b) => ({ [b.name]: b, ...bs }), {});
- 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
function modifyDate(original: Date, options: ModifyOptions = {}): Date {
const newDate = new Date(original);
if ("year" in options) {
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
Method reify_options
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def reify_options(block)
return block unless block.key?(:options)
opts = block[:options]
opts = opts.call if opts.is_a?(Proc)
- 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<T>(
dragState: Drag.State<T>,
target: Drag.Item<T> | 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
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"