Vizzuality/landgriffon

View on GitHub

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 = {
Severity: Minor
Found in marketing/src/pages/api/newsletter.ts - About 1 hr to fix

    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">
      Severity: Minor
      Found in marketing/src/containers/about/how/component.tsx - About 1 hr to fix

        Function AutoCompleteSelect has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

        const AutoCompleteSelect = <T,>({
          value,
          defaultValue,
          error,
          icon,
        Severity: Minor
        Found in client/src/components/forms/select/autocomplete/component.tsx - About 1 hr to fix

        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,
        Severity: Minor
        Found in client/src/hooks/queryParam/index.ts - About 1 hr to fix

        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',
        Severity: Minor
        Found in client/src/components/search/component.tsx - About 1 hr to fix

        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');

        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 {

        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,
        Severity: Minor
        Found in client/src/pages/profile/users.tsx - About 1 hr to fix

        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');
        Severity: Minor
        Found in client/src/containers/analysis-eudr/map/basemap/component.tsx - About 1 hr to fix

        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);
        Severity: Minor
        Found in client/src/pages/data/scenarios/index.tsx - About 1 hr to fix

        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);
        
        
        Severity: Minor
        Found in api/src/create-swagger-specification.ts - About 1 hr to fix

        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> {

        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) {
        Severity: Minor
        Found in api/src/utils/base.query-builder.ts - About 1 hr to fix

        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;

        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 ===

        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,
          });
        
        
        Severity: Minor
        Found in marketing/src/containers/home/how/component.tsx - About 1 hr to fix

        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(() => {
        Severity: Minor
        Found in marketing/src/containers/methodology/hero/component.tsx - About 1 hr to fix

        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 ===

        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>(
        Severity: Minor
        Found in client/src/hooks/business-units/index.ts - About 1 hr to fix
          Severity
          Category
          Status
          Source
          Language