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

Fixes #3386 to add drupal check for deprecated module / theme code. #3710

Merged
merged 2 commits into from
Jun 19, 2019

Conversation

mikemadison13
Copy link
Contributor

@mikemadison13 mikemadison13 commented Jun 13, 2019

Fixes #3386

Changes proposed

(What are you proposing we change? How does this impact end users? Are manual or automatic updates required?)

  • adds the mglaman/drupal-check package to composer
  • adds the tests:deprecated:modules command
  • adds the tests:deprecated:themes command
  • expands blt validate command to check modules and themes for deprecated code if validate.deprecation values are overridden in blt.yml.

Steps to replicate the issue

  1. add validate.deprecation.modules and validate.deprecation.themes to blt.yml and set to try
  2. run blt validate
  3. confirm that drupal-check is running for both custom modules and themes.

Additional details

This is now possible thanks to work being performed in mglaman/drupal-check#68

@mikemadison13 mikemadison13 added 10.x Enhancement A feature or feature request labels Jun 13, 2019
@mikemadison13 mikemadison13 changed the title Fixes #3386 to add drupal check for deprecation. Fixes #3386 to add drupal check for deprecated module / theme code. Jun 13, 2019
@mikemadison13
Copy link
Contributor Author

Sample Output from the Govcon repository:

blt tests:deprecated:modules
Checking for Deprecated Code in docroot/modules/custom
[ExecStack] /Users/mike.madison/git/Drupal-GovCon-2017/vendor/bin/drupal-check -d /Users/mike.madison/git/Drupal-GovCon-2017/docroot/modules/custom
[ExecStack] Running /Users/mike.madison/git/Drupal-GovCon-2017/vendor/bin/drupal-check -d /Users/mike.madison/git/Drupal-GovCon-2017/docroot/modules/custom in /Users/mike.madison/git/Drupal-GovCon-2017
 12/12 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%

                                                                                                                        
 [OK] No errors                                                                                                         
                                                                                                                        

[ExecStack] Done in 1.433s
macbookpro-mikemadison:Drupal-GovCon-2017 mike.madison$ blt tests:deprecated:themes
Checking for Deprecated Code in docroot/themes/custom
[ExecStack] /Users/mike.madison/git/Drupal-GovCon-2017/vendor/bin/drupal-check -d /Users/mike.madison/git/Drupal-GovCon-2017/docroot/themes/custom
[ExecStack] Running /Users/mike.madison/git/Drupal-GovCon-2017/vendor/bin/drupal-check -d /Users/mike.madison/git/Drupal-GovCon-2017/docroot/themes/custom in /Users/mike.madison/git/Drupal-GovCon-2017
 6/6 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%

 ------ -------------------------------------------- 
  Line   twentyeighteen/twentyeighteen.theme         
 ------ -------------------------------------------- 
  92     Call to deprecated function format_date().  
 ------ -------------------------------------------- 

 ------ -------------------------------------------- 
  Line   twentynineteen/twentynineteen.theme         
 ------ -------------------------------------------- 
  92     Call to deprecated function format_date().  
 ------ -------------------------------------------- 

                                                                                                                        
 [ERROR] Found 2 errors                                                                                                 
                                                                                                                        

[ExecStack]  Exit code 1  Time 6.41s
[notice] Review Deprecation warnings and re-run.
[error]  Drupal Check in docroot/themes/custom failed. 

@danepowell
Copy link
Contributor

danepowell commented Jun 13, 2019

@nateacquia are you okay with this as a new feature for BLT? I think it's worthwhile, we've gotten a few requests for deprecation scanning over the last year. But if we merge it we own it.

The alternatives would be to provide it as a plugin, or reject it. Making it a plugin would probably require some additional refactoring of the validation system to make it pluggable.

@mikemadison13
Copy link
Contributor Author

in fairness, there isn't much to "own" (since we're literally just running the drupal-check command) but point taken :)

@mikemadison13
Copy link
Contributor Author

we do need to decide if this is going in:
are projects

  • opted in by default (meaning we set to true in config)
  • opted out by default (meaning we set to false in config)

in either way it can be easily overridden. i'm leaning towards opted out by default (which is how this PR is structured).

Copy link
Contributor

@danepowell danepowell left a comment

Choose a reason for hiding this comment

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

Looks good to me. I think opt-in is good for now, maybe opt-out as part of the next major release.

Note that this adds an additional 17 composer dependencies (BLT already has about 250).

@nateacquia I think this is worth it but let me know if you approve.

Copy link

@nateacquia nateacquia left a comment

Choose a reason for hiding this comment

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

This works for me!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement A feature or feature request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants