We should add static deprecation analysis testing to this module, by adding this to the drupalci.yml file:

build:
 assessment:
   validate_codebase:
     # Static analysis of code for @deprecated uses.
     phpstan:
       halt-on-fail: false

(just the last two lines need to be added to our existing file).

Then we need to fix the errors that come up before finalizing this issue and committing the change.

CommentFileSizeAuthor
#2 3044998-add-phpstan.patch472 bytesjhodgdon

Comments

jhodgdon created an issue. See original summary.

jhodgdon’s picture

Status: Active » Needs review
StatusFileSize
new472 bytes
jhodgdon’s picture

OK, the test for phpstan actually didn't work. If you drill down into the build artifacts, you find:

Package mglaman/phpstan-drupal at version  has a PHP requirement incompatible with your PHP version (7.0.31)  

So, I will hit retest with a different version of PHP, and also change the default for this project's testing.

jhodgdon’s picture

Status: Needs review » Postponed

With 7.1 the test ran into
https://github.com/mglaman/phpstan-drupal/issues/47
So will need to come back to this once that issue is fixed.

jhodgdon’s picture

OK, that was fast! The GitHub issue is fixed, and phpstan now runs. It comes up with two deprecation errors:

<?xml version="1.0" encoding="UTF-8"?>
<checkstyle>
<file name="core/config_update_ui/config_update_ui.drush_testing.inc">
  <error line="0" column="1" severity="error" message="Class DrushLogLevel was not found while trying to analyse it - autoloading is probably not configured properly." />
</file>
<file name="core/config_update_ui/src/Commands/ConfigUpdateUiCommands.php">
  <error line="0" column="1" severity="error" message="Class Drush\Commands\DrushCommands not found and could not be autoloaded." />
</file>
</checkstyle>

These are similar (but not identical) to the errors that were reported in #3042621: Refactor to not support Drush 8 any more, which was changed to be about supporting both Drush 8 and 9. The errors here indicate Drush wasn't present. The errors on the other issue indicate Drush is present, but we are using deprecated Drush calls... Anyway... we can probably just leave this issue as Postponed and come back and run the test from time to time to make sure that new deprecations in Core don't appear that will leave us in trouble.

jhodgdon’s picture

jhodgdon’s picture

Status: Postponed » Closed (won't fix)

I don't think we need to do this any more.