WordPress.org

Make WordPress Core

Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#30334 closed enhancement (wontfix)

New Precommit Grunt Task to avoid __DIR__ and 5.3+ stuff in Core.

Reported by: georgestephanis Owned by: jorbin
Milestone: Priority: normal
Severity: minor Version: 4.1
Component: Build/Test Tools Keywords: has-patch
Focuses: Cc:

Description

As was noted in [30311], a __DIR__ crept in, which isn't available in 5.2.

This sounds like an ideal case for Grunt scanning for instances in the future to prevent future 'oops' commits.

Attachments (1)

30334.diff (1.3 KB) - added by georgestephanis 5 years ago.

Download all attachments as: .zip

Change History (6)

#1 @georgestephanis
5 years ago

This could easily be extended to also check for shorttags and other stuffs.

https://www.npmjs.org/package/grunt-search

#2 @jorbin
5 years ago

  • Milestone changed from Awaiting Review to 4.1
  • Owner set to jorbin
  • Status changed from new to assigned

While there are a number of things we can't catch from simply scanning the code, this will help us catch some of them.

#3 @nacin
5 years ago

  • Keywords close added

Is this a good use case of Grunt? Seems more like Codesniffer or PHP 5.2 syntax checking. Though __DIR__ doesn't trigger a syntax error in 5.2, __DIR__ isn't the common issue. It's some other PHP 5.3-ism, usually, and ones that trigger a fatal or syntax error.

The number of times a __DIR__ has entered core is, best I can tell from a search of commit logs, 1.

#4 @jorbin
5 years ago

  • Milestone 4.1 deleted
  • Resolution set to wontfix
  • Status changed from assigned to closed

I agree with Nacin. As I had mentioned in slack earlier: :At first I really liked the idea of using grunt-search, but I think phpcodesniffer is actually what we should be using in this situation. I would rather us work on getting #30153 done and then we can write a sniff for dir if one does not exist already.

#5 @jorbin
5 years ago

  • Keywords close removed
Note: See TracTickets for help on using tickets.