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

Feature, add support for .distignore #692

Open
angelomandato opened this issue Oct 3, 2024 · 4 comments
Open

Feature, add support for .distignore #692

angelomandato opened this issue Oct 3, 2024 · 4 comments
Labels
Needs Discussion Anything that needs a discussion/agreement [Type] Enhancement A suggestion for improvement of an existing feature

Comments

@angelomandato
Copy link

I would like to add support for GitHub's .distignore, if the file is found then those files in this file are ignored for the hidden_files check. I can gladly create a pull request but before I do I wanted to seek support from the rest of the committers.

There are 2 approaches, use a define that would be placed in the wp-config.php or make it a checkbox option before every scan.

Note: The plugin's current behavior should not use the .distignore I am proposing above by default, but only use it if a define or check option is set. I am suggesting this as an option for developers who develop locally that are aware their distribution used on the WordPress plugin SVN will not have these dot hidden files.

Define option to enable this option:

define('WP_PLUGIN_CHECK_USE_DISTIGNORE', true);

This way the current behavior remains, but for developers who setup a dev environment using this plugin who know that their releases will not have the hidden files can add the define to their wp-config.php.

Checkbox option to enable this option:
The other approach is to add this as a checkbox option before performing a scan. This is equally acceptable, but if an option like this is too easy the developer may not understand the consequences if those hidden files end up in the distributed plugin. Maybe the option could be on the screen but hidden under a separate section that is titled "Advanced Options" and is only exposed when they click on a "show advanced options" button.

Thanks everyone for an awesome plugin!

@swissspidy swissspidy added Needs Discussion Anything that needs a discussion/agreement [Type] Enhancement A suggestion for improvement of an existing feature labels Oct 3, 2024
@swissspidy
Copy link
Member

Thanks for opening this request.

At first glance this enhancement doesn‘t strike me as a good fit for including in Plugin Check.

First, distignore may be common in WordPress but it‘s by no means a standard.
Second, if we‘d do that it would give you a false impression that everything is fine. But if you forgot to actually use the distignore in your final ZIP file then you won‘t be warned about it.
Finally, you shouldn‘t be running PCP on development files but on the production build you would also submit to dotorg. If you use the GitHub Action, you can easily build the plugin first and then point it to that build.
To achieve what you want locally with a development build, simply disable this check using the CLI flags and PHP filters provided.

@angelomandato
Copy link
Author

Thanks for feedback. As I mentioned this would be an option that if you go the define route on purpose would require some effort to enable it in a specific environment for the same reason you stated, not to give a false impression.

I am running the check in my dev environment, currently the plugin picks up all of the hidden files. You are correct if you put this in your CI/CD after the build process then yes the hidden files should not be there, in that case no define would be set.

I will check out the PHP filters. That may be all I need to do is add a few lines to the wp-config.php, this may just evolve into a blog post how-to!

@xwolfde
Copy link

xwolfde commented Oct 5, 2024

How about adding an option to the settings which turns off this tests for dot-files (but warns, that the check was turned off in the report)?

@ernilambar
Copy link
Member

For the quick fix, you can exclude specific check like this:

wp plugin check plugin-slug --exclude-checks=file_type

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Discussion Anything that needs a discussion/agreement [Type] Enhancement A suggestion for improvement of an existing feature
Projects
None yet
Development

No branches or pull requests

4 participants