-
-
Notifications
You must be signed in to change notification settings - Fork 5
Analyze Project for Potential Improvements #183
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: develop
Are you sure you want to change the base?
Analyze Project for Potential Improvements #183
Conversation
- Cria documentação de validações numéricas (numeric.md) - Cria documentação de validações de formato (format.md) - Cria documentação de validações booleanas (boolean.md) - Cria documentação de documentos brasileiros (brazilian_docs.md) - Cria página sobre o Domain Notification Pattern (about.md) - Atualiza e corrige index de validações com links funcionais Resolve o gap entre a navegação do mkdocs.yml e os arquivos de documentação que estavam faltando. Todos os links agora funcionam corretamente. Issue relacionada: Melhoria de credibilidade e documentação do projeto
## Validações Brasileiras (CPF/CNPJ) - ✅ Implementa validação completa de CPF com dígitos verificadores - ✅ Implementa validação completa de CNPJ com dígitos verificadores - ✅ Rejeita números sequenciais e inválidos conhecidos - ✅ Suporta formatação (com pontos/hífen) e sem formatação - ✅ Adiciona testes completos para CPF e CNPJ ## Validações Numéricas Diretas - ✅ Cria NumericValidationContract para valores int/float - ✅ Implementa is_greater_than_number, is_lower_than_number - ✅ Implementa is_between_numbers, is_positive, is_negative - ✅ Implementa is_zero, is_not_zero - ✅ Adiciona testes completos ## Validações de URL - ✅ Cria URLValidationContract - ✅ Implementa is_url() e is_not_url() - ✅ Usa regex pattern existente ## Validações de DateTime - ✅ Cria DateTimeValidationContract - ✅ Implementa is_date_after, is_date_before, is_date_between - ✅ Implementa is_date_in_past, is_date_in_future, is_today - ✅ Suporta date e datetime ## CI/CD - ✅ Corrige workflow de linters (uv add → uv sync --group linter) - ✅ Evita modificação de arquivos durante CI ## Documentação - ✅ Atualiza docs/validations/brazilian_docs.md - ✅ Remove seções de "limitações" e "workarounds" - ✅ Adiciona exemplos completos de uso - ✅ Documenta algoritmos de validação Resolve: #29 (Validação de Documentos) Resolve: #28 (Validação de Números) Resolve: #33 (Validação de URL) Resolve: #27 (Validação de DateTime)
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.
Pull Request Overview
This pull request adds comprehensive validation capabilities and documentation to PyFlunt, significantly expanding the library's functionality with Brazilian document validation (CPF/CNPJ with full check digit verification), numeric validations, datetime validations, and URL validations.
Key changes:
- Implemented complete CPF and CNPJ validation with check digit verification algorithms
- Added numeric validation methods for direct int/float value comparisons (is_positive, is_negative, is_between_numbers, etc.)
- Added datetime validation methods for date comparisons (is_date_after, is_date_before, is_date_in_past, etc.)
- Added URL validation support with regex pattern matching
- Created comprehensive documentation for all validation types
- Updated CI/CD workflow to use uv dependency groups for linter installation
Reviewed Changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 15 comments.
Show a summary per file
| File | Description |
|---|---|
flunt/validations/brazilian_document_validation_contract.py |
Implements full CPF/CNPJ validation with check digit algorithms; has semantic issues with error message constants |
flunt/validations/numeric_validation_contract.py |
Adds numeric value validation methods (positive, negative, zero, comparisons); lacks test coverage |
flunt/validations/datetime_validation_contract.py |
Implements date/datetime comparison validations; contains logic bugs in date calculation and lacks test coverage |
flunt/validations/url_validation_contract.py |
Adds URL validation with regex patterns; lacks test coverage |
flunt/validations/contract.py |
Integrates all new validation contracts via multiple inheritance |
tests/validations/test_brazilian_document_validation_contract.py |
Comprehensive test suite for CPF/CNPJ validations |
tests/validations/test_numeric_validation_contract.py |
Comprehensive test suite for numeric validations |
docs/validations/brazilian_docs.md |
Documents CPF/CNPJ validation; contains incorrect error message documentation |
docs/validations/format.md |
Documents email and credit card validations; has documentation inconsistency |
docs/validations/numeric.md |
Misnamed file - documents collection size validation, not numeric value validation |
docs/validations/boolean.md |
Documents boolean validations with examples |
docs/validations/index.md |
Overview of all validations; contains outdated warnings and planned features list |
docs/about.md |
Comprehensive explanation of Domain Notification Pattern with DDD examples |
.github/workflows/linters.yml |
Updates to use uv dependency groups for linter installation |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
tests/validations/test_brazilian_document_validation_contract.py
Outdated
Show resolved
Hide resolved
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
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.
Pull Request Overview
Copilot reviewed 14 out of 14 changed files in this pull request and generated 4 comments.
Comments suppressed due to low confidence (1)
docs/validations/index.md:370
- The "Validações Planejadas" (Planned Validations) section is outdated. This PR implements several features that are still listed as planned:
- ⏳ DateTime: Already implemented in
DateTimeValidationContract(lines 363) - ⏳ Números: Already implemented in
NumericValidationContractwith methods likeis_greater_than_number(),is_positive(), etc. (line 364) - ⏳ CPF/CNPJ: Already implemented with full check digit validation in
BrazilianDocumentValidationContract(line 365) - ⏳ URL: Already implemented in
URLValidationContract(line 366)
These should be:
- Removed from the "planned" section
- Added to the main "Categorias de Validação" section with proper documentation
- The index should link to documentation for these new features
Note: The current "Numéricas" section (lines 65-84) incorrectly describes collection size validations instead of the new numeric value validations.
## Validações Planejadas
As seguintes validações estão planejadas para versões futuras:
- ⏳ **Regex**: Validação com regex customizado
- ⏳ **Objetos**: Validações de objetos complexos
Acompanhe o desenvolvimento no [GitHub](https://github.com/fazedordecodigo/PyFlunt/issues).
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Adiciona constantes para magic values (CPF_LENGTH, CNPJ_LENGTH, MAX_CHECKSUM_DIGIT) - Substitui datetime.now() e date.today() por função _get_today() com UTC timezone - Remove warnings PLR2004 (magic values) - Remove warnings DTZ005/DTZ011 (timezone aware datetimes) Todos os checks do Ruff agora passam com sucesso.
|
@copilot open a new pull request to apply changes based on the comments in this thread |
|
@fazedordecodigo I've opened a new pull request, #184, to work on those changes. Once the pull request is ready, I'll request review from you. |
|
@copilot open a new pull request to apply changes based on the comments in this thread |
|
@fazedordecodigo I've opened a new pull request, #185, to work on those changes. Once the pull request is ready, I'll request review from you. |
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
- Adiciona constantes para valores mágicos (PLR2004) - Adiciona anotações ClassVar para atributos de classe (RUF012) - Substitui valores literais por constantes nomeadas nos testes - Remove todos os avisos do Ruff (16 erros corrigidos)
This pull request adds comprehensive documentation for validations of Brazilian documents (CPF and CNPJ) and format-based validations (such as email and credit card) to the project. The new docs provide detailed usage examples, algorithm explanations, regex patterns, and guidance for future contributions.
Brazilian Document Validations:
docs/validations/brazilian_docs.mdwith full documentation for CPF and CNPJ validation, including algorithm details, regex patterns, and examples of valid/invalid inputs. Also outlines future plans for other Brazilian documents like CEP, Título de Eleitor, PIS, and CNH.Format Validations:
docs/validations/format.mddocumenting format validations for email, non-email, and credit card numbers, including regex patterns, Luhn algorithm explanation, and code examples. Also lists planned future format validations (URL, phone, CEP, passport, custom regex).CI/Tooling:
.github/workflows/linters.ymlto useuv sync --group linterfor dependency installation, improving reproducibility and consistency for linting tools.## DescriçãoMudanças Propostas
Checklist de Revisão
Comentários Adicionais (opcional)
Issue Relacionada
Closes #<numero_da_issue>