Showing 438 of 1,408 total issues
Function Newsletter
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
const Newsletter = (req: NextApiRequest, res: NextApiResponse): void => {
if (req.method === 'PUT') {
const { email } = req.body;
const data = {
Function getImpactRawDataPerSourcingRecordCached
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
private async getImpactRawDataPerSourcingRecordCached(
indicators: INDICATOR_NAME_CODES[],
materialId: string,
geoRegionId: string,
adminRegionId: string,
Function How
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
const How: React.FC = () => {
return (
<section className="relative z-10 py-32 bg-blue-600 bg-cover md:py-64 lg:-mt-20">
<Wrapper>
<div className="max-w-2xl mx-auto space-y-10 text-center text-white md:space-y-20">
Function AutoCompleteSelect
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
const AutoCompleteSelect = <T,>({
value,
defaultValue,
error,
icon,
- 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 useQueryParam
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
const useQueryParam = <T, F = T>(
name: string,
{
defaultValue,
formatParam,
- 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 Search
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
export const Search: React.FC<SearchProps> = ({
searchQuery = 'search',
onChange,
defaultValue,
size = 'base',
- 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 AnalysisMap
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
const AnalysisMap = () => {
const { layers } = useAppSelector(analysisMap);
const { isSidebarCollapsed } = useAppSelector(analysisUI);
const [mapStyle, setMapStyle] = useState<MapStyle>('terrain');
- 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 SupplierSourcingInfoChart
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
const SupplierSourcingInfoChart = (): JSX.Element => {
const [showBy, setShowBy] = useState<'byVolume' | 'byArea'>('byVolume');
const [selectedPlots, setSelectedPlots] = useState<string[]>([]);
const { supplierId }: { supplierId: string } = useParams();
const {
- 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 AdminUsersPage
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
const AdminUsersPage: React.FC = () => {
const { query } = useRouter();
const [sorting, setSorting] = useState<SortingState>([]);
const [pagination, setPaginationState] = useState<PaginationState>({
pageIndex: 1,
- 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 EUDRBasemapControl
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
const EUDRBasemapControl = () => {
const currentDate = useMemo(() => new Date(), []);
const dispatch = useAppDispatch();
const { basemap, planetLayer, planetCompareLayer } = useAppSelector((state) => state.eudr);
const basemapData = LayersData.find((layer) => layer.id === 'planet-data');
- 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 ScenariosAdminPage
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
const ScenariosAdminPage: React.FC = () => {
const router = useRouter();
const { query } = router;
const [scenatioToDelete, setScenatioToDelete] = useState<string>(null);
- 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 createOrUpdateSwaggerSpec
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
export async function createOrUpdateSwaggerSpec(document: any): Promise<void> {
if (active && process.env.NODE_ENV == 'development') {
const documentString: string = JSON.stringify(document);
const currentHash: string = hashContent(documentString);
- 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 addReplacingElementsToIntervention
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
async addReplacingElementsToIntervention(
newIntervention: ScenarioIntervention,
newSourcingLocations: SourcingData[],
type: SCENARIO_INTERVENTION_TYPE,
): Promise<ScenarioIntervention> {
- 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 addFilters
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
static addFilters<Entity extends ObjectLiteral>(
queryBuilder: SelectQueryBuilder<Entity>,
filters: CommonFiltersDto,
): SelectQueryBuilder<Entity> {
if (filters.materialIds) {
- 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 isComparisonRequestAuthorized
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
private async isComparisonRequestAuthorized(
request: Request,
additionalChecks: ScenarioCheckWhiteListOptions,
): Promise<boolean> {
const baseScenarioId: string = request.query.baseScenarioId as string;
- 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 validate
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
validate(latitudeInput: number, args: ValidationArguments): boolean {
if (
(args.object as SourcingDataExcelValidator).location_type ===
LOCATION_TYPES.UNKNOWN ||
(args.object as SourcingDataExcelValidator).location_type ===
- 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 How
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
const How: React.FC = () => {
const [ref, percentage] = useScrollPercentage({
threshold: 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 Hero
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
const Hero: React.FC = () => {
const videoRef = useRef<HTMLVideoElement>();
const [playing, setPlaying] = useState(false);
const onTogglePlay = useCallback(() => {
- 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 validate
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
validate(longitudeInput: number, args: ValidationArguments): boolean {
if (
(args.object as SourcingDataExcelValidator).location_type ===
LOCATION_TYPES.UNKNOWN ||
(args.object as SourcingDataExcelValidator).location_type ===
- 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 useBusinessUnitsOptionsTrees
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const useBusinessUnitsOptionsTrees = <T = BusinessUnitsOption[]>(
params: BusinessUnitsTreesParams = {},
options: UseQueryOptions<{ data: BusinessUnitsTreeItem[] }, unknown, T> = {},
): UseQueryResult<T, unknown> => {
const query = useQuery<{ data: BusinessUnitsTreeItem[] }, unknown, T>(