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

aio-interface: Improve psalm #5369

Merged
merged 3 commits into from
Oct 4, 2024
Merged

aio-interface: Improve psalm #5369

merged 3 commits into from
Oct 4, 2024

Conversation

docjyJ
Copy link
Collaborator

@docjyJ docjyJ commented Oct 2, 2024

Fix warnings generated by phpstorm

@docjyJ
Copy link
Collaborator Author

docjyJ commented Oct 2, 2024

Found 43 of 43 files that can be fixed in 6.985 seconds, 30.00 MB memory used
Please run `composer run cs:fix` to format your code
Error: Process completed with exit code 1.

Perfect, the workflow works, it fails successfully ^^'

PR ready

@szaimen
Copy link
Collaborator

szaimen commented Oct 2, 2024

Perfect, the workflow works, it fails successfully ^^'

I fear we cannot merge this with red ci. Can you run cs fix and commit the changes in a separate pr that builds on this branch?

Also the changes to psalm seem to be unrelated? Can you put this into a separate pr please?

@docjyJ
Copy link
Collaborator Author

docjyJ commented Oct 2, 2024

I fear we cannot merge this with red ci. Can you run cs fix and commit the changes in a separate pr that builds on this branch?

I know...

Also the changes to psalm seem to be unrelated? Can you put this into a separate pr please?

I don't know, it is link with <!--TODO: errorLevel="1" see PR #5369-->.

php/psalm.xml Outdated Show resolved Hide resolved
@docjyJ docjyJ changed the title Improuve coding standard Improuve psalm Oct 2, 2024
@docjyJ
Copy link
Collaborator Author

docjyJ commented Oct 2, 2024

ok psalm done

@docjyJ
Copy link
Collaborator Author

docjyJ commented Oct 2, 2024

ok see #5370 for CS

@docjyJ docjyJ added this to the next milestone Oct 2, 2024
php/psalm.xml Outdated Show resolved Hide resolved
Signed-off-by: Jean-Yves <7360784+docjyJ@users.noreply.github.com>
@szaimen
Copy link
Collaborator

szaimen commented Oct 2, 2024

Seems like static analysis is failing now :/

Can we increase the error level in a follow-up?

@docjyJ
Copy link
Collaborator Author

docjyJ commented Oct 2, 2024

------------------------------
284 errors found
------------------------------
Psalm can automatically fix 3 of these issues.
Run Psalm again with 
--alter --issues=UnusedVariable --dry-run
to see what it can fix.
------------------------------

In commit c20a8f8
I switched psalm to error level 1. The strict command is no longer useful, so I removed it.

The problem is that the workflow fails.

This is due to some problems in the code.

Ideally it would be good to switch to level 1. This avoids using variables of type mixed and unused variables. IDEs can be more efficient for autocompletion, and psalm can warn of type errors more easily.

@docjyJ
Copy link
Collaborator Author

docjyJ commented Oct 2, 2024

Seems like static analysis is failing now :/

Can we increase the error level in a follow-up?

That's why I used a TODO comment and added the stric composer script.
The idea is to improve the code little by little and at some point definitely move to level 1.

@docjyJ
Copy link
Collaborator Author

docjyJ commented Oct 2, 2024

Issue in code:

Command used:

composer run psalm -- --monochrome --no-progress | grep ^ERROR | sed -e 's/^ERROR: //' | sort -u

@szaimen
Copy link
Collaborator

szaimen commented Oct 2, 2024

Seems like static analysis is failing now :/
Can we increase the error level in a follow-up?

That's why I used a TODO comment and added the stric composer script. The idea is to improve the code little by little and at some point definitely move to level 1.

Ah I see. Can we for now switch back to errorlevel2 and then in follow-ups resolve the issues?

@docjyJ
Copy link
Collaborator Author

docjyJ commented Oct 2, 2024

I drop the commit

@docjyJ
Copy link
Collaborator Author

docjyJ commented Oct 2, 2024

I don't know if you've seen it yet, but I've started working on stalwart integration. I'm trying to apply strict rules in static analysis.

https://github.com/docjyJ/stalwart-connector

(I recently got into rust and really enjoyed it. I'm a bit of a neat freak, but I think it's important to avoid errors. 😅)

@docjyJ
Copy link
Collaborator Author

docjyJ commented Oct 2, 2024

Follow up #5368

@docjyJ
Copy link
Collaborator Author

docjyJ commented Oct 2, 2024

I found that in psalm doc: https://psalm.dev/docs/manipulating_code/fixing/

Follow up already noted in #5368

Signed-off-by: Simon L. <szaimen@e.mail.de>
Signed-off-by: Simon L. <szaimen@e.mail.de>
Copy link
Collaborator

@szaimen szaimen left a comment

Choose a reason for hiding this comment

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

LGTM, thanks 😊

@szaimen szaimen changed the title Improuve psalm aio-interface: Improve psalm Oct 4, 2024
@szaimen szaimen merged commit 09a3212 into main Oct 4, 2024
7 checks passed
@szaimen szaimen deleted the enh/noid/psalm branch October 4, 2024 13:40
@szaimen
Copy link
Collaborator

szaimen commented Oct 4, 2024

I found that in psalm doc: https://psalm.dev/docs/manipulating_code/fixing/

This sounds cool as an additonal command maybe? :)

@szaimen
Copy link
Collaborator

szaimen commented Oct 4, 2024

I don't know if you've seen it yet, but I've started working on stalwart integration. I'm trying to apply strict rules in static analysis.

https://github.com/docjyJ/stalwart-connector

(I recently got into rust and really enjoyed it. I'm a bit of a neat freak, but I think it's important to avoid errors. 😅)

Also this looks very interesting! Cool that you started working on it 😊

@docjyJ
Copy link
Collaborator Author

docjyJ commented Oct 4, 2024

I found that in psalm doc: https://psalm.dev/docs/manipulating_code/fixing/

This sounds cool as an additonal command maybe? :)

I think this should be added globally to the Nextcloud style rule to maintain consistency.

@docjyJ
Copy link
Collaborator Author

docjyJ commented Oct 4, 2024

I don't know if you've seen it yet, but I've started working on stalwart integration. I'm trying to apply strict rules in static analysis.
https://github.com/docjyJ/stalwart-connector
(I recently got into rust and really enjoyed it. I'm a bit of a neat freak, but I think it's important to avoid errors. 😅)

Also this looks very interesting! Cool that you started working on it 😊

Thank you! If you have time, don't hesitate to give feedback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3. to review Waiting for reviews enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants