Skip to content

[stable20] Use own psalm instead of a global one - #23480

Merged
MorrisJobke merged 4 commits into
stable20from
backport/23401/stable20
Oct 16, 2020
Merged

[stable20] Use own psalm instead of a global one#23480
MorrisJobke merged 4 commits into
stable20from
backport/23401/stable20

Conversation

@backportbot-nextcloud

Copy link
Copy Markdown

backport of #23401

@ChristophWurst

Copy link
Copy Markdown
Member

Psalm failed too hard. Let's try with an updated baseline …

@MorrisJobke

Copy link
Copy Markdown
Member

Psalm failed too hard. Let's try with an updated baseline …

There are still some :/

Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
@ChristophWurst

Copy link
Copy Markdown
Member

There are still some :/

One. And I'm not sure why the check is different locally and on CI …

@ChristophWurst

Copy link
Copy Markdown
Member

Ah so two more errors. But for some reasons the baseline update doesn't capture those …

Can you reproduce the failure locally?

@MorrisJobke

Copy link
Copy Markdown
Member

Can you reproduce the failure locally?

$ composer run psalm
> psalm
Scanning files...
Analyzing files...
ERROR: InvalidNullableReturnType - lib/private/Avatar/Avatar.php:145:13 - The declared return type 'bool|string' for OC\Avatar\Avatar::generateAvatarFromSvg is not nullable, but 'false|null|string' contains null (see https://psalm.dev/144)
* @return string|boolean
ERROR: ImplicitToStringCast - lib/private/Avatar/Avatar.php:159:25 - Argument 1 of OC_Image::loadFromData expects string, Imagick provided with a __toString method (see https://psalm.dev/060)
$image->loadFromData($avatar);
ERROR: NullableReturnStatement - lib/private/Avatar/Avatar.php:160:11 - The declared return type 'bool|string' for OC\Avatar\Avatar::generateAvatarFromSvg is not nullable, but the function returns 'null|string' (see https://psalm.dev/139)
return $image->data();
ERROR: UndefinedInterfaceMethod - lib/private/Files/Stream/Encryption.php:449:16 - Method OCP\Files\Cache\ICacheEntry::offsetGet does not exist (see https://psalm.dev/181)
$version = $cacheEntry['encryptedVersion'] + 1;
ERROR: InvalidScalarArgument - lib/private/Files/Stream/Encryption.php:501:59 - Argument 2 of OCP\Encryption\IEncryptionModule::decrypt expects string, int|non-empty-lowercase-string provided (see https://psalm.dev/012)
$this->cache = $this->encryptionModule->decrypt($data, $position);
------------------------------
5 errors found
------------------------------
15307 other issues found.
You can display them with --show-info=true
------------------------------
Psalm can automatically fix 666 of these issues.
Run Psalm again with --alter --issues=InvalidReturnType,InvalidNullableReturnType,MismatchingDocblockReturnType,MismatchingDocblockParamType,MissingParamType --dry-run
to see what it can fix.
------------------------------
Checks took 117.95 seconds and used 1,899.642MB of memory
Psalm was able to infer types for 91.1980% of the codebase
Script psalm handling the psalm event returned with error code 1

@faily-bot

faily-botBot commented Oct 16, 2020

Copy link
Copy Markdown

🤖 beep boop beep 🤖

Here are the logs for the failed build:

Status of 34219: failure

mariadb10.4-php7.3

Show full log
There were 2 warnings:
1) Test\Files\ViewTest::testRenameFailDeleteTargetKeepSource
Trying to configure method "writeStream" which cannot be configured because it does not exist, has not been specified, is final, or is static
2) Test\Files\ViewTest::testCopyFailDeleteTargetKeepSource
Trying to configure method "writeStream" which cannot be configured because it does not exist, has not been specified, is final, or is static
--
There was 1 failure:
1) Test\Files\ObjectStore\ObjectStoreStorageTest::testCopyDirectory
Failed asserting that false matches expected 'qwerty'.
/drone/src/tests/lib/Files/Storage/Storage.php:556

@MorrisJobke
MorrisJobkeforce-pushed the backport/23401/stable20 branch 4 times, most recently from 00ab678 to 994fa3aCompareOctober 16, 2020 08:52
@ChristophWurst

Copy link
Copy Markdown
Member

**Static code analysis / static-code-analysis (pull_request) ** Failing after 1m — static-code-analysis

How many engineers does it take to make Psalm pass?

@MorrisJobke
MorrisJobkeforce-pushed the backport/23401/stable20 branch from 994fa3a to 8545d18CompareOctober 16, 2020 09:00
@ChristophWurst

Copy link
Copy Markdown
Member

**Static code analysis / static-code-analysis (pull_request) ** Failing after 1m — static-code-analysis

Yo …

@MorrisJobke
MorrisJobkeforce-pushed the backport/23401/stable20 branch from 8545d18 to 68cbfe1CompareOctober 16, 2020 09:08
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
@MorrisJobke
MorrisJobkeforce-pushed the backport/23401/stable20 branch from a05eb3d to 7054159CompareOctober 16, 2020 11:17

@MorrisJobkeMorrisJobke left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

CI is green 👍 🙌

@MorrisJobke

Copy link
Copy Markdown
Member

Administrative only -> merge

@MorrisJobke
MorrisJobke merged commit 3c1a745 into stable20Oct 16, 2020
@MorrisJobke
MorrisJobke deleted the backport/23401/stable20 branch October 16, 2020 11:22
@MorrisJobkeMorrisJobke mentioned this pull request Oct 16, 2020
5 tasks
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

technical debt🧱 🤔🚀

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@ChristophWurst@MorrisJobke