-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: error if names are not unique (part 2) (#640)
Closes partially #543 ### Summary of Changes Show an error if * module members in the same file have duplicate names, * module members in the same package, but different files have duplicate names, * schema columns have duplicate names. --------- Co-authored-by: megalinter-bot <[email protected]>
- Loading branch information
1 parent
e0fa032
commit 38d1181
Showing
15 changed files
with
521 additions
and
19 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
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
78 changes: 78 additions & 0 deletions
78
tests/resources/validation/names/duplicates/across files/main.sdstest
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 |
---|---|---|
@@ -0,0 +1,78 @@ | ||
package tests.validation.names.acrossFiles | ||
|
||
// $TEST$ error "Multiple declarations in this package have the name 'DuplicateAnnotation'." | ||
annotation »DuplicateAnnotation« | ||
// $TEST$ error "Multiple declarations in this package have the name 'DuplicateClass'." | ||
class »DuplicateClass« | ||
// $TEST$ error "Multiple declarations in this package have the name 'DuplicateEnum'." | ||
enum »DuplicateEnum« | ||
// $TEST$ error "Multiple declarations in this package have the name 'duplicateFunction'." | ||
fun »duplicateFunction«() | ||
// $TEST$ no error r"Multiple declarations in this package have the name '\w*'\." | ||
pipeline »duplicatePipeline« {} | ||
// $TEST$ error "Multiple declarations in this package have the name 'DuplicateSchema'." | ||
schema »DuplicateSchema« {} | ||
// $TEST$ error "Multiple declarations in this package have the name 'duplicatePublicSegment'." | ||
segment »duplicatePublicSegment«() {} | ||
// $TEST$ error "Multiple declarations in this package have the name 'duplicateInternalSegment'." | ||
internal segment »duplicateInternalSegment«() {} | ||
// $TEST$ no error r"Multiple declarations in this package have the name '\w*'\." | ||
private segment »duplicatePrivateSegment«() {} | ||
|
||
|
||
// $TEST$ no error r"Multiple declarations in this package have the name '\w*'\." | ||
annotation »UniqueAnnotation« | ||
// $TEST$ no error r"Multiple declarations in this package have the name '\w*'\." | ||
class »UniqueClass« | ||
// $TEST$ no error r"Multiple declarations in this package have the name '\w*'\." | ||
enum »UniqueEnum« | ||
// $TEST$ no error r"Multiple declarations in this package have the name '\w*'\." | ||
fun »uniqueFunction«() | ||
// $TEST$ no error r"Multiple declarations in this package have the name '\w*'\." | ||
pipeline »uniquePipeline« {} | ||
// $TEST$ no error r"Multiple declarations in this package have the name '\w*'\." | ||
schema »UniqueSchema« {} | ||
// $TEST$ no error r"Multiple declarations in this package have the name '\w*'\." | ||
segment »uniquePublicSegment«() {} | ||
// $TEST$ no error r"Multiple declarations in this package have the name '\w*'\." | ||
internal segment »uniqueInternalSegment«() {} | ||
// $TEST$ no error r"Multiple declarations in this package have the name '\w*'\." | ||
private segment »uniquePrivateSegment«() {} | ||
|
||
|
||
// $TEST$ no error r"Multiple declarations in this package have the name '\w*'\." | ||
annotation »MyAnnotation« | ||
// $TEST$ no error r"Multiple declarations in this package have the name '\w*'\." | ||
annotation »MyAnnotation« | ||
// $TEST$ no error r"Multiple declarations in this package have the name '\w*'\." | ||
class »MyClass« | ||
// $TEST$ no error r"Multiple declarations in this package have the name '\w*'\." | ||
class »MyClass« | ||
// $TEST$ no error r"Multiple declarations in this package have the name '\w*'\." | ||
enum »MyEnum« | ||
// $TEST$ no error r"Multiple declarations in this package have the name '\w*'\." | ||
enum »MyEnum« | ||
// $TEST$ no error r"Multiple declarations in this package have the name '\w*'\." | ||
fun »myFunction«() | ||
// $TEST$ no error r"Multiple declarations in this package have the name '\w*'\." | ||
fun »myFunction«() | ||
// $TEST$ no error r"Multiple declarations in this package have the name '\w*'\." | ||
pipeline »myPipeline« {} | ||
// $TEST$ no error r"Multiple declarations in this package have the name '\w*'\." | ||
pipeline »myPipeline« {} | ||
// $TEST$ no error r"Multiple declarations in this package have the name '\w*'\." | ||
schema »MySchema« {} | ||
// $TEST$ no error r"Multiple declarations in this package have the name '\w*'\." | ||
schema »MySchema« {} | ||
// $TEST$ no error r"Multiple declarations in this package have the name '\w*'\." | ||
segment »myPublicSegment«() {} | ||
// $TEST$ no error r"Multiple declarations in this package have the name '\w*'\." | ||
segment »myPublicSegment«() {} | ||
// $TEST$ no error r"Multiple declarations in this package have the name '\w*'\." | ||
internal segment »myInternalSegment«() {} | ||
// $TEST$ no error r"Multiple declarations in this package have the name '\w*'\." | ||
internal segment »myInternalSegment«() {} | ||
// $TEST$ no error r"Multiple declarations in this package have the name '\w*'\." | ||
private segment »myPrivateSegment«() {} | ||
// $TEST$ no error r"Multiple declarations in this package have the name '\w*'\." | ||
private segment »myPrivateSegment«() {} |
11 changes: 11 additions & 0 deletions
11
tests/resources/validation/names/duplicates/across files/other package.sdstest
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package tests.validation.names.acrossFiles.other | ||
|
||
annotation UniqueAnnotation | ||
class UniqueClass | ||
enum UniqueEnum | ||
fun uniqueFunction() | ||
pipeline uniquePipeline {} | ||
schema UniqueSchema {} | ||
segment uniquePublicSegment() {} | ||
internal segment uniqueInternalSegment() {} | ||
private segment uniquePrivateSegment() {} |
11 changes: 11 additions & 0 deletions
11
tests/resources/validation/names/duplicates/across files/same package.sdstest
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package tests.validation.names.acrossFiles | ||
|
||
annotation DuplicateAnnotation | ||
class DuplicateClass | ||
enum DuplicateEnum | ||
fun duplicateFunction() | ||
pipeline duplicatePipeline {} | ||
schema DuplicateSchema {} | ||
segment duplicatePublicSegment() {} | ||
internal segment duplicateInternalSegment() {} | ||
private segment duplicatePrivateSegment() {} |
Oops, something went wrong.