plugin-check
plugin-check copied to clipboard
Detect localhost/127.0.0.1 code in multiple files
Fixes https://github.com/WordPress/plugin-check/issues/362
- Adds method
files_preg_match
inAbstract_File_Check
to return multiple results matched with given regex. - Update
Localhost_Check
to handle array of results - Update
Localhost_Check_Tests
accordingly
cc: @swissspidy @felixarntz @mukeshpanchal27
Let's discuss the right approach on the issue first. This applies to other checks as well.
Thanks for this change, I think that for this check it would be really useful to also give users the line + column where that happens (as well as showing more than one case for file). I mentioned this on #362 .
Also, I can suggest to add other common "localhost" cases like:
-
https?:\/\/(?:[^\s\/]*\.)++local(?:host)?
(this covers domains ending in .local and .localhost, for example: docker.local)
PR has been updated based on feedback.
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot
label.
If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
Co-authored-by: ernilambar <[email protected]>
Co-authored-by: swissspidy <[email protected]>
Co-authored-by: frantorres <[email protected]>
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.