sspooky13 / yaml-standards Goto Github PK
View Code? Open in Web Editor NEWStandards for yaml files - adhere your yaml clean and nice
License: MIT License
Standards for yaml files - adhere your yaml clean and nice
License: MIT License
Which version(s) is affected: ^4.0.0
Description
Yaml standards don't work with new lines after comment. The suggest a change to remove all indentation before the comment. see Additional information
How to reproduce
Possible Solution
Additional information
eg. this:
ObjectCalisthenics\Sniffs\Files\FunctionLengthSniff:
maxLength: 60
#sdkjfhsdkjfhsk
ObjectCalisthenics\Sniffs\Metrics\PropertyPerClassLimitSniff:
maxCount: 30
suggests this:
ObjectCalisthenics\Sniffs\Files\FunctionLengthSniff:
maxLength: 60
- #sdkjfhsdkjfhsk
+#sdkjfhsdkjfhsk
ObjectCalisthenics\Sniffs\Metrics\PropertyPerClassLimitSniff:
maxCount: 30
Description
Appveyor build not working for PHP <7.3, at least in PR
Description
It will be great check/fix only changed files not only all files.
Description
clearly: create fixer for yaml space between groups
Description
Arguments can be defined in 2 ways: gradually or specifically. So, we should observe one way.
Example
Gradually
Foo\FooBundle\FooFacade:
arguments:
- '%arg_1%'
- '%arg_2%'
- '%arg_3%'
Specifically
Foo\FooBundle\FooFacade:
arguments:
$pathToDir: '%arg_1%'
$pathToFile: '%arg_2%'
$pathToImage: '%arg_3%'
Description
New standard for check (and fix) every y(a)ml file have empty line in end of file
Which version(s) is affected: >3.1.0
Description
It should be space before dash in array, see example below. By yaml the code is valid but causes it inconsistent code because, it can be space before dash and may not be.
How to reproduce
Add e.g. one of this code to yaml file and check indent
foo:
- foo: bar
baz: qux
foo:
- foo: bar
it should be space before dash
Description
create fixer for yaml alphabetical checker.
As first, this feature #29 must be done.
Example
One row
foo:
{ bar: baz, qux: quux, quuz: corge }
Multiple rows
foo:
bar: baz
qux: quux
quuz: corge
Description
Create unit tests for yaml indent data factory
Description
At this moment if file is not readable you will not be noticed because array with results will be reseted
Possible Solution
Add not readable file directly to all results array
Description
Create class for load and return checkers (and fixers?) in array by inputSettingData
Example
Separate checkers (https://github.com/sspooky13/yaml-standards/blob/master/src/Command/YamlCommand.php#L67-L70) to separate class and return them in array. Then use foreach for check all files (https://github.com/sspooky13/yaml-standards/blob/master/src/Command/YamlCommand.php#L91-L105)
Description
It will be great to add build app with PHP 8.2 to sure all works well
Description
Create unit tests for yaml inline checker
Which version(s) is affected: ^5.0
Description
Symfony 5 can't be built because shopsys/coding-standards
locked symplify/easy-coding-standard
to ^5
version and this version locked symfony
to version ^3.4|^4.1
You can see in there https://travis-ci.org/sspooky13/yaml-standards/jobs/644890349
Possible Solution
symplify/easy-coding-standard
but I will have to upgrade easy-coding-standard.yml
manuallyshopsys/coding-standards
yet satisfied ๐shopsys/coding-standards
and use it + create PR for upgradeWhich version(s) is affected: 4.0.0
Description
When installing as a dev dependency of another project PHPParralelLint
is not included, as it is not defined in the composer file. Currently it's only included as it's a dependency of shopsys/coding-standards
, so will only exist on dev installs.
How to reproduce
composer init
composer require --dev sspooky13/yaml-standards
php vendor/bin/yaml-standards ./directory
You'll get the following error:
PHP Fatal error: Uncaught Error: Class 'JakubOnderka\PhpParallelLint\RecursiveDirectoryFilterIterator' not found in {project folder}/vendor/sspooky13/yaml-standards/src/Service/YamlFilesPathService.php:28
Possible Solution
Include this dependency in the composer file - will raise a PR for this shortly.
Additional information
Hope you don't mind me raising this - currently this is blocking me from using your tool on a personal project, so would be great to get this in. Do you mind me picking up some of the other issues on this repo if I've time after this is resolved?
Description
Create unit tests for yaml alphabetical checker
Description
use symfony style component for better console output
Example
$io = new SymfonyStyle($input, $output);
$io->text('Lorem ipsum dolor sit amet');
Description
add help description for yaml command but i don't know what I should write to it ๐
Example
// the full command description shown when running the command with
// the "--help" option
->setHelp('Any text that might be useful...')
Description
The goal is create additional standard:
Warning! First #29 must be done
Description
Create fixer for yaml indent check for convenience work with standards
Description
It's important do this issue before make fixers because there could be mess in code
what is need to refactor:
BTW: fix bad description
https://github.com/sspooky13/yaml-standards/blob/master/src/YamlCommand.php#L37
Description
"symfony/http-kernel" is used only to check which symfony version is used (I think). It should be used PHP function method_exists instead
Description
It would be great return and make new tests for methods.
Is recommended add coveralls.io into project.
Description
fix build in travis and appveyor for lowest dependencies
Example
environment:
matrix:
# - dependencies: lowest
# php_version: 5.6
- dependencies: highest
php_version: 5.6
# - dependencies: lowest
# php_version: 7.0
- dependencies: highest
php_version: 7.0
# - dependencies: lowest
# php_version: 7.1
- dependencies: highest
php_version: 7.1
# - dependencies: lowest
# php_version: 7.2
- dependencies: highest
php_version: 7.2
Description
Just idea. Command exclude all yaml files by options, .gitignore files and .dockerignore files because, if these files are ignored then I don't want to check it.
Description
Function to find files recursively by wildcards looks not good, so it would be great to do refactoring on it.
P.S.: glob can return false so it exists potential issue on this function can return false instead of array.
Description
The goal is to create functionality to load config for every dir/file with declared parameters (deep for check space between groups, indent count, etc.)
Example
It will look very similar like https://github.com/mhujer/yaml-sort-checker/blob/master/docs/symfony-config/yaml-sort-checker.yml
Description
EDIT: I don't know how to simply build all Symfony versions so I skip it because it's not necessary to do it
EDIT2: I figured how to do it, so I maked it ๐, done
Hi,
I think, comment line should be ignored and not idented ?
For example :
framework:
validation:
email_validation_mode: html5
# Enables validator auto-mapping support.
# For instance, basic validation constraints will be inferred from Doctrine's metadata.
#auto_mapping:
# App\Entity\: []
when@test:
framework:
validation:
not_compromised_password: false
What do you think about that ?
Ty
Description
It will be great run Travis build on Linux, OSX, and Windows. If Travis will know build PHP project on windows then Appveyor can be removed because he is very slow.
Windows
https://docs.travis-ci.com/user/reference/windows/
https://travis-ci.community/t/where-to-contribute-php-support-for-windows/304
OSX
https://docs.travis-ci.com/user/reference/osx/
travis-ci/travis-ci#2313
https://github.com/kiler129/TravisCI-OSX-PHP
Which version(s) is affected: 8.0.0.
Description
Warning:
Use of undefined constant GLOB_BRACE - assumed 'GLOB_BRACE'
(this will throw an Error in a future version of PHP) in /srv/sylius/vendor/sspooky13/yaml-standards/src/Command/Service/FilesPathService.php on line 38
Fatal error: Uncaught TypeError:glob() expects parameter 2 to be int, string given
in /srv/sylius/vendor/sspooky13/yaml-standards/src/Command/Service/FilesPathService.php:38
Warning: Use of undefined constant GLOB_BRACE - assumed 'GLOB_BRACE' (this will throw an Error in a future version of PHP) in /srv/sylius/vendor/sspooky13/yaml-standards/src/Command/Service/FilesPathService.php on line 38
Fatal error: Uncaught TypeError: glob() expects parameter 2 to be int, string given in /srv/sylius/vendor/sspooky13/yaml-standards/src/Command/Service/FilesPathService.php:38
Stack trace:
#0 /srv/sylius/vendor/sspooky13/yaml-standards/src/Command/Service/FilesPathService.php(38): glob('./*{.yml,.yaml,...', 'GLOB_BRACE')
#1 /srv/sylius/vendor/sspooky13/yaml-standards/src/Command/Service/FilesPathService.php(20): YamlStandards\Command\Service\FilesPathService::globRecursive('./*{.yml,.yaml,...')
#2 /srv/sylius/vendor/sspooky13/yaml-standards/src/Model/Config/YamlStandardConfigLoader.php(43): YamlStandards\Command\Service\FilesPathService::getPathToFiles(Array)
#3 /srv/sylius/vendor/sspooky13/yaml-standards/src/Model/Config/YamlStandardConfigLoader.php(31): YamlStandards\Model\Config\YamlStandardConfigLoader->createConfigData(Array)
#4 /srv/sylius/vendor/sspooky13/yaml-standards/src/Command/YamlCommand.php(51): YamlStandards\Model\Config\YamlStandardConfigLoader->loadFromYaml('./yaml-standard...')
#5 /srv/sylius/vendor/symfo in /srv/sylius/vendor/sspooky13/yaml-standards/src/Command/Service/FilesPathService.php on line 38
How to reproduce
call yaml-standard bin from docker with alpine linux
Possible Solution
Handle possiblity of GLOB_BRACE
missing.
https://www.php.net/manual/en/function.glob.php
Additional information
zendframework/zend-stdlib#58
zend-stdlib has fallback glob for this exact issue https://github.com/zendframework/zend-stdlib/blob/6d965efcce81ee60e2b425792f1cd3f27aed82d9/src/Glob.php#L39-L46
Description
Modify tests for support yaml format
Example
Same row
foo:
- bar
- baz: qux
- { bar: baz, qux: quux, quuz: corge }
Separate row
foo:
-
bar
-
baz: qux
-
{ bar: baz, qux: quux, quuz: corge }
Which version(s) is affected: all
Description
If you create multidimensional array without array key then checker/fixer don't work correctly
How to reproduce
e.g. this yaml
patchesJson6902:
- target:
group: extensions
version: v1beta1
kind: Ingress
name: shopsys
path: ./ingress-patch.yaml
checker/fixer want fix to this
patchesJson6902:
- target:
group: extensions
version: v1beta1
kind: Ingress
name: shopsys
path: ./ingress-patch.yaml
and it's incorrect.
See shopsys/shopsys#539 (comment) for better detail
Description
make common classes (services) for same code is used in methods (e.g. is line a comment)
Example
protected function isCommentLine($fileLine)
{
return preg_match('/^\s*#/', $fileLine) === 1;
}
Description
Create unit tests for yaml space between groups checker
Description
Someone may wanna find only files with specific name, e.g. services but now he can only find all yaml file in directory
Which version(s) is affected: maybe in all but will be fix in last one
Description
When it's path to non exists dir/file is defined then command write exception
Error was caught: RecursiveDirectoryIterator::__construct(/var/www/html/docker-sync.yml): failed to open dir: No such file or directory
Solution is check file/dir exists before run recursive check dirs
Description
If make sense then will be great to make tests for common classes, etc. command class to prevent not working application
Description
When you are working with Shopsys framework it's really annoying when IDE shows you class is declared in many places but it's only declared 1-2 places (see Image 1)
Example
e.g.: ProductFacade
Description
Add support version PHP 8
Alert
First #47 must be done
Which version(s) is affected: definitely v4.2.4
, maybe older ones as well
Description
There is an issue with array item indentation. When an item is not quoted and contains a colon (:
), it will have 3 spaces after a dash, even though it is not a nested array (might be caused by #27).
See Travis build of shopsys/demoshop
for a real life example: https://travis-ci.org/shopsys/demoshop/builds/569339341#L4564-L4575
How to reproduce
Usual arrays (1 space after dash) โ๏ธ
array_name:
- value
- other value
Nested arrays (3 spaces after a dash) โ๏ธ
array name:
- key: value
other key: value
Arrays with unquoted colons (3 spaces after a dash only when colon is present) โ
array_name:
- value
- http://google.com
- 'http://google.com'
Possible Solution
Additional information
YAML apparently doesn't considers the line a key-value pair only if it is not in quoted string (eg. "key: value"
will not be considered a key-value pair) and there is a space after the colon (eg. key: value
or key : value
but not key:value
or key :value
).
Description
Just idea, in services.yaml can be defined facade but it's not necessary because auto-wire load them, e.g.
Foo\BarBundle\:
resource: '../../**/*{Facade}.php'
FooBarFacade: ~
, so it's not necessary that code exists in services.yaml and it can be removed
Example
- foo: bar
quux: quuz
baz: qux
- baz: qux
foo: bar
quux: quuz
Alert
First #30 must be done
Description
Separate config logic to ruleset file e.g. has PHP_CodeSniffer (https://github.com/squizlabs/PHP_CodeSniffer/blob/master/src/Standards/Squiz/ruleset.xml).
User can add his checker/fixers, more config for standards, etc.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.