Skip to content

Commit

Permalink
New validation rules and refactoring (#33)
Browse files Browse the repository at this point in the history
  • Loading branch information
SmetDenis committed Mar 16, 2024
1 parent 25a9dd4 commit 06d62ce
Show file tree
Hide file tree
Showing 116 changed files with 3,794 additions and 2,272 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ build: ##@Project Install all 3rd party dependencies

build-install: ##@Project Install all 3rd party dependencies as prod
$(call title,"Install/Update all 3rd party dependencies as prod")
@composer install --no-dev --no-progress --no-interaction --no-suggest
@composer install --no-dev --no-progress --no-interaction --no-suggest --optimize-autoloader
@rm -f `pwd`/ci-report-converter


Expand Down
353 changes: 189 additions & 164 deletions README.md

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@
"jbzoo/utils" : "^7.1",
"jbzoo/ci-report-converter" : "^7.2",
"league/csv" : "^9.15",
"symfony/yaml" : "^6.4.3",
"symfony/filesystem" : "^6.4",
"symfony/finder" : "^6.4"
"symfony/yaml" : ">=6.4",
"symfony/filesystem" : ">=6.4",
"symfony/finder" : ">=6.4"
},

"require-dev" : {
Expand All @@ -56,7 +56,7 @@
},

"config" : {
"optimize-autoloader" : true,
"optimize-autoloader" : false,
"allow-plugins" : {"composer/package-versions-deprecated" : true},
"platform-check" : true
},
Expand Down
32 changes: 15 additions & 17 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

33 changes: 33 additions & 0 deletions psalm.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!--
JBZoo Toolbox - Csv-Blueprint.
This file is part of the JBZoo Toolbox project.
For the full copyright and license information, please view the LICENSE
file that was distributed with this source code.
@license MIT
@copyright Copyright (C) JBZoo.com, All rights reserved.
@see https://github.com/JBZoo/Csv-Blueprint
-->
<psalm
errorLevel="1"
reportMixedIssues="false"
useDocblockPropertyTypes="true"
resolveFromConfigFile="false"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="https://getpsalm.org/schema/config"
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
>
<projectFiles>
<directory name="src"/>
</projectFiles>

<issueHandlers>
<InvalidClassConstantType>
<errorLevel type="suppress">
<directory name="src/Rules"/>
</errorLevel>
</InvalidClassConstantType>
</issueHandlers>
</psalm>
31 changes: 19 additions & 12 deletions schema-examples/full.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,37 +18,44 @@
"allow_values" : ["y", "n", ""],
"regex" : "\/^[\\d]{2}$\/",
"length" : 5,
"length_not" : 4,
"length_min" : 1,
"length_max" : 10,
"is_trimed" : true,
"is_lowercase" : true,
"is_uppercase" : true,
"is_capitalize" : true,
"word_count" : 10,
"word_count" : 5,
"word_count_not" : 4,
"word_count_min" : 1,
"word_count_max" : 5,
"word_count_max" : 10,
"contains" : "Hello",
"contains_one" : ["a", "b"],
"contains_all" : ["a", "b", "c"],
"starts_with" : "prefix ",
"ends_with" : " suffix",
"min" : 10,
"max" : 100.5,
"precision" : 3,
"precision_min" : 2,
"precision_max" : 4,
"date" : "2000-01-10",
"num" : 5,
"num_not" : 4,
"num_min" : 1,
"num_max" : 10,
"precision" : 5,
"precision_not" : 4,
"precision_min" : 1,
"precision_max" : 10,
"date" : "01 Jan 2000",
"date_not" : "2006-01-02 15:04:05 -0700 Europe\/Rome",
"date_min" : "+1 day",
"date_max" : "now",
"date_format" : "Y-m-d",
"date_min" : "2000-01-02",
"date_max" : "+1 day",
"is_date" : true,
"is_bool" : true,
"is_int" : true,
"is_float" : true,
"is_ip" : true,
"is_ip4" : true,
"is_url" : true,
"is_email" : true,
"is_domain" : true,
"is_uuid4" : true,
"is_uuid" : true,
"is_alias" : true,
"is_latitude" : true,
"is_longitude" : true,
Expand Down
45 changes: 23 additions & 22 deletions schema-examples/full.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,16 @@

return [
'filename_pattern' => '/demo(-\\d+)?\\.csv$/i',

'csv' => [
'csv' => [
'header' => true,
'delimiter' => ',',
'quote_char' => '\\',
'enclosure' => '"',
'encoding' => 'utf-8',
'bom' => false,
],

'columns' => [
[
0 => [
'name' => 'Column Name (header)',
'description' => 'Lorem ipsum',
'rules' => [
Expand All @@ -36,54 +34,57 @@
'allow_values' => ['y', 'n', ''],
'regex' => '/^[\\d]{2}$/',
'length' => 5,
'length_not' => 4,
'length_min' => 1,
'length_max' => 10,
'is_trimed' => true,
'is_lowercase' => true,
'is_uppercase' => true,
'is_capitalize' => true,
'word_count' => 10,
'word_count' => 5,
'word_count_not' => 4,
'word_count_min' => 1,
'word_count_max' => 5,
'word_count_max' => 10,
'contains' => 'Hello',
'contains_one' => ['a', 'b'],
'contains_all' => ['a', 'b', 'c'],
'starts_with' => 'prefix ',
'ends_with' => ' suffix',
'min' => 10,
'max' => 100.5,
'precision' => 3,
'precision_min' => 2,
'precision_max' => 4,
'date' => '2000-01-10',
'num' => 5,
'num_not' => 4,
'num_min' => 1,
'num_max' => 10,
'precision' => 5,
'precision_not' => 4,
'precision_min' => 1,
'precision_max' => 10,
'date' => '01 Jan 2000',
'date_not' => '2006-01-02 15:04:05 -0700 Europe/Rome',
'date_min' => '+1 day',
'date_max' => 'now',
'date_format' => 'Y-m-d',
'date_min' => '2000-01-02',
'date_max' => '+1 day',
'is_date' => true,
'is_bool' => true,
'is_int' => true,
'is_float' => true,
'is_ip' => true,
'is_ip4' => true,
'is_url' => true,
'is_email' => true,
'is_domain' => true,
'is_uuid4' => true,
'is_uuid' => true,
'is_alias' => true,
'is_latitude' => true,
'is_longitude' => true,
'is_geohash' => true,
'is_cardinal_direction' => true,
'is_usa_market_name' => true,
],

'aggregate_rules' => [
'is_unique' => true,
],
],

['name' => 'another_column'],

['name' => 'third_column'],

['name' => 'another_column'],
['name' => 'third_column'],
['description' => 'Column with description only. Undefined header name.'],
],
];
Loading

0 comments on commit 06d62ce

Please sign in to comment.