Skip to content
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

[TASK] Add static code analyser PHPStan as code quality check #262

Merged
merged 1 commit into from May 4, 2024

Conversation

linawolf
Copy link
Member

@linawolf linawolf commented May 1, 2024

The TYPO3 Core and the Best Practice Team recommends
to have a static code analyzer in the defense line,
and preferes PHPStan due to experience with that tool.

This change now adds the static code analyser PHPStan
with a first configurattion and a lower level as a start.
Levels can be raised step by step in follow-ups.

Note: XClass Classes/Xclass/NewRecordController.php
example does not work anymore, most likely since v12.
Added a comment to emphasize this, and that it should
be reworked or removed.

PHPStan can be run with

Build/Scripts/runTests.sh -s phpstan

Generate baseline with

Build/Scripts/runTests.sh -s phpstanBaseline

Depends on #261

@linawolf linawolf self-assigned this May 1, 2024
Copy link
Contributor

@brotkrueml brotkrueml left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You mix now again different things, you add phpstan and typo3-rector.

Also import namespaces instead using FQCNs.

@linawolf
Copy link
Member Author

linawolf commented May 1, 2024

As you can read in the description this Depends on #261

@brotkrueml
Copy link
Contributor

Then please, set it as draft.

@linawolf
Copy link
Member Author

linawolf commented May 2, 2024

This branch is based on the one from #261 but contains a totally separated commit (05fe7ac) which can, if someone wants be reviewed independently. The descitsion is however up to the reviewer.

@brotkrueml
Copy link
Contributor

This branch is based on the one from #261 but contains a totally separated commit (05fe7ac) which can, if someone wants be reviewed independently. The descitsion is however up to the reviewer.

Okay, then I am out. I am just looking at the "Files changed" and not on separate commits.

@linawolf
Copy link
Member Author

linawolf commented May 3, 2024

It is absolutely your right to decide like this

@linawolf linawolf force-pushed the task/phpstan branch 2 times, most recently from 8203a9d to 597d215 Compare May 3, 2024 09:51
Copy link
Contributor

@sbuerk sbuerk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

on it to make minor adjustments ...

The TYPO3 Core and the Best Practice Team recommends
to have a static code analyzer in the defense line,
and preferes PHPStan due to experience with that tool.

This change now adds the static code analyser `PHPStan`
with a first configurattion and a lower level as a start.
Levels can be raised step by step in follow-ups.

Note: XClass `Classes/Xclass/NewRecordController.php`
example does not work anymore, most likely since v12.
Added a comment to emphasize this, and that it should
be reworked or removed.

PHPStan can be run with

```terminal
Build/Scripts/runTests.sh -s phpstan
```

Generate baseline with

```terminal
Build/Scripts/runTests.sh -s phpstanBaseline
```
@sbuerk sbuerk changed the title [TASK] Introduce phpstan and generate baseline [TASK] Add static code analyser PHPStan as code quality check May 3, 2024
@linawolf linawolf merged commit 8661cfc into main May 4, 2024
10 checks passed
@linawolf linawolf deleted the task/phpstan branch May 4, 2024 06:17
linawolf added a commit that referenced this pull request May 4, 2024
The TYPO3 Core and the Best Practice Team recommends
to have a static code analyzer in the defense line,
and preferes PHPStan due to experience with that tool.

This change now adds the static code analyser `PHPStan`
with a first configurattion and a lower level as a start.
Levels can be raised step by step in follow-ups.

Note: XClass `Classes/Xclass/NewRecordController.php`
example does not work anymore, most likely since v12.
Added a comment to emphasize this, and that it should
be reworked or removed.

PHPStan can be run with

```terminal
Build/Scripts/runTests.sh -s phpstan
```

Generate baseline with

```terminal
Build/Scripts/runTests.sh -s phpstanBaseline
```

(cherry picked from commit 8661cfc)
linawolf added a commit that referenced this pull request May 4, 2024
The TYPO3 Core and the Best Practice Team recommends
to have a static code analyzer in the defense line,
and preferes PHPStan due to experience with that tool.

This change now adds the static code analyser `PHPStan`
with a first configurattion and a lower level as a start.
Levels can be raised step by step in follow-ups.

Note: XClass `Classes/Xclass/NewRecordController.php`
example does not work anymore, most likely since v12.
Added a comment to emphasize this, and that it should
be reworked or removed.

PHPStan can be run with

```terminal
Build/Scripts/runTests.sh -s phpstan
```

Generate baseline with

```terminal
Build/Scripts/runTests.sh -s phpstanBaseline
```

(cherry picked from commit 8661cfc)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants