Skip to content

Commit

Permalink
resolve SonarCloud issues (#193)
Browse files Browse the repository at this point in the history
  • Loading branch information
maaaathis authored Feb 19, 2024
1 parent 63cd7b5 commit 3a774cb
Show file tree
Hide file tree
Showing 13 changed files with 31 additions and 38 deletions.
6 changes: 3 additions & 3 deletions app/lookup/[domain]/(overview)/_components/IpOverviewItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ const IpOverviewItem: FC<IpOverviewItemProps> = ({
value,
subvalue,
}): ReactElement => {
const [isOpen, setOpen] = useState(false);
const open = useCallback(() => setOpen(true), [setOpen]);
const [isOpen, setIsOpen] = useState(false);
const open = useCallback(() => setIsOpen(true), [setIsOpen]);

return (
<>
Expand All @@ -47,7 +47,7 @@ const IpOverviewItem: FC<IpOverviewItemProps> = ({
</Tooltip>
</TooltipProvider>

<IpDetailsModal ip={value} open={isOpen} onOpenChange={setOpen} />
<IpDetailsModal ip={value} open={isOpen} onOpenChange={setIsOpen} />
</>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ const TechnologiesDetailsModal: FC<TechnologiesDetailsProps> = ({
<Link
className="cursor-pointer select-none decoration-slate-700 decoration-dotted underline-offset-4 hover:underline dark:decoration-slate-300"
href={
filterWhatRunsDirectUrl(technology.website) ||
technology.website ||
filterWhatRunsDirectUrl(technology.website) ??
technology.website ??
'#'
}
rel="noreferrer noopener"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ const TechnologiesWidget: React.FC<Props> = async ({
<TooltipTrigger asChild>
<Link
href={
filterWhatRunsDirectUrl(technology.website) ||
technology.website ||
filterWhatRunsDirectUrl(technology.website) ??
technology.website ??
'#'
}
target="_blank"
Expand Down
32 changes: 15 additions & 17 deletions app/lookup/[domain]/(overview)/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,23 +88,21 @@ const LookupDomain: FC<LookupDomainProps> = async ({
}

return (
<>
<div className="flex flex-col gap-4 md:grid md:grid-cols-4 lg:grid-cols-6 xl:grid-cols-8">
{whoisResult && (
<>
<DomainDatesWidget whoisData={whoisResult} />
<DomainOwnerInfoWidget whoisData={whoisResult} />
</>
)}
<DnsRecordsWidget type={DnsRecordType.A} domain={domain} />
{whoisResult && (
<NameserverWidget whoisData={whoisResult} domain={domain} />
)}
<DnsRecordsWidget type={DnsRecordType.MX} domain={domain} />
{whoisResult && <DomainlabelWidget whoisData={whoisResult} />}
<TechnologiesWidget domain={domain} />
</div>
</>
<div className="flex flex-col gap-4 md:grid md:grid-cols-4 lg:grid-cols-6 xl:grid-cols-8">
{whoisResult && (
<>
<DomainDatesWidget whoisData={whoisResult} />
<DomainOwnerInfoWidget whoisData={whoisResult} />
</>
)}
<DnsRecordsWidget type={DnsRecordType.A} domain={domain} />
{whoisResult && (
<NameserverWidget whoisData={whoisResult} domain={domain} />
)}
<DnsRecordsWidget type={DnsRecordType.MX} domain={domain} />
{whoisResult && <DomainlabelWidget whoisData={whoisResult} />}
<TechnologiesWidget domain={domain} />
</div>
);
};

Expand Down
1 change: 0 additions & 1 deletion app/lookup/[domain]/certs/error.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { type FC, ReactElement, useEffect } from 'react';

type CertsErrorProps = {
error: Error & { digest?: string };
reset: () => void;
};

const CertsError: FC<CertsErrorProps> = ({ error }): ReactElement => {
Expand Down
1 change: 0 additions & 1 deletion app/lookup/[domain]/dns/_components/IpDetailsModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import {
DrawerFooter,
DrawerHeader,
DrawerTitle,
DrawerTrigger,
} from '@/components/ui/drawer';
import { Spinner } from '@/components/ui/spinner';
import { Table, TableBody, TableCell, TableRow } from '@/components/ui/table';
Expand Down
6 changes: 3 additions & 3 deletions app/lookup/[domain]/dns/_components/IpLink.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ type IpLinkProps = {
};

const IpLink: FC<IpLinkProps> = ({ value }): ReactElement => {
const [isOpen, setOpen] = useState(false);
const open = useCallback(() => setOpen(true), [setOpen]);
const [isOpen, setIsOpen] = useState(false);
const open = useCallback(() => setIsOpen(true), [setIsOpen]);

return (
<>
Expand All @@ -38,7 +38,7 @@ const IpLink: FC<IpLinkProps> = ({ value }): ReactElement => {
</TooltipContent>
</Tooltip>
</TooltipProvider>
<IpDetailsModal ip={value} open={isOpen} onOpenChange={setOpen} />
<IpDetailsModal ip={value} open={isOpen} onOpenChange={setIsOpen} />
</>
);
};
Expand Down
1 change: 0 additions & 1 deletion app/lookup/[domain]/dns/error.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { type FC, ReactElement, useEffect } from 'react';

type DNSErrorProps = {
error: Error & { digest?: string };
reset: () => void;
};

const DNSError: FC<DNSErrorProps> = ({ error }): ReactElement => {
Expand Down
1 change: 0 additions & 1 deletion app/lookup/[domain]/error.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { type FC, ReactElement, useEffect } from 'react';

type DomainErrorProps = {
error: Error & { digest?: string };
reset: () => void;
};

const DomainError: FC<DomainErrorProps> = ({ error }): ReactElement => {
Expand Down
1 change: 0 additions & 1 deletion app/lookup/[domain]/whois/error.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { type FC, ReactElement, useEffect } from 'react';

type WhoisErrorProps = {
error: Error & { digest?: string };
reset: () => void;
};

const WhoisError: FC<WhoisErrorProps> = ({ error }): ReactElement => {
Expand Down
8 changes: 4 additions & 4 deletions components/BookmarkletLink.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import {

const BookmarkletLink: FC = (): ReactElement => {
const [target, setTarget] = useState('');
const [isOpen, setOpen] = useState(false);
const [isOpen, setIsOpen] = useState(false);

useEffect(() => {
const rawScript = `
Expand All @@ -44,9 +44,9 @@ const BookmarkletLink: FC = (): ReactElement => {
const clickHandler = useCallback<MouseEventHandler<HTMLAnchorElement>>(
(event) => {
event.preventDefault();
setOpen(true);
setIsOpen(true);
},
[setOpen]
[setIsOpen]
);

return (
Expand All @@ -65,7 +65,7 @@ const BookmarkletLink: FC = (): ReactElement => {
)}
</div>

<AlertDialog open={isOpen} onOpenChange={setOpen}>
<AlertDialog open={isOpen} onOpenChange={setIsOpen}>
<AlertDialogContent>
<AlertDialogHeader>
<AlertDialogTitle>Installation required</AlertDialogTitle>
Expand Down
2 changes: 1 addition & 1 deletion components/ExternalFavicon.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use client';

import Image from 'next/image';
import { type FC, ReactElement, useCallback, useState } from 'react';
import { type FC, ReactElement } from 'react';

type ExternalFavicon = {
url: string;
Expand Down
2 changes: 1 addition & 1 deletion lib/resolvers/AuthoritativeResolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ class AuthoritativeResolver extends DnsResolver {
const response = await this.requestLoader.load({
domain,
type: recordType,
nameserver: nameserver || rootServers[0], // TODO Use fallback nameservers
nameserver: nameserver ?? rootServers[0], // TODO Use fallback nameservers
});

if (response.answers?.length) {
Expand Down

1 comment on commit 3a774cb

@vercel
Copy link

@vercel vercel bot commented on 3a774cb Feb 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

digga – ./

digger.vercel.app
digga-git-main-maathis.vercel.app
digga.dev
digga-maathis.vercel.app

Please sign in to comment.