Documentation comment not found for arrow function
reportWebVitals
1const reportWebVitals = onPerfEntry => { 2 if (onPerfEntry && onPerfEntry instanceof Function) {
3 import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {
4 getCLS(onPerfEntry);
Documentation comment not found for arrow function
ViewSSHKeypair
15import { IoClipboard } from "react-icons/io5";
16import { fetchData } from "../utils/fetchData";
17
18const ViewSSHKeypair = () => { 19 const { id } = useParams();
20 const [pubKey, setPubKey] = useState();
21 const [privKey, setPrivKey] = useState();
Documentation comment not found for arrow function
fetchKeypair
23 const [hasCopiedPubKey, setHasCopiedPubKey] = useState(false);
24
25 useEffect(() => {
26 const fetchKeypair = async () => { 27 try {
28 const url = `http://127.0.0.1:8080/api/v1/key/${id}`;
29 const options = { withCredentials: true };
Documentation comment not found for arrow function
fetchKeypairs
26
27// Dashboard page
28const Dashboard = () => {
29 const fetchKeypairs = async () => {30 try {
31 const options = { withCredentials: true };
32 const response = await fetchData(
Documentation comment not found for arrow function
renderAlert
34 error: useRef(false),
35 };
36
37 const renderAlert = () => { 38 if (status.success.current === true) {
39 return (
40 <Alert status="success">
Documentation comment not found for arrow function
DeleteDialog
12import axios from "axios";
13import { useMutation, useQueryClient } from "@tanstack/react-query";
14import { api } from "../utils/urls";
15const DeleteDialog = (props) => {16 const { isOpen, onOpen, onClose } = useDisclosure();
17 const cancelRef = React.useRef();
18 const queryClient = useQueryClient();
Documentation comment not found for arrow function
onDelete
16 const { isOpen, onOpen, onClose } = useDisclosure();
17 const cancelRef = React.useRef();
18 const queryClient = useQueryClient();
19 const onDelete = async (id) => {20 try {
21 const options = { withCredentials: true };
22 const url = api.delete_ssh_keypair + id
Documentation comment not found for arrow function
CreateDialog
18import { postData } from "../utils/postData";
19import { api } from "../utils/urls";
20
21const CreateDialog = () => { 22 const { isOpen, onOpen, onClose } = useDisclosure();
23 const cancelRef = React.useRef();
24 const {
Documentation comment not found for arrow function
onClosing
37 console.error(err)
38 }
39 };
40 const onClosing = () => { 41 if (isValid) {
42 onClose();
43 }
Documentation comment not found for arrow function
onSubmit
29 mode: "onChange",
30 });
31
32 const onSubmit = async (data) => { 33 try {
34 const options = { withCredentials: true };
35 await postData(api.create_ssh_keypair, data, options);
Description
It is recommended to have documentation comments above, or right inside a function/class declaration. This helps developers, users and even the author understand the purpose of a code snippet or API function in the future.
NOTE: If you want to stop this issue from getting raised on certain constructs (arrow functions, class expressions, methods etc.), consider using the skipdoccoverage option under the analyzers.meta
property in your .deepsource.toml
file.
For example, the following configuration will silence this issue for class expressions and method definitions:
[analyzers.meta]
skip_doc_coverage = ["class-expression", "method-definition"]
Bad Practice
function sum(a, b) {
return a + b;
}
Recommended
/**
* Function to add two numbers
* @param a The first number to add
* @param b The second number to add
* @returns The sum of two numbers
*/
function sum(a, b) {
return a + b;
}