plugin-check icon indicating copy to clipboard operation
plugin-check copied to clipboard

Detect localhost/127.0.0.1 code in multiple files

Open ernilambar opened this issue 1 year ago • 2 comments

Fixes https://github.com/WordPress/plugin-check/issues/362

  • Adds method files_preg_match in Abstract_File_Check to return multiple results matched with given regex.
  • Update Localhost_Check to handle array of results
  • Update Localhost_Check_Tests accordingly

ernilambar avatar Jan 23 '24 09:01 ernilambar

cc: @swissspidy @felixarntz @mukeshpanchal27

ernilambar avatar Jan 23 '24 10:01 ernilambar

Let's discuss the right approach on the issue first. This applies to other checks as well.

swissspidy avatar Jan 23 '24 10:01 swissspidy

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)

frantorres avatar Jun 22 '24 14:06 frantorres

PR has been updated based on feedback.

ernilambar avatar Jun 26 '24 04:06 ernilambar

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.

github-actions[bot] avatar Jul 03 '24 07:07 github-actions[bot]