-
Notifications
You must be signed in to change notification settings - Fork 19
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
add config for the psalm to check unused variables and parameter #655
Conversation
7669268
to
a460716
Compare
Lets put it in level 4 for now. We can make the configuration better in next PR. @nabim777 But create a WP before that. |
76fbabf
to
97df020
Compare
6c6cf2a
to
63374a5
Compare
63374a5
to
dc97da6
Compare
Hello there, We hope that the review process is going smooth and is helpful for you. We want to ensure your pull request is reviewed to your satisfaction. If you have a moment, our community management team would very much appreciate your feedback on your experience with this PR review process. Your feedback is valuable to us as we continuously strive to improve our community developer experience. Please take a moment to complete our short survey by clicking on the following link: https://cloud.nextcloud.com/apps/forms/s/i9Ago4EQRZ7TWxjfmeEpPkf6 Thank you for contributing to Nextcloud and we hope to hear from you soon! (If you believe you should not receive this message, you can add yourself to the blocklist.) |
f101cd9
to
ba48389
Compare
a72ce0f
to
c27fc4c
Compare
Signed-off-by: nabim777 <nabinalemagar019@gmail.com>
c27fc4c
to
034a2c4
Compare
2e18c20
to
b2dad67
Compare
46bdc06
to
3d789be
Compare
Signed-off-by: nabim777 <nabinalemagar019@gmail.com>
ae209a6
to
1e65fcf
Compare
Signed-off-by: nabim777 <nabinalemagar019@gmail.com>
1e65fcf
to
32c1c65
Compare
Signed-off-by: nabim777 <nabinalemagar019@gmail.com>
53dd6e8
to
f0c481c
Compare
PHP Code CoverageCoverage after merging CI/check-unused-variables into master will be
Coverage Report
|
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.
just small suggestions
@@ -552,9 +553,9 @@ public function theDataOfTheOCSResponseShouldMatch( | |||
PyStringNode $schemaString | |||
): void { | |||
$responseAsJson = json_decode($this->response->getBody()->getContents()); | |||
$responseAsJson = $responseAsJson->ocs->data; | |||
$_responseAsJson = $responseAsJson->ocs->data; |
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.
$_responseAsJson = $responseAsJson->ocs->data; | |
$dataOfResponse = $responseAsJson->ocs->data; |
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.
when we change the varaible name from _responseAsJson
to dataOfResponse
then we will get the following error:
ERROR: UnusedVariable - tests/acceptance/features/bootstrap/FeatureContext.php:556:3 - $dataOfResponse is never referenced or the value is not used (see https://psalm.dev/077)
$dataOfResponse = $responseAsJson->ocs->data;
this is due to the psalm configuration where I have added
findUnusedVariablesAndParams="true"
we have to add _
in the variable name so that psalm will not get the error
another options is just using suppress
/** @psalm-suppress UnusedVariable */
JsonAssertions::assertJsonDocumentMatchesSchema( | ||
$responseAsJson, | ||
$_responseAsJson, |
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.
$_responseAsJson, | |
json_decode($this->response->getBody()->getContents(), |
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.
same error cames as in the comment
#655 (comment)
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.
LGTM 👍
* make psalm error level check to 4 Signed-off-by: nabim777 <nabinalemagar019@gmail.com> * cs fix Signed-off-by: nabim777 <nabinalemagar019@gmail.com> * check for the UndefinedInterfaceMethod psalm Signed-off-by: nabim777 <nabinalemagar019@gmail.com> * try for ignoring server code scanning by psalm Signed-off-by: nabim777 <nabinalemagar019@gmail.com> * changes fileid type from int to string Signed-off-by: nabim777 <nabinalemagar019@gmail.com> --------- Signed-off-by: nabim777 <nabinalemagar019@gmail.com>
Backport: add config for the psalm to check unused variables and parameter (#655)
Description
As of right now, on CI the psalm misses to throw an error when variables and parameters are not being used. Thus, this PR update the error level of psalm to
4
where there is checking of below errors:AbstractInstantiation
AssignmentToVoid
CircularReference
ConflictingReferenceConstraint
ContinueOutsideLoop
InvalidOverride
InvalidTypeImport
MethodSignatureMismatch
NonVariableReferenceReturn
OverriddenMethodAccess
ParamNameMismatch
ReservedWord
UnhandledMatchCondition
UninitializedProperty
Related Issue or Workpackage
Screenshots (if appropriate):
Types of changes
Checklist:
CHANGELOG.md
file