Repository navigation
Conversation
|
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 Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
bde0cfc to
909ba30
Compare
909ba30 to
8354c5a
Compare
| for ( var i = 0; i < Math.min( lines.length, 5 ); i++ ) { | ||
| // Exclude files with lines longer than 500 characters. | ||
| if ( lines[i].length > 500 ) { |
There was a problem hiding this comment.
This can be simplified:
| for ( var i = 0; i < Math.min( lines.length, 5 ); i++ ) { | |
| // Exclude files with lines longer than 500 characters. | |
| if ( lines[i].length > 500 ) { | |
| for ( const line of lines.slice( 0, 5 ) ) { | |
| // Exclude files with lines longer than 500 characters. | |
| if ( line.length > 500 ) { |
There was a problem hiding this comment.
This would create a new array, right? A negligible overhead though, fine with it.
| @@ -1086,25 +1086,53 @@ module.exports = function(grunt) { | |||
| /* | |||
There was a problem hiding this comment.
Note that this was not a docblock, just a block comment. Now that we add param and return tags, it needs to use a double asterisk.
8354c5a to
8d31caf
Compare
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
The path resolution currently causes failures, and the scan does not inspect the entire file.
Get a fresh assessment by requesting another Copilot review.
Review effort: Lite
Findings: 1
Open (2)
What changed in this PR
Updates grunt jshint:plugins to exclude minified JavaScript files based on line length.
Changes:
- Adds minified-file detection.
- Preserves directory filtering.
- Improves documentation and logging.
| File | Summary |
|---|---|
Gruntfile.js |
Updates plugin JSHint filtering and minified-file detection. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| // Bypasses folder targets so fs.readFileSync doesn't throw errors. | ||
| if ( ! fs.lstatSync( dirpath ).isFile() ) { | ||
| return false; |
| var lines = content.split( '\n' ); | ||
|
|
||
| // Cap the maximum number of iterations at 5 lines. | ||
| for ( const line of lines.slice( 0, 5 ) ) { |
There was a problem hiding this comment.
This makes sense to me. Iterating over all lines in an an array is extremely fast, especially as the lines are already in memory.
There was a problem hiding this comment.
We don't have to aim for perfection.
Also I'd like to remind that in https://core.trac.wordpress.org/ticket/65950 I'm asking to consider whether jshint:plugins is still useful to some extend in the first place.
Honestly, I think it is not really used by developers to check their own plugins as today more modern and efficient tools are in use. I would consider to just remove this task.
…more effectively. Follow-up to [63364]. Prevents `grunt jshint:plugins` from scanning minified JavaScript files that don't use a `.min` suffix in their filename. Assumes that JavaScript files that contain lines with a length that is longer than 500 characters are minified file and skips them. Developed in #13573 Props afercia, westonruter. Fixes #66123. git-svn-id: https://develop.svn.wordpress.org/trunk@63783 602fd350-edb4-49c9-b593-d223f7449a82
…more effectively. Follow-up to [63364]. Prevents `grunt jshint:plugins` from scanning minified JavaScript files that don't use a `.min` suffix in their filename. Assumes that JavaScript files that contain lines with a length that is longer than 500 characters are minified file and skips them. Developed in WordPress/wordpress-develop#13573 Props afercia, westonruter. Fixes #66123. Built from https://develop.svn.wordpress.org/trunk@63783 git-svn-id: http://core.svn.wordpress.org/trunk@62955 1a063a9b-81f0-0310-95a4-ce76da25c4cd
|
Committed in https://core.trac.wordpress.org/changeset/63783 |


Trac ticket: https://core.trac.wordpress.org/ticket/66123
Exclude minified files from the
grunt jshint:pluginstask by checking the JS files line length.The assumption is that when a JS file contains lines with a length that is longer than 500 characters, then it is considered a minified file and it will be skipped.
Use of AI Tools
AI assistance: Yes
Tool(s): GitHub Copilot
Model(s): Claude Haiku 4.5
Used for: Initial research and suggestions; final implementation and tests were reviewed and edited by me.
This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.