-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Clarify error message of linter about filename mismatch
Summary: We have a linter checking that a file name is consistent with its class name if the file contains only one class. If the file also contains type definitions, these are ignored by the linter. However in that case the error message "file.php only contains MyClass, it should be named MyClass.php" is confusing, because the file does not "only contain MyClass". This diff adapts the error message to make it less confusing. Reviewed By: madgen Differential Revision: D64845159 fbshipit-source-id: b51a5828428210cee5f13600360558f4b3a7319e
- Loading branch information
1 parent
01da9ba
commit 653d1be
Showing
35 changed files
with
37 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
File "as_valid_type_with_opaque_alias.php--use_it.php", line 3, characters 10-12: | ||
as_valid_type_with_opaque_alias.php--use_it.php only declares `foo`, it should be named foo.php instead. (Lint[5564]) | ||
foo is the only function declared in as_valid_type_with_opaque_alias.php--use_it.php, so that file should be named foo.php instead. (Lint[5564]) | ||
File "as_valid_type_with_opaque_alias.php--use_it.php", line 6, characters 3-11: | ||
This expression has a type lie that makes Hack type checker think it is a different type than what it inferred. It is achieved using a type assertion through `as`. This can lead to fatals or subtle and latent behaviour changes. Even if the code is correct at the moment, the type checker won't produce any signal when the prerequisites for correctness change. (Lint[5808]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
File "call_user_func_array_sgrep.php", line 3, characters 10-13: | ||
call_user_func_array_sgrep.php only declares `test`, it should be named test.php instead. (Lint[5564]) | ||
test is the only function declared in call_user_func_array_sgrep.php, so that file should be named test.php instead. (Lint[5564]) | ||
File "call_user_func_array_sgrep.php", line 4, characters 3-22: | ||
Use argument unpacking instead. See https://www.facebook.com/groups/hackforhiphop/permalink/762166013832016/ (Lint[5542]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
File "cleanup_sgrep.php", line 3, characters 10-13: | ||
cleanup_sgrep.php only declares `test`, it should be named test.php instead. (Lint[5564]) | ||
test is the only function declared in cleanup_sgrep.php, so that file should be named test.php instead. (Lint[5564]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
File "clone_usage.php", line 3, characters 7-20: | ||
clone_usage.php only declares `CloneUsageTest`, it should be named CloneUsageTest.php instead. (Lint[5564]) | ||
CloneUsageTest is the only class declared in clone_usage.php, so that file should be named CloneUsageTest.php instead. (Lint[5564]) | ||
File "clone_usage.php", line 7, characters 16-17: | ||
Objects created with `clone` will have references to shared deep objects. Prefer to implement your own explicit copy method to ensure the semantics you want. See http://php.net/manual/en/language.oop5.cloning.php (Lint[5562]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
File "collection_literals_1.php", line 3, characters 10-10: | ||
collection_literals_1.php only declares `f`, it should be named f.php instead. (Lint[5564]) | ||
f is the only function declared in collection_literals_1.php, so that file should be named f.php instead. (Lint[5564]) | ||
File "collection_literals_1.php", line 4, characters 14-19: | ||
Use `Vector {...}` instead of `new Vector(...)` (Lint[5002]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
File "collection_literals_2.php", line 3, characters 10-10: | ||
collection_literals_2.php only declares `f`, it should be named f.php instead. (Lint[5564]) | ||
f is the only function declared in collection_literals_2.php, so that file should be named f.php instead. (Lint[5564]) | ||
File "collection_literals_2.php", line 4, characters 14-19: | ||
Use `Vector {...}` instead of `new Vector(...)` (Lint[5002]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
File "collection_literals_3.php", line 3, characters 10-10: | ||
collection_literals_3.php only declares `f`, it should be named f.php instead. (Lint[5564]) | ||
f is the only function declared in collection_literals_3.php, so that file should be named f.php instead. (Lint[5564]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
File "csprintf_argument_unpacking.php", line 3, characters 10-13: | ||
csprintf_argument_unpacking.php only declares `test`, it should be named test.php instead. (Lint[5564]) | ||
test is the only function declared in csprintf_argument_unpacking.php, so that file should be named test.php instead. (Lint[5564]) |
2 changes: 1 addition & 1 deletion
2
hphp/hack/test/lint/error_formatting_highlighted/only_declares_one_function.php.exp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
File "linter_classname_filename_mismatch.php", line 3, characters 7-10: | ||
linter_classname_filename_mismatch.php only declares `Test`, it should be named Test.php instead. (Lint[5564]) | ||
Test is the only class declared in linter_classname_filename_mismatch.php, so that file should be named Test.php instead. (Lint[5564]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
File "lowercase_constants.php", line 3, characters 10-10: | ||
lowercase_constants.php only declares `f`, it should be named f.php instead. (Lint[5564]) | ||
f is the only function declared in lowercase_constants.php, so that file should be named f.php instead. (Lint[5564]) | ||
File "lowercase_constants.php", line 4, characters 10-13: | ||
Please use `null` instead of `NULL` (Lint[5001]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
hphp/hack/test/lint/sketchy_null_check_nullable_newtype.php.exp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
hphp/hack/test/lint/sketchy_null_hiding_under_unresolved2.php.exp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
hphp/hack/test/lint/sketchy_null_hiding_under_unresolved3.php.exp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters