Showing 14 of 59 total issues
Function CityTemplate
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
export default function CityTemplate(props: CityProps): React.ReactElement {
const { frequency, setFrequency } = useContext(FrequencyContext);
const { city, cities } = props;
const [api, setApi] = useState<Api | undefined>(city.api);
const [error, setError] = useState<Error>();
- 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
File SearchBar.tsx
has 262 lines of code (exceeds 250 allowed). Consider refactoring. Open
/**
* This file is part of Sh**t! I Smoke.
*
* Copyright (C) 2018-2021 Marcelo S. Coelho, Amaury M.
*
Function SearchBar
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
export function SearchBar(props: SearchBarProps): React.ReactElement {
const {
cities,
className,
placeholder = 'Search a city or address',
- 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 handleReceipts
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
export async function handleReceipts(
expo: Expo,
receiptIds: string[],
onOk: (_receiptId: ExpoPushReceiptId, _receipt: ExpoPushReceipt) => void,
onError: (_receiptId: ExpoPushReceiptId, _receipt: ExpoPushReceipt) => void
- 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 emailForUser
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
async function emailForUser(
user: MongoUser,
cities: City[]
): Promise<CreateMessageOpts> {
if (!user.emailReport) {
- 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
Avoid too many return
statements within this function. Open
return false;
Avoid too many return
statements within this function. Open
return [
<HealthTip imgAlt="warning" imgSrc={warning} key={1}>
<p className="type-400 md:type-500">
<span className="text-orange">Health alert:</span> Stop
outdoor activities and move all activities indoors.
Avoid too many return
statements within this function. Open
return [
`<span style="color: #f2934e;">Health alert:</span> everyone may experience more serious health effects.`,
`Everyone should <span style="color: #f2934e;"> reduce outdoor activities,</span> especially vulnerable people.`,
];
Avoid too many return
statements within this function. Open
return [
<HealthTip imgAlt="warning" imgSrc={warning} key={1}>
<p className="type-400 md:type-500">
<span className="text-orange">Health alert:</span> everyone
may experience more serious health effects.
Avoid too many return
statements within this function. Open
return [
`<span style="color: #f2934e;">Health alert:</span> Stop outdoor activities and move all activities indoors.`,
`If it is necessary to go out, please <span style="color: #f2934e;">wear a mask</span>.`,
];
Function tips
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export function tips(aqi: number): string[] {
if (aqi <= 50) {
return [
`Air quality is considered <span style="color: #f2934e;">satisfactory</span>, and air pollution poses little or no risk.`,
`<span style="color: #f2934e;">Enjoy</span> your usual outdoor activities.`,
- 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 tips
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function tips(aqi: number): React.ReactElement[] {
if (aqi <= 50) {
return [
<HealthTip imgAlt="happy" imgSrc={happy} key={1}>
<p className="type-400 md:type-500">
- 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 Cigarettes
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export function Cigarettes(props: CigarettesProps): React.ReactElement {
const { cigarettes } = props;
const cigaretteConfig = getCigaretteConfig(cigarettes);
- 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 Carousel
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export function Carousel(props: CarouselProps): React.ReactElement {
const {
children,
className,
innerClassName,
- 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"