Review main Merged

75549[TASK] Ensure php files contain correct legal file header

Stefan Bürk CR +2 V +2 Hard +253 −21 updated 08/26/22, 18:22

Commit message

Core php file header check got silently be disabled. Since
then the one or other file header error has slipped into
the core. It also pops up from time to time in reviews of
patches that file headers are missing (or are wrong).

This change ensures that file headers are checked again
and can be fixed by given contributers the proper tools
at hand.

Changes:

* add cglFixMyCommitFileHeader.(sh|bat)
* add cglHeader and cglHeaderGit to runTests.sh along
  with proper help text
* extend pre-commit hook to execute both fixer scripts
  side-by-side with error output and fixing possibility
* fix minor issue with header comment php-cs-fixer config

Additionally the cglHeader check is added to gitlab workflow
pre-merge (commit files) and nightly (all files).

Slipped in errors has been fixed with a dedicated change #98204.

Review

  • Code review CR +2 Done
    • Stefan Bürk +2
    • Benjamin Franzke +1
    • Christian Kuhn +1
    • Andreas Kienast +1
  • Verified V +2 Done
    • Stefan Bürk +2
    • Benjamin Franzke +1
    • Christian Kuhn +1
    • Andreas Kienast +1
    • core-ci +1 CI

Issues 2

Files 8

Review log 2331

Show 36 earlier messages
  1. Stefan Bürk uploaded patch set 1 08/25/22, 08:29

  2. core-ci voted on patch set 1 V +1 08/25/22, 08:37 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/30437

  3. Stefan Bürk commented on patch set 1 08/25/22, 08:40

    Needs pre-patch to fix already errors in core files which will crash otherwise nightly). To verify this, running nightly on it: https://git.typo3.org/typo3/CI/cms/-/pipelines/30438
  4. core-ci voted on patch set 1 V -1 08/25/22, 09:08 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/30438

  5. Stefan Bürk uploaded patch set 2 08/25/22, 09:22

  6. core-ci voted on patch set 2 V +1 08/25/22, 09:31 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/30439

  1. Stefan Bürk uploaded patch set 3 08/25/22, 09:49

  2. Stefan Bürk updated the commit message in patch set 4 08/25/22, 09:51

  3. Stefan Bürk commented on patch set 4 CR -1 08/25/22, 09:52

    Reply

    -1 until pre-patch has been merged
  4. core-ci voted on patch set 3 V +1 08/25/22, 09:57 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/30441

  5. core-ci voted on patch set 4 V +1 08/25/22, 09:59 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/30442

  6. Benjamin Franzke uploaded patch set 5 08/25/22, 12:07

  7. core-ci voted on patch set 5 V +1 08/25/22, 12:16 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/30445

  8. Benjamin Franzke commented on patch set 5 08/25/22, 12:20

    Reply

    Done
  9. Stefan Bürk commented on patch set 5 08/25/22, 13:57

    Thanks Benjamin for rebase/fix. Re-running nightly to be safe: https://git.typo3.org/typo3/CI/cms/-/pipelines/30446
  10. core-ci commented on patch set 5 08/25/22, 14:20 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/30446

  11. Christian Kuhn commented on patch set 5 08/25/22, 16:15

    integrity.yml:29

    maybe merge into the 'various' job below to save one job?
  12. Stefan Bürk commented on patch set 5 08/25/22, 16:26

    integrity.yml:29 Reply

    Ack. But I think it is better to move it into the "cgl" as second cgl check. Original added as dedicated job to get hidden by a prior failures.
  13. Stefan Bürk uploaded patch set 6 08/25/22, 16:28

  14. Stefan Bürk commented on patch set 6 08/25/22, 16:28

    integrity.yml:29 Reply

    Moved it into "cgl".
  15. core-ci voted on patch set 6 V +1 08/25/22, 16:35 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/30447

  16. Benjamin Franzke voted on patch set 6 V +1 CR +1 08/25/22, 17:05

  17. Andreas Kienast commented on patch set 6 08/26/22, 05:44

    Something is off here, perhaps that's how php-cs-fixer works that's why I don't give a -1: In one file, I moved the "namespace" line below declare(strict_types=1); and ended up with two headers.
  18. Christian Kuhn commented on patch set 6 08/26/22, 06:20

    Reply

    yeah. that's a php-cs-fixer. stumbled upon that as well already. i fear there isn't much we can do about it?
  19. Christian Kuhn voted on patch set 6 V +1 CR +1 08/26/22, 06:21

  20. Andreas Kienast commented on patch set 6 V +1 CR +1 08/26/22, 07:11

    Reply

    I see, thanks for the clarification.
  21. Nikita Hovratov commented on patch set 6 08/26/22, 16:34

    header-comment.php:58

    isn't this already tested in php-cs-fixer.php ?
  22. Stefan Bürk commented on patch set 6 08/26/22, 17:18

    Reply

    Yeah - thus I removed the old missplaced header by hand after the "fixer" run in the pre-patch.

    header-comment.php:58 Reply

    Yes it is. But it is needed here also, otherwise it has the effect that for example the comment was first and then the declare strict line (and namespace third) it changed that (declare - comment - namespace ) but wrong count of spacelines. Thus executing the normal fixer script afterwards it would fix something again. Added this here to avoid the additional roundtrip if the header run fixes/moves that and having the full style check "first". Special for local "pre-commit" hook execution.
  23. Stefan Bürk voted on patch set 6 V +2 CR +2 08/26/22, 17:19

  24. Stefan Bürk merged patch set 7 08/26/22, 17:19

  25. Nikita Hovratov commented on patch set 7 08/26/22, 18:22

    header-comment.php:58 Reply

    thanks for the explanation