TYPO3 / coding-standards

TYPO3 Coding Standards to be used by TYPO3 projects or extensions
MIT License
52 stars 16 forks source link

[BUGFIX] Skip system/settings.php #117

Closed mbrodala closed 7 months ago

mbrodala commented 8 months ago

The config/system/settings.php is commonly updated through the TYPO3 backend and exported accordingly. Thus coding style standards can and should not be applied here.

bmack commented 8 months ago

What kind of change happened in your use-case that you did not want to happen?

For projects, the config should be set to "src/" (or wherever your PHP files are located), and for extensions the config/system/settings file is usually not available.

mbrodala commented 8 months ago

The change we saw was minimal, an additional newline between <?php and return .... Still, this would be dropped the next time the settings.php is updated via TYPO3 BE, requiring another CS fix.

We do not use src/ in TYPO3 distributions yet but packages/. Aside from that we use __DIR__ to process the whole project so maybe that's the root cause. Sure, with the default __DIR__ . 'src/ one would not get suggestions to fix something in config/.

bmack commented 8 months ago

src/ or packages/ would be highly recommended, otherwise php-cs-fixer might go over your vendor folder :)

mbrodala commented 8 months ago

We usually use a list of directories which should not be processed instead. This way we can be sure that newly added files are covered automatically.

In fact, this very package does that:

https://github.com/TYPO3/coding-standards/blob/b53fc46dc3fc997f98c96bc630d24c1e12028646/src/CsFixerConfig.php#L112

So we're fine. :-)