Skip to content

Commit

Permalink
Update terminal width for GitHub actions and adjust schema examples
Browse files Browse the repository at this point in the history
This commit adjusts the terminal width configuration in ErrorSuite.php specifically for GitHub actions by adding a condition to set the maximum width to 150. Furthermore, the order of "str_ends_with" and "str_starts_with" properties in full.yml schema example file have been switched. Relevant changes are also echoed in the README.md file.
  • Loading branch information
Denis Smet committed Mar 14, 2024
1 parent 1baf221 commit a91cc5b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ Batch processing
Validation
* [x] ~~`filename_pattern` validation with regex (like "all files in the folder should be in the format `/^[\d]{4}-[\d]{2}-[\d]{2}\.csv$/`").~~
* [ ] Flag to ignore file name pattern. It's useful when you have a lot of files and you don't want to validate the file name.
* [ ] Keyword for null value. Configurable. By default, it's an empty string. But you can use `null`, `nil`, `none`, `empty`, etc.
* [ ] Keyword for null value. Configurable. By default, it's an empty string. But you can use `null`, `nil`, `none`, `empty`, etc. Overridable on the column level.
* [ ] Agregate rules (like "at least one of the fields should be not empty" or "all values must be unique").
* [ ] Handle empty files and files with only a header row, or only with one line of data. One column wthout header is also possible.
* [ ] Using multiple schemas for one csv file.
Expand Down Expand Up @@ -409,6 +409,8 @@ Mock data generation
* [ ] Use [Faker](https://github.com/FakerPHP/Faker) for random data generation.

Reporting
* [ ] Fix auto width of tables in Githu terminal.
* [ ]
* [ ] More report formats (like JSON, XML, etc). Any ideas?
* [ ] Gitlab and JUnit reports must be as one structure. It's not so easy to implement. But it's a good idea.
* [ ] Merge reports from multiple CSV files into one report. It's useful when you have a lot of files and you want to see all errors in one place. Especially for GitLab and JUnit reports.
Expand Down
2 changes: 1 addition & 1 deletion schema-examples/full.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ columns:
max_word_count: 5 # Integer only. Max count of words in the string Example: "Hello World! 123" - 2 words only (123 is not a word)
at_least_contains: [ a, b ] # At least one of the string must be in the CSV value. Case-sensitive.
all_must_contain: [ a, b, c ] # All the strings must be part of a CSV value. Case-sensitive.
str_ends_with: " suffix" # Case-sensitive. Example: "Hello World suffix"
str_starts_with: "prefix " # Case-sensitive. Example: "prefix Hello World"
str_ends_with: " suffix" # Case-sensitive. Example: "Hello World suffix"

# Decimal and integer numbers
min: 10 # Can be integer or float, negative and positive
Expand Down
3 changes: 3 additions & 0 deletions src/Validators/ErrorSuite.php
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,9 @@ private static function getTableSize(): array
// Fallback to 80 if the terminal width cannot be determined.
// env.COLUMNS_TEST usually not defined so we use it only for testing purposes.
$maxAutoDetected = Env::int('COLUMNS_TEST', Cli::getNumberOfColumns());
if (Env::bool('GITHUB_ACTIONS')) {
$maxAutoDetected = 150; // GitHub Actions has a wide terminal
}

$maxWindowWidth = Vars::limit(
$maxAutoDetected,
Expand Down

0 comments on commit a91cc5b

Please sign in to comment.