hoaproject / Compiler

The Hoa\Compiler library.
https://hoa-project.net/
453 stars 47 forks source link

PSR Support #77

Closed SerafimArts closed 6 years ago

SerafimArts commented 6 years ago

What do you think about supporting generally accepted standards? e.g.: 1) PSR-1 ? 2) PSR-2 ? 3) PSR-12 ?

Now the code of Hoa looks ... In Baroque style and reading it is quite problematic %)

Hywan commented 6 years ago

Hoa already uses PSR-2 standards. Code is fixed by PHP-CS-Fixer by hoa devtools:cs (see https://github.com/hoaproject/Devtools/tree/master/Resource/PHPCSFixer for all configurations and extra fixers).

SerafimArts commented 6 years ago

Hoa already uses PSR-2 standards.

@Hywan Are mutable objects (in particular, the transfer of arguments by reference, like this) are not side effects?

SerafimArts commented 6 years ago

Besides:

Property names SHOULD NOT be prefixed with a single underscore to indicate protected or private visibility.

The fields declared in this way violate the PSR

SerafimArts commented 6 years ago

Other than this, there are other code problems which are not associated with PSR:

1) https://scrutinizer-ci.com/g/SerafimArts/Compiler/?branch=master 2) https://scrutinizer-ci.com/g/SerafimArts/Compiler/code-structure/master

=\

Hywan commented 6 years ago

Hoa already uses PSR-2 standards. @Hywan Are mutable objects (in particular, the transfer of arguments by reference, like this) are not side effects?

This algorithm is particularily difficult to implement, and this is an optimisation. I dare you to build the same algorithm with random PSR conventions.

Property names SHOULD NOT be prefixed with a single underscore to indicate protected or private visibility. The fields declared in this way violate the PSR

“should not”, this is not a “must not” :-). No violation.

Other than this, there are other code problems which are not associated with PSR:

  1. https://scrutinizer-ci.com/g/SerafimArts/Compiler/?branch=master

For what I checked, there are full of jokes, stupid code duplication like this:

screen shot 2017-10-27 at 13 22 38

  1. https://scrutinizer-ci.com/g/SerafimArts/Compiler/code-structure/master

It gives me an empty page, all sections are empty.

I am totally willing to change Hoa's code, but a compiler is difficult to implement and PSR-2 are only about code style, that we respect :-).

SerafimArts commented 6 years ago

This algorithm is particularily difficult to implement, and this is an optimisation. I dare you to build the same algorithm with random PSR conventions.

:D

“should not”, this is not a “must not” :-). No violation.

=\

It gives me an empty page, all sections are empty.

The link leads to the overall statistics of the code, the places that can be improved. Maybe permissions =(

image

This is a free service (e.g. you can create the same inspection for hoa) that improves readability and code support. It sometimes buggy, but very often gives very useful advice (for example, about duplicating the code, as you can see).

Hywan commented 6 years ago

I think Scrutinizer can help having a better quality for sure. However, this issue is related to PSR. I guess we are OK with that. If you feel a boost of energy, you can open on issue on https://github.com/hoaproject/Central related to Scrutinizer. I am sure some @hoaproject/hoackers will take it :-).

Thanks for the reports!