-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Setup static analysis with Psalm #3951
Conversation
I think it will not show up until merged, but the result can already be preview on this PR I made in my fork |
Travis fails because the version of Psalm I installed is too recent. I will add something in |
7bcc967
to
8cce3ab
Compare
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.
I'm surprised that we have so few errors to whitelist of which most are related to the DB extensions. BTW, why doesn't it report the existing mixed[][]
return types?
That's probably because I went for the most lenient level ( EDIT: or because the tests directory is not included :P |
This should make it easier to work with Composer from machines using different versions of PHP than the lowest one we use in the CI.
b3f71e0
to
6370f83
Compare
I see. Is it because we also don't run PHPStan against tests? Do you want to add it in |
It was both reasons: the issues is reported starting at level 6. I can add psalm to all branches when doing the upmerges, But I'm not sure if that's what you meant, I'm under the impression that you would like me to add it in master and then do the upmerge, is that correct? And if yes, why? |
No, once this PR gets merged, we'll need to merge |
Ok, I'll take care of it :) |
Great work by the way, @greg0ire! I'm glad that we eventually have Psalm in the build pipeline. |
Thanks me, too :) |
@morozov Why is baseline fine for you with Psalm, but not with PHPStan? Linking our discussion here: #3799 (comment) |
@ondrejmirtes we do have a baseline for PHPStan: Lines 11 to 74 in 72d9081
|
This is not a baseline in the sense we talked about in the linked discussion :) PHPStan's baseline is generated with |
TIL :) |
This is a valid question. I didn't think of it because we were using the lowest possible level and the baseline was way smaller than in #3799. Although, it is getting out of hand (I don't remember seeing @greg0ire before we proceed with merging it to master, let's take a pause and see if the baselined errors could be fixed (3.0 allows for BC breaks) and the non-fixable ones are suppressed manually. |
@morozov I don't know if you noticed but the baseline is way smaller for master: https://github.com/doctrine/dbal/pull/3954/files#diff-043e2f3614861e20eb0fb277052a7693, but sure, I will have a look at 3.0.x |
The first error I noticed does not imply a BC-break, and gets us rid of ~ 100 errors, so I'm going to have a look at 2.10.x first |
I noticed that but I didn't think of them as the finally required baselines. It's a good sign, on the one hand, meaning that we did a good job there. But on the other hand, we still need to get rid of those many repetitive occurrences of the same error. Otherwise, each time we modify something, we'll hit the same error again. |
Ok so now I'm getting a crash on 2.10.x that I don't get with the deps of 3.0.x… 🤦♂️
EDIT: Works after |
Release [2.10.2](https://github.com/doctrine/dbal/milestone/75) 2.10.2 ====== - Total issues resolved: **4** - Total pull requests resolved: **19** - Total contributors: **10** Improvement,Static Analysis --------------------------- - [3964: Mark every exception as immutable](doctrine#3964) thanks to @greg0ire CI,Improvement,Static Analysis ------------------------------ - [3961: Stop relying on the master version of Psalm](doctrine#3961) thanks to @greg0ire - [3951: Setup static analysis with Psalm](doctrine#3951) thanks to @greg0ire - [3799: Upgrade to PHPStan v0.12](doctrine#3799) thanks to @lcobucci Improvement,Logging,Test Suite ------------------------------ - [3957: Reworked LoggingTest to be able to test Statement::executeUpdate()](doctrine#3957) thanks to @morozov CI,Code Style,Improvement,Strict Typing --------------------------------------- - [3955: Remove baseline](doctrine#3955) thanks to @greg0ire Bug,SQLite,Schema Introspection,Schema Managers ----------------------------------------------- - [3937: Column comment incorrectly introspected on SQLite](doctrine#3937) thanks to @morozov Bug,Documentation,Prepared Statements,Query ------------------------------------------- - [3896: Updated documentation for QueryBuilder::execute() return value type](doctrine#3896) thanks to @morozov Bug,Prepared Statements ----------------------- - [3894: Make sure that the $types array has the same keys $params](doctrine#3894) thanks to @morozov - [3893: Ensure the constructor arguments are passed to custom classes](doctrine#3893) thanks to @duncan3dc - [3843: Fix unquoted stmt fragments backslash escaping](doctrine#3843) thanks to @morozov Documentation,Improvement ------------------------- - [3886: Update readme](doctrine#3886) thanks to @greg0ire - [3834: Fix docblock typos in DriverManager docs](doctrine#3834) thanks to @CHItA CI,Improvement,MariaDB,MySQL ---------------------------- - [3884: Use Docker consistently](doctrine#3884) thanks to @greg0ire - [3478: Improve readiness probe stability for containerized databases on CI](doctrine#3478) thanks to @morozov - [3883: Fix broken build](doctrine#3883) thanks to @greg0ire Bug,Documentation,Query,Query Limit/Offset Modification ------------------------------------------------------- - [3842: Fixed the QueryBuilder::setMaxResults() signature to accept NULL](doctrine#3842) thanks to @morozov Bug,Query --------- - [3832: Fix JOIN with no condition bug](doctrine#3832) thanks to @BenMorel Bug,PostgreSQL,Schema Introspection ----------------------------------- - [3821: &doctrine#91;pg&doctrine#93; fix getting table information if search&doctrine#95;path contains escaped schema name](doctrine#3821) thanks to @linniksa Documentation,Improvement,Logging --------------------------------- - [3812: Fix DebugStack#queries docblock type](doctrine#3812) thanks to @ostrolucky Bug,Regression,Schema --------------------- - [3790: fixed unqualified table name of fk constraints when using schemas](doctrine#3790) thanks to @stlrnz and @Alarich # gpg: Signature made Mon Apr 20 19:59:36 2020 # gpg: using DSA key 2C3A645671828132 # gpg: Can't check signature: public key not found # Conflicts: # README.md
Summary
This PR adds static analysis with Psalm, configured to the most lenient level, and ignores every error.
I am targeting 2.10.x, because this change does not touch code in
lib
, or dependencies underrequire
.