Page MenuHomePhabricator

Add a linter rule to prevent hardcoded class names
ClosedPublic

Authored by joshuaspence on Apr 29 2015, 12:55 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Jan 20, 11:25 PM
Unknown Object (File)
Sun, Jan 19, 11:27 PM
Unknown Object (File)
Sat, Jan 18, 1:26 AM
Unknown Object (File)
Fri, Jan 17, 10:30 PM
Unknown Object (File)
Wed, Jan 15, 11:31 AM
Unknown Object (File)
Mon, Jan 13, 2:45 PM
Unknown Object (File)
Fri, Jan 10, 7:21 AM
Unknown Object (File)
Fri, Jan 10, 2:50 AM
Subscribers

Details

Summary

Add a linter rule to advise against the use of hardcoded class names. Hardcoded class names make the code harder to refactor and it is generally preferable to use the __CLASS__ magic constant instead.

Test Plan

This works, but needs some polish.

Diff Detail

Repository
rARC Arcanist
Branch
master
Lint
Lint Passed
Unit
Test Failures
Build Status
Buildable 5916
Build 5936: [Placeholder Plan] Wait for 30 Seconds

Unit TestsFailed

TimeTest
1,211 msArcanistXMLLinterTestCase::testLinter
3,450 msArcanistCSSLintLinterTestCase::testLinter
423 msArcanistCSSLintLinterTestCase::testVersion
646 msArcanistChmodLinterTestCase::testLinter
452 msArcanistClosureLinterTestCase::testLinter
View Full Test Results (1 Failed · 47 Passed · 4 Skipped)

Event Timeline

joshuaspence retitled this revision from to Add a linter rule to prevent hardcoded class names.
joshuaspence updated this object.
joshuaspence edited the test plan for this revision. (Show Details)
This revision is now accepted and ready to land.Apr 29 2015, 1:06 PM
joshuaspence edited edge metadata.

Use a regex for matching... this means that PhabricatorUser won't be matched in the PhabricatorUserEditor class, for example.

This revision was automatically updated to reflect the committed changes.