-
Notifications
You must be signed in to change notification settings - Fork 19
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
Add PHPCS linting #24
Conversation
.gitignore
Outdated
.DS_Store | ||
node_modules | ||
vendor/* | ||
!vendor/composer |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
possibly we could ignore these and include them later in a build step
@@ -70,21 +70,26 @@ function enqueue_scripts( $hook ) { | |||
} | |||
|
|||
// Enqueue the styles. | |||
wp_enqueue_style( 'admin_tenup-auto-tweet', TUAT_URL . '/assets/css/admin-auto_tweet.css', TUAT_VERSION ); | |||
wp_enqueue_style( 'admin_tenup-auto-tweet', TUAT_URL . '/assets/css/admin-auto_tweet.css', [], TUAT_VERSION ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice catch!
includes/admin/post-meta.php
Outdated
TUAT_VERSION, | ||
true | ||
); | ||
|
||
$post_id = get_the_ID(); | ||
if ( empty( $post_id ) ) { | ||
$post_id = filter_input( INPUT_GET, 'post', FILTER_VALIDATE_INT ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this change for linting purposes? previously we cast the input to an int, so a string of '1' would get cast to 1. Will FILTER_VALIDATE_INT
reject non ints? are we sure these values aren't arriving here as strings?
includes/admin/post-meta.php
Outdated
TUAT_VERSION, | ||
true | ||
); | ||
|
||
$post_id = get_the_ID(); | ||
if ( empty( $post_id ) ) { | ||
$post_id = filter_input( INPUT_GET, 'post', FILTER_VALIDATE_INT ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this change for linting purposes? previously we cast the input to an int, so a string of '1' would get cast to 1. Will FILTER_VALIDATE_INT
reject non ints? are we sure these values aren't arriving here as strings?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's .gitignore the entire vendor
directory so we can avoid changes there.
We don't need the plugin to run without a composer install from master. We will add a build process to bundle up the code required for a release, including the correct vendor directories.
Thanks, @adamsilverstein! As with the other PR, I've updated to ignore the entire vendor directory. Regarding your Thanks for your feedback! Let me know if you think this is ready to merge. There might be a conflict with the PHPUnit PR for me to resolve |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work!
Description of the Change
This makes the following updates to resolve #3 :
lint
andlint-fix
composer scriptspackage.json
file and installshusky
andlint-staged
dev dependenciespre-commit
hook to run PHPCS before commits.I also ran PHPCS against the project once. There was only a handful of issues -- all in
post-meta.php
-- so I fixed them. I also removed a fewinput var ok
comments that aren't needed for the standard we're using.Potential conflict
Merge conflicts around Composer may need to be worked out between this and #23.