chillerlan / php-qrcode

A PHP QR Code generator and reader with a user-friendly API.
https://smiley.codes/qrcode/
Apache License 2.0
2.02k stars 302 forks source link

Add PHP-CS fixer and lint the codebase #56

Closed X-Coder264 closed 3 years ago

X-Coder264 commented 3 years ago

The current codebase currently has a very old codestyle. This PR brings it up to speed so that it's PSR-2 compliant.

codecov-io commented 3 years ago

Codecov Report

Merging #56 (b7abcc9) into main (905c71b) will increase coverage by 0.00%. The diff coverage is 99.87%.

Impacted file tree graph

@@            Coverage Diff            @@
##               main      #56   +/-   ##
=========================================
  Coverage     99.87%   99.87%           
  Complexity      349      349           
=========================================
  Files            17       17           
  Lines           778      779    +1     
=========================================
+ Hits            777      778    +1     
  Misses            1        1           
Impacted Files Coverage Δ Complexity Δ
src/Output/QRMarkup.php 98.24% <98.24%> (+0.03%) 20.00 <20.00> (ø)
src/Data/AlphaNum.php 100.00% <100.00%> (ø) 5.00 <5.00> (ø)
src/Data/Byte.php 100.00% <100.00%> (ø) 2.00 <2.00> (ø)
src/Data/Kanji.php 100.00% <100.00%> (ø) 8.00 <8.00> (ø)
src/Data/MaskPatternTester.php 100.00% <100.00%> (ø) 49.00 <49.00> (ø)
src/Data/Number.php 100.00% <100.00%> (ø) 8.00 <8.00> (ø)
src/Data/QRDataAbstract.php 100.00% <100.00%> (ø) 28.00 <28.00> (ø)
src/Data/QRMatrix.php 100.00% <100.00%> (ø) 97.00 <97.00> (ø)
src/Helpers/BitBuffer.php 100.00% <100.00%> (ø) 8.00 <8.00> (ø)
src/Helpers/Polynomial.php 100.00% <100.00%> (ø) 17.00 <17.00> (ø)
... and 7 more

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 905c71b...b7abcc9. Read the comment docs.

codemasher commented 3 years ago

nope. i refuse to adhere to PSR-1/12 as it is an incnosistent outdated mess.

X-Coder264 commented 3 years ago

PSR-12 became the new standard in August last year and it replaced PSR-2 so I don't see how it could possibly be "outdated". It's so fresh that PHP-CS fixer doesn't even have all PSR-12 fixers implemented yet. Also most of the community uses PSR-2/12. If it was that bad nobody would use it, but whatever, your lib - your choice of codestyle.

codemasher commented 3 years ago

Just as a clarification: PSR-1 (and 12) don't add any value - not even the always proclaimed "ease of collaboration" - and it starts only with spaces over tabs, a lot of which the working group could have fixed in PSR-12. In this essay i will

codemasher commented 3 years ago

Also a reminder that not because "everyone is using/adhering to it" does make something actually good.

X-Coder264 commented 3 years ago

I'm not saying that just because everyone is adhering to it that it's good. Unlike you I don't think those PSRs are bad at all. You say that they don't bring any value, not even easier collaboration. I strongly disagree. As a regular Laravel and Symfony contributor (both of which adhere to those PSRs) when I open this codebase it looks messy as hell at first (because it's different compared to those codebases). That makes code harder to read and that makes it harder to understand which makes it harder to contribute to. Also since this is a "custom" codestyle it's hard to enforce it which potentially leads to a lot of review comments from you as a maintainer to the PR author. That just wastes both your time and the PR author's time. And there is no easy way for the PR author to just run something which fixes these problems automatically like PHP-CS fixer.

I don't have any intentions of discussing this further as it's pointless.

codemasher commented 3 years ago

Look, i've been maintaining this library for years now and this is the first complaint about the code style i've received. I understand that it might be your preference to adhere to a code style that actually makes it harder to read and edit code but somehow is accepted by the community. However, anyone who has contributed code to this library before did not only seem to have no problems to understand the codebase, but also adhere to the code style i chose. Not to mention: the codebase is modern, as in bleeding edge modern - the choice to ignoring PSR-1/12 should be notable. What i might do at some point is to add a PHPStorm options file so that others could use the same code style in their forks. And i will die on that hill.