Skip to content
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

New validation rules and refactoring #23

Merged
merged 17 commits into from
Mar 14, 2024
Merged

New validation rules and refactoring #23

merged 17 commits into from
Mar 14, 2024

Conversation

SmetDenis
Copy link
Member

This commit updates the GitHub Actions workflows by adding a new "test-phar" job for verifying the functionality of the PHAR binary. The names and actions of existing jobs were updated to be more informative. The README file was also cleaned up for better readability. Changes also included the addition of planned features related to tool versioning.

Denis Smet added 3 commits March 14, 2024 00:54
This commit updates the GitHub Actions workflows by adding a new "test-phar" job for verifying the functionality of the PHAR binary. The names and actions of existing jobs were updated to be more informative. The README file was also cleaned up for better readability. Changes also included the addition of planned features related to tool versioning.
Added distinct Docker run actions for valid and invalid CSV file validation in the GitHub workflows main.yml file. Extended the workflow steps to individually deal with valid and invalid CSV files. Related image and volume parameters have been adjusted accordingly to run the validation tests properly.
@coveralls
Copy link

coveralls commented Mar 13, 2024

Pull Request Test Coverage Report for Build 8273211644

Details

  • 160 of 169 (94.67%) changed or added relevant lines in 36 files are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage decreased (-0.4%) to 94.942%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/Rules/AllMustContain.php 7 8 87.5%
src/Rules/AtLeastContains.php 7 8 87.5%
src/Rules/IsAlias.php 5 6 83.33%
src/Rules/StrEndsWith.php 5 6 83.33%
src/Rules/StrStartsWith.php 5 6 83.33%
src/Utils.php 3 4 75.0%
src/Validators/CsvValidator.php 51 54 94.44%
Files with Coverage Reduction New Missed Lines %
src/Csv/CsvFile.php 1 87.5%
Totals Coverage Status
Change from base Build 8271177323: -0.4%
Covered Lines: 657
Relevant Lines: 692

💛 - Coveralls

Denis Smet added 11 commits March 14, 2024 01:14
The commit updates the versions of PHPStan and Roave/SecurityAdvisories in the composer.lock file. Both libraries have been upgraded to newer versions, with the reference and URL addresses correspondingly updated. This ensures that the project is using the most recent
The order of operations in the csv-blueprint.php file was modified to include the JBZOO_AUTOLOAD_FILE at the beginning of the iteration. Previously it was included right before setting the default timezone, potentially causing issues if certain elements needed in the iteration were not loaded properly.
The table rendering in ErrorSuite.php has been refactored to dynamically set column sizes based on terminal width rather than using fixed widths. A new method getTableSize() has been added to calculate and return the sizes. The relevant tests and documentation in README.md, have been adjusted to reflect these changes.
Adjusted the column size handling in ErrorSuite.php to use 'COLUMNS_TEST' instead of 'COLUMNS' for improved testing flexibility. Also applied changes to Makefile and phpunit.xml.dist files to align with the modification made in ErrorSuite.
Reorganized and refactored the architecture of Validators and Rules within the codebase. The Rules were moved under the base namespace rather than under Validators. Additionally, implemented the ColumnValidator and ScvValidator, and refactored the abstract base Validator class into AbstractValidator. Adjustments were also applied to unit tests receiving the impact of these changes, ensuring comprehensive test coverage over the refactored structure.
… maintainability and clarity.

The validation code in `CsvFile` has been refactored to a new class, `CsvValidator`, for better encapsulation and readability. The use statements in `CsvFile` and `Column` classes have been updated to reflect these changes. The `AbstractValidator` has been removed for simplicity, hence, `ColumnValidator` and `CsvValidator` classes no longer extend it. Furthermore, a typo in the `CsvValidator` filename was corrected. The commit aims to make the validation process easier to maintain and understand.
Added new rules for minimum and maximum precision in the schema files and created corresponding validation logic in the PHP files. Updated test files to include tests for these new rules. Enhanced the precision functionality in the schema files and reflected these changes in the README for clarity.
Clarified precision rules in both full schema and README file by adding a note about inclusion of zeroes in minimum and maximum precision calculations. This will ensure the users understand this particular aspect when dealing with precision logic.
Introduced new validation rules related to string content and word count. The changes include rules for word counting, string beginning and ending content, and required content presence in strings. These modifications expand the ability of the library to perform more intricate validations, aiding in ensuring data consistency and accuracy in CSV files.
@SmetDenis SmetDenis changed the title Refactoring New validation rules and refactoring Mar 13, 2024
Denis Smet added 3 commits March 14, 2024 03:44
Updated method signatures across codebase to remove nullable string types for validation input. These changes ensure consistency in handling input values from CSV files. The prior handling could potentially lead to null value related errors, thus this update improves the overall stability of the CSV validation process.
A new validation rule is_alias has been added to the schema examples in the full.json, full.php and full.yml files. Due to this addition, a new IsAlias.php file is created under src/Rules, which will validate the aliases present in these files. This function is also tested in Blueprint/RulesTest.php.
Error messages have been added to return statements in the AllMustContain, AtLeastContains, StrEndsWith, and StrStartsWith rules when no value or an empty value is provided in the schema files. This results in more informative feedback. Additionally, corresponding tests have been instituted in the RulesTest.php file to verify the functioning of these updates.
@SmetDenis SmetDenis merged commit 1baf221 into master Mar 14, 2024
1 check passed
@SmetDenis SmetDenis deleted the refactorig branch March 14, 2024 00:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants