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

Inconsistent options behaviour #200

Open
jacobfriis opened this issue Dec 10, 2020 · 1 comment
Open

Inconsistent options behaviour #200

jacobfriis opened this issue Dec 10, 2020 · 1 comment

Comments

@jacobfriis
Copy link

jacobfriis commented Dec 10, 2020

Using option analysis - or options analysis + deprecations - does not produce the expected check(s)

drupal-check:

Environment:

  • OS: Linux
  • PHP Version: 7.4
  • Drupal core: 8.9.1, 9.0.6
Options used Documentation Actual check(s)
(none) Vague, just 'check' deprecations
deprecations deprecations deprecations
analysis analysis analysis + deprecations
analysis + deprecations analysis + deprecations deprecations OR analysis + deprecations

Results of using analysis only are just counter to the expected, but at least consistent across different scenarios.

Results of analysis + deprecations depend on which directories|files you check.
Cannot see any pattern. If I check ctools/src I (correctly) get analysis + deprecations.
But if check some other - non-buggy quality code, ruined slightly to get failures - I only get deprecations.
Unfortunately I do not have any published code to examplify.

Solution for now

Don't use analysis + deprecations, use analysis.
And accept that there's no means of getting analysis only (which IMHO is pretty O.K.).

Examples - published code:
drupal-check --analysis web/modules/contrib/ctools/src
-> analysis + deprecations
drupal-check --analysis --deprecations web/modules/contrib/ctools/src
-> analysis + deprecations (correct)

Examples - unpublished code:
drupal-check --analysis web/modules/custom/kk_cmpn_skin/src/KkCmpnSkinStylesheetGenerator.php
164 \Drupal calls should be avoided in classes, use dependency injection...(= analysis)
171 Call to deprecated constant REQUEST_TIME: Deprecated in drupal:8.3.0...(= deprecation)

drupal-check --analysis --deprecation web/modules/custom/kk_cmpn_skin/src/KkCmpnSkinStylesheetGenerator.php
171 Call to deprecated constant REQUEST_TIME: Deprecated in drupal:8.3.0...(= deprecation)

@jacobfriis
Copy link
Author

Simple fix suggestion

The deprecations option is obsolete, because you always get deprecations check and deprecations=0 is BTW not supported.

Documentation:

  • remove deprecations option
  • change analysis option, make it clear that it adds static analysis
  • tell that you cannot get static analysis alone

Code:

  • ignore the deprecations option - at least when combined with the analysis option

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

No branches or pull requests

1 participant