moodlehq / moodle-cs

Moodle Coding Style
https://github.com/moodlehq/moodle-cs
GNU General Public License v3.0
18 stars 16 forks source link

Expected empty line after the boilerplate check breaks all workplace code #168

Closed marinaglancy closed 5 months ago

marinaglancy commented 5 months ago

Hello! We have a problem with the new moodle-cs

FILE: /home/marina/repositories/workplace/wp404-first/moodle/admin/tool/catalogue/lib.php
------------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
------------------------------------------------------------------------------------------------------------------------------------
 16 | ERROR | [x] Boilerplate comment must be followed by a single blank line or end of file
    |       |     (moodle.Files.BoilerplateComment.SingleTrailingNewLine)
------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------------------------------------------

this fails on every single file in workplace because we have a boilerplate that includes workplace clause

Screenshot from 2024-06-17 09-26-00

our boilerplates look like this and it was perfectly fine before, passed all cs checks. We modified the first line - that this is part of Moodle Workplace and not Moodle and also added our own text in the bottom

stronk7 commented 5 months ago

Just noting that the problem is not the "customisation" in the first line, that continues being allowed as it was, so far.

Instead, the problem is the "extra" boilerplate text after the official one. And the lack of one blank like after the official part (line 16).

I think that what we should do is to:

  1. Allow the "extra" (consecutive) boilerplate to exist, with any contents.
  2. Apply the SingleTrailingNewLine after the extra boilerplate (instead of current "in the middle" behaviour).

Ciao :-)

stronk7 commented 5 months ago

Note that https://github.com/moodlehq/moodle-cs/pull/169 has been created and, hopefully, fixes this.