Skip to content

Conversation

@guilhermexL
Copy link

No description provided.

@coderabbitai
Copy link

coderabbitai bot commented Oct 14, 2025

Important

Review skipped

More than 25% of the files skipped due to max files limit. The review is being skipped to prevent a low-quality review.

190 files out of 297 files are above the max files limit of 100. Please upgrade to Pro plan to get higher limits.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch 267-adicao-campos-para-anexos

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@Isnael07 Isnael07 self-requested a review October 18, 2025 00:02
Copy link

@Isnael07 Isnael07 left a comment

Choose a reason for hiding this comment

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

Revisei os arquivos e identifiquei alguns pontos de melhoria relacionados à manutenibilidade do código, usando alertas do SonarQube:

  • Remover importações não utilizadas.
  • Preencher ou remover o <h1> vazio para melhorar SEO.
  • Ajustar regex e usar replaceAll() onde indicado.
  • Simplificar quantificadores e classes de caracteres em expressões regulares (typescript:S6353) para maior clareza e concisão.
  • Substituir window por globalThis para compatibilidade.

Além disso, há campos obrigatórios faltando no objeto de profissional de saúde que devem ser preenchidos.

Por favor, faça essas alterações antes de prosseguir com o merge.

import { Button } from "@/components/ui/button";
import { Input } from "@/components/ui/input";
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select";
import { Form, FormControl, FormField, FormItem, FormLabel, FormMessage, FormDescription } from "@/components/ui/form";

Choose a reason for hiding this comment

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

As importações FormDescription, Disponibilidade não estão sendo utilizadas neste arquivo.
Isso pode gerar warnings e reduzir a legibilidade do código.
Sugestão: remover essas importações para manter o código limpo.


return (
<div className="p-0">
<h1 className="text-2xl font-bold mb-6"></h1>
Copy link

@Isnael07 Isnael07 Oct 18, 2025

Choose a reason for hiding this comment

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

Oelemento <h1> sem conteúdo .
Isso pode impactar a acessibilidade e a manutenção do código.
Sugestão: preencher o <h1> com um título significativo ou remover se não for necessário.

const router = useRouter();
const { create, loading, error, success } = useCreateProfissional();

const defaultValues: CadastroFormValues = {

Choose a reason for hiding this comment

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

O objeto que está sendo passado possui várias propriedades (nomeCompleto, email, etc.), mas está faltando termoVoluntariado e curriculots, que são obrigatórios pelo tipo definido.
Isso faz com que o TypeScript lance erro e pode gerar inconsistências em tempo de execução.
Sugestão:

  • Adicionar termoVoluntariado e curriculots ao objeto, ou
  • Tornar esses campos opcionais na interface se não forem obrigatórios.

const cidadeRegex = /^[A-Za-zÀ-ÿ\s]+$/;
const bairroRegex = /^[A-Za-zÀ-ÿ\s]+$/;
const ruaRegex = /^[A-Za-zÀ-ÿ0-9\s]+$/;
const numeroRegex = /^[0-9]{1,6}$/;

Choose a reason for hiding this comment

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

A regex ^[0-9]{1,6}$ funciona, mas pode ser escrita de forma mais concisa e legível.
O SonarQube (S6353) sugere simplificar quantificadores e classes de caracteres.
Sugestão: substituir [0-9] por \d, ficando assim:

const numeroRegex = /^\d{1,6}$/;

Isso mantém o mesmo comportamento, mas deixa a regex mais clara e concisa.

rg: z
.string()
.regex(rgRegex, "RG inválido")
.transform((val) => val.replace(/\W/g, "")),

Choose a reason for hiding this comment

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

O trecho .transform((val) => val.replace(/\W/g, "")) utiliza .replace() com uma regex global.
O SonarQube (S7781) recomenda usar .replaceAll() quando a intenção é substituir todos os matches, pois deixa o código mais explícito e legível.
Sugestão: alterar para:

.transform((val) => val.replaceAll(/\W/g, ""))

Isso mantém o mesmo comportamento, mas segue a boa prática recomendada.

.refine(
(file) =>
file &&
typeof window !== "undefined" &&

Choose a reason for hiding this comment

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

O trecho typeof window !== "undefined" && verifica se o objeto global window existe.
O SonarQube (S7764) recomenda usar globalThis em vez de window, self ou global, pois globalThis funciona em qualquer ambiente (Node, browser, WebWorker, etc.) e torna o código mais universal.
Sugestão: alterar para:

typeof globalThis !== "undefined" &&

Isso mantém a lógica de verificação, mas segue a boa prática de referência ao objeto global.

.refine(
(file) =>
file &&
typeof window !== "undefined" &&

Choose a reason for hiding this comment

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

O trecho typeof window !== "undefined" && verifica se o objeto global window existe.
O SonarQube (S7764) recomenda usar globalThis em vez de window, self ou global, pois globalThis funciona em qualquer ambiente (Node, browser, WebWorker, etc.) e torna o código mais universal.
Sugestão: alterar para:

typeof globalThis !== "undefined" &&

Isso mantém a lógica de verificação, mas segue a boa prática de referência ao objeto global.

@KlebsonAmaranteS KlebsonAmaranteS changed the base branch from main to dev-profissional-da-saude October 23, 2025 12:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants