odan / slim4-skeleton

A Slim 4 Skeleton
https://odan.github.io/slim4-skeleton/
MIT License
439 stars 80 forks source link

Lint PHP files in bin folder #35

Closed ybelenko closed 3 years ago

ybelenko commented 3 years ago

I've noticed that bin folder doesn't exists in most linters configs. I added it to PHP-CS-Fixer, PHP_CodeSniffer and PHPStan configs.

I disabled CSS and JS extensions in PHP_CodeSniffer because I highly doubt that author did that on purpose.

I didn't add bin folder to psalm.xml because Psalm looks abandoned in current project. It's not even presented in Composer dependencies.

Also have a few suggestions about bin/deploy.php script, not related to current PR:

  1. I would rewrite all echo lines with PHP_EOL constant because that way it should add appropriate linebreak char for every OS. Example:
    ---    echo "Check if root: OK\n";
    +++    echo 'Check if root: OK' . PHP_EOL;
  2. I would add suffix 2>&1 to all system calls because with that option it returns error text instead of false value on failure. Example:
    ---    system('sudo vendor/bin/phinx migrate -c config/phinx.php');
    +++    system('sudo vendor/bin/phinx migrate -c config/phinx.php 2>&1');
sonarcloud[bot] commented 3 years ago

Kudos, SonarCloud Quality Gate passed!

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities (and Security Hotspot 0 Security Hotspots to review)
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

odan commented 3 years ago

Usually the content of the bin/ directory and the file public/index.php doesn't change so much or will sometimes change never. The effort to maintain all these extra settings can be more work than the potential problems that could happen. But anyway I merge it :-) Thanks.

ybelenko commented 3 years ago

Also have a few suggestions about bin/deploy.php script, not related to current PR:

  1. I would rewrite all echo lines with PHP_EOL constant because that way it should add appropriate linebreak char for every OS. Example:
---    echo "Check if root: OK\n";
+++    echo 'Check if root: OK' . PHP_EOL;
  1. I would add suffix 2>&1 to all system calls because with that option it returns error text instead of false value on failure. Example:
---    system('sudo vendor/bin/phinx migrate -c config/phinx.php');
+++    system('sudo vendor/bin/phinx migrate -c config/phinx.php 2>&1');

What do you think about that? Makes sense or not?

UPD: @odan Did you forget to add Psalm package to Composer? You have config for it, but no package itself.