From 0559b90a00e0a55defe31a93f9979e97362efb82 Mon Sep 17 00:00:00 2001 From: "coderabbitai[bot]" <136622811+coderabbitai[bot]@users.noreply.github.com> Date: Tue, 10 Jun 2025 07:52:23 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=93=9D=20Add=20docstrings=20to=20`feature?= =?UTF-8?q?/coderabbit-pr-test-3`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Docstrings generation was requested by @sidhardha. * https://github.com/sidhardha/code-rabbit-react-starter/pull/7#issuecomment-2958033312 The following files were modified: * `src/Greeting.tsx` --- src/Greeting.tsx | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/Greeting.tsx b/src/Greeting.tsx index 3ce2594..a0ab2d3 100644 --- a/src/Greeting.tsx +++ b/src/Greeting.tsx @@ -1,11 +1,27 @@ import React from 'react'; +/** + * Displays a personalized greeting message using the provided name in uppercase. + * + * @param name - The name to include in the greeting. + * + * @returns An `

` React element with a greeting message. + * + * @remark If {@link name} is an empty string, the greeting will be rendered as "Hello, !", which may not be intended. + */ export function Greeting({ name }: { name: string }) { // Introduce a bug: if name is empty, it should say 'Guest', but this is not handled return

Hello, {name.toUpperCase()}! Welcome to CodeRabbit review test.

; } -// Add a new function with a logic bug +/** + * Returns a greeting message based on the provided hour of the day. + * + * @param hour - The hour of the day in 24-hour format. + * @returns A greeting string corresponding to the time of day, or "Invalid hour" if the hour is 24 or greater. + * + * @remark Hours between 18 and 23 are currently labeled as "Good night" due to a known logic bug; typically, hours 18–21 should be "Good evening" and 22–23 "Good night". + */ export function getGreetingTime(hour: number): string { if (hour < 12) return 'Good morning'; if (hour < 18) return 'Good afternoon';