-
Notifications
You must be signed in to change notification settings - Fork 0
267-adicao-campos-para-anexos #297
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev-profissional-da-saude
Are you sure you want to change the base?
267-adicao-campos-para-anexos #297
Conversation
…arquivo genérico no formulário de cadastro
…arquivo genérico no formulário de atualização de profissional
|
Important Review skippedMore 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 ✨ Finishing touches
🧪 Generate unit tests (beta)
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. Comment |
Isnael07
left a comment
There was a problem hiding this 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
windowporglobalThispara 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"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As importações
FormDescription,Disponibilidadenã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> |
There was a problem hiding this comment.
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 = { |
There was a problem hiding this comment.
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,termoVoluntariadoecurriculots, 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
termoVoluntariadoecurriculotsao 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}$/; |
There was a problem hiding this comment.
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, "")), |
There was a problem hiding this comment.
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" && |
There was a problem hiding this comment.
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 globalwindowexiste.
O SonarQube (S7764) recomenda usarglobalThisem vez dewindow,selfouglobal, poisglobalThisfunciona 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" && |
There was a problem hiding this comment.
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 globalwindowexiste.
O SonarQube (S7764) recomenda usarglobalThisem vez dewindow,selfouglobal, poisglobalThisfunciona 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.
No description provided.