Showing 1,897 of 1,897 total issues
Method create
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def self.create(inputs = {})
inputs[:device] ||= FactoryBot.create(:device, inputs[:device] || {})
FactoryBot.create(:user, device: inputs[:device]) if inputs[:device].users.empty?
inputs[:name] ||= Faker::Company.catch_phrase
inputs[:color] ||= Sequence::COLORS.sample
- 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 onDrop
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
(dispatch1: Function, sequence: TaggedSequence) =>
(index: number, key: string) => {
if (key.length > 0) {
dispatch1(function (dispatch2: Function) {
const dataXferObj = dispatch2(stepGet(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 readOnlyInterceptor
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export const readOnlyInterceptor = (config: InternalAxiosRequestConfig) => {
const method = (config.method || "get").toLowerCase();
const relevant = ["put", "patch", "delete"].includes(method);
if (relevant && appIsReadonly(store.getState().resources.index)) {
- 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 getPanelStatus
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export const getPanelStatus = (): MapPanelStatus => {
if (Path.equals(Path.designer())) {
return isMobile() ? MapPanelStatus.mobileClosed : MapPanelStatus.closed;
}
const mode = getMode();
- 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 addOrRemoveFromGroup
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
(clickedPlantUuid: UUID, resources: ResourceIndex) =>
(dispatch: Function) => {
const group = findGroupFromUrl(selectAllPointGroups(resources));
const point =
resources.references[clickedPlantUuid] as TaggedPoint | undefined;
- 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 ProfileSvg
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export const ProfileSvg = (props: ProfileSvgProps) => {
const { expanded, mapTransformProps, tools, position, getConfigValue } = props;
const lineAxis = props.designer.profileAxis;
const selectionWidth = props.designer.profileWidth;
const profileAxis = lineAxis == "x" ? "y" : "x";
- 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 render
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
render() {
const {
currentPlant, mapTransformProps, dragging, isEditing, visible, designer,
animate, spreadLayerVisible,
} = this.props;
- 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 generateTransform
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const generateTransform = (props: TransformProps): string => {
const {
quadrant, qCoords, size, imageOrigin, xySwap, rotate,
} = props;
const { qx, qy } = qCoords;
- 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 WizardStepHeader
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export const WizardStepHeader = (props: WizardStepHeaderProps) => {
const stepOpen = props.stepOpen == props.step.slug;
const resultDate = props.stepResult?.updated_at;
const stepDone = props.stepResult?.answer;
const stepFail = stepDone == false;
- 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 StatusIcon
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
(props: StatusIconProps) => {
const okNoStatus = props.status ? "ok" : "no";
const status = props.available ? okNoStatus : "unknown";
const okNoStatusText = props.status ? t("ok") : t("error");
const statusText = props.available ? okNoStatusText : t("unknown");
- 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 routeMqttData
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export function routeMqttData(chan: string, payload: Buffer):
MqttDataResult<TaggedResource> {
/** Skip irrelevant messages: only resource auto-sync messages are desired.
* eg, `bot/device_#/sync/Resource/#` */
if (!(chan.split("/")[2] == "sync")) { return { status: "SKIP" }; }
- 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 Bed
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export const Bed = (props: BedProps) => {
const {
bedWidthOuter, bedLengthOuter, botSizeZ, bedHeight, bedZOffset,
legSize, legsFlush, extraLegsX, extraLegsY, bedBrightness, soilBrightness,
soilHeight, ccSupportSize, axes, xyDimensions,
- 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 OtaTimeSelector
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export const OtaTimeSelector = (props: OtaTimeSelectorProps) => {
const { device, dispatch, timeSettings } = props;
const { utcOffset, hour24 } = timeSettings;
const localHour = utcHourToLocalHour(device.body.ota_hour_utc, utcOffset) ??
device.body.ota_hour;
- 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 colorFromTemp
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export const colorFromTemp = (temp: number | undefined): string => {
if (!isNumber(temp)) {
return "gray";
}
if (temp < 0) {
- 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 RawEditWeed
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export const RawEditWeed = (props: EditWeedProps) => {
const getWeed = () => {
const stringyID = Path.getSlug(Path.weeds());
if (stringyID) {
return props.findPoint(parseInt(stringyID));
- 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 Setting
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export const Setting = (props: SettingProps) => {
const { title, setting, numberSetting, callback, defaultOn } = props;
const raw_value = setting ? props.getConfigValue(setting) : undefined;
const value = (defaultOn && isUndefined(raw_value)) ? true : !!raw_value;
return <Highlight settingName={title}>
- 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 CameraCheckBase
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const CameraCheckBase = (props: CameraCheckBaseProps) => {
const images = selectAllImages(props.resources);
const getLastImageId = () => last(images)?.body.id;
const [prevImageId, setPrevImageId] = React.useState(getLastImageId());
const newImageUrls = images
- 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 lastSeenNumber
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export const lastSeenNumber = (props: LastSeenNumberProps) => {
const { last_saw_api } = props.device.body;
const { uptime } = props.bot.connectivity;
const bot2Mqtt = uptime["bot.mqtt"];
const botToMqttAt = bot2Mqtt?.state === "up" ? bot2Mqtt.at : "";
- 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 VerticalGridlines
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const VerticalGridlines = (props: PlotProps) =>
<g id="vertical-gridlines">
{range(props.timeStep, props.timePeriod + 1, props.timeStep).map(x => {
const id = "vertical_gridline_" + x;
/** label & major gridline every 3 hours/days/months and every week day */
- 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 onLogs
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
(dispatch: Function, getState: GetState) => (msg: Log) => {
if (isLog(msg)) {
!msg.type && (msg.type = "info");
actOnChannelName(msg, "toast", showLogOnScreen);
actOnChannelName(msg, "espeak", speakLogAloud(getState));
- 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"