-
Notifications
You must be signed in to change notification settings - Fork 3
chore: phpcs using config in github actions, restore: phpcs.xml.dist #26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+63
−1
Merged
Changes from 2 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| <?xml version="1.0"?> | ||
| <ruleset name="Project PSR-12 Style Only"> | ||
| <description> | ||
| PSR-12 als Basis, aber alle „logiknahen“ Regeln (Namespaces, Side Effects, | ||
| Strict Types, Typ-Decls etc.) sind deaktiviert. Es bleiben vor allem | ||
| Whitespace- und Formatierungsregeln übrig. | ||
| </description> | ||
|
|
||
| <!-- Was nie geprüft werden soll --> | ||
| <exclude-pattern>includes/external/*</exclude-pattern> | ||
|
|
||
| <!-- Basis: kompletter PSR-12 Standard --> | ||
| <rule ref="PSR12"/> | ||
|
|
||
| <!-- ========= | ||
| LOGIK-/STRUKTUR-REGELN DEAKTIVIEREN | ||
| ========= --> | ||
|
|
||
| <!-- Side Effects & "1 Klasse pro Datei + Namespace" --> | ||
| <rule ref="PSR1.Files.SideEffects"> | ||
| <severity>0</severity> | ||
| </rule> | ||
|
|
||
| <rule ref="PSR1.Classes.ClassDeclaration"> | ||
| <severity>0</severity> | ||
| </rule> | ||
|
|
||
| <!-- declare(strict_types=1) & Co. --> | ||
| <rule ref="PSR12.Files.DeclareStatement"> | ||
| <severity>0</severity> | ||
| </rule> | ||
|
|
||
| <!-- Typed Parameter & Return Types --> | ||
| <rule ref="PSR12.Functions.NullableTypeDeclaration"> | ||
| <severity>0</severity> | ||
| </rule> | ||
|
|
||
| <rule ref="PSR12.Functions.ReturnTypeDeclaration"> | ||
| <severity>0</severity> | ||
| </rule> | ||
|
|
||
| <!-- Kurzformen von Typkeywords (bool/int/...) --> | ||
| <rule ref="PSR12.Keywords.ShortFormTypeKeywords"> | ||
| <severity>0</severity> | ||
| </rule> | ||
|
|
||
| <!-- Namespace-Struktur --> | ||
| <rule ref="PSR12.Namespaces.CompoundNamespaceDepth"> | ||
| <severity>0</severity> | ||
| </rule> | ||
|
|
||
| <!-- Sichtbarkeit von Konstanten erzwingen (kann Backward Compatibility sein) --> | ||
| <rule ref="PSR12.Properties.ConstantVisibility"> | ||
| <severity>0</severity> | ||
| </rule> | ||
|
|
||
| <!-- Optional: Wenn du noch mehr "Logik-Nähe" rauswerfen willst, | ||
| kannst du hier weitere Sniffs nach Bedarf auf severity=0 setzen. --> | ||
|
|
||
| <!-- Nur Infos: Warnungen kannst du komplett ausblenden, wenn du magst --> | ||
| <!-- <arg name="warning-severity" value="0"/> --> | ||
| </ruleset> |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ich denke, dass das so noch keine gute Idee ist. Wenn ich das zum Test ausführe erhalte ich folgende Meldung.
PHP CS FIXER
PHPCS
php cs fixernicht gesagt, gegen welche Regel hier verstoßen wird und ...Meine aktuelle Meinung ist:
php cs fixerist eine gute Idee und funktioniert auch aber für eine reine Prüfung im Pull Request bietetphpcsden klareren Vorteil dass es exakt benennt welche Regel verletzt wurde und in welcher Zeile.php cs fixerzeigt im dry run zwar die Änderungen die nötig wären doch es liefert nur den Patch ohne die konkrete Regel dahinter. Hier ist z.B. nicht sichtbar, dass das Problem das Leerzeichen am Ende war. Für Reviewer ist das weniger eindeutig weil man zwar sieht dass etwas geändert werden müsste jedoch nicht warum.phpcsliefert dagegen eine saubere Meldung mit Sniff Name Dateiangabe und Zeile wodurch Verstöße sofort nachvollziehbar werden und sich schneller korrigieren lassen. Genau diese klare Zuordnung machtphpcsals reines Prüfwerkzeug in der CI aus meiner Sicht besser.Ich muss aber auch sagen, dass ich nicht weiß, ob sich das mit
php cs fixernachbilden lässt.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bekommen wir einen lauffähigen Zustand wieder her? 😉
Ich bin da gerade ein wenig überfordert und auf eure Expertise angewiesen.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Tomcraft1980 Werden wir bekommen. Ich würde gerne noch abwarten was @dgodglueck sagt. Aktuell finde ich "meine" Variante noch besser, aber ich habe die Weisheit nicht gepachtet. Vielleicht hat er noch einen guten Einwand.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ich danke euch beiden sehr! 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mit dem jetzigen PR wird alles wieder passen 👍
Ich finde tatsächlich die Lösung mit dem phpcs Tool auch übersichtlicher, und macht am Ende das gleiche, wieder was neues gesehen und gelernt
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hatten wir mal zur Demo, aber es bezieht noch nicht die
phpcs.xml.distim Root Verzeichnis mit ein. Da diephpcs.xml.disterst später hinzugekommen ist als "Beispiel".Man könnte es also so anpassen, dass man
phpcsstatt der Option--standard=PSR12die Dateiphpcs.xml.distmitgibt. Ich glaube man kann--standard=PSR12als Option einfach weglasse und dann nimmt er automatisch diephpcs.xml.distaus dem Root. Aber für die CLI wäre es vielleicht leichter oder besser verständlich / leserlicher, wenn man direkt sagt, er soll diephpcs.xml.distnehmen.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hinweis: Es geht
phpcs.xml.distals auch.phpcs.xml.dist(mit Punkt) wir haben glaube ich OHNE Punkt.Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@RobinTheHood soweit ich verstanden habe, werden die Tools im Rootverzeichnis ausgeführt, wo auch die phpcs.xml.dist liegt, aber ich hatte mit dem cs-fixer identisch Problem. Also wenn ich die Konfiguration nicht explizit angebe, dass das Tool (beliebiges) sagt es benötigt eine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dgodglueck Ich glaube du schreibst aktuell den Dateinahmen mit Punkt
--standard=.phpcs.xml.distmüsste wohl aber--standard=phpcs.xml.distohne Punkt sein.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ups 🤦🏼♂️, korrigiert