-
-
Notifications
You must be signed in to change notification settings - Fork 362
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
stylecheck: validate docstrings on exported identifiers
- Loading branch information
Showing
9 changed files
with
302 additions
and
1 deletion.
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
21 changes: 21 additions & 0 deletions
21
stylecheck/testdata/src/CheckExportedFunctionDocs/CheckExportedFunctionDocs.go
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,21 @@ | ||
package pkg | ||
|
||
// whatever | ||
func foo() {} | ||
|
||
// Foo is amazing | ||
func Foo() {} | ||
|
||
// Whatever // want `comment on exported function` | ||
func Bar() {} | ||
|
||
type T struct{} | ||
|
||
// Whatever | ||
func (T) foo() {} | ||
|
||
// Foo is amazing | ||
func (T) Foo() {} | ||
|
||
// Whatever // want `comment on exported method` | ||
func (T) Bar() {} |
6 changes: 6 additions & 0 deletions
6
stylecheck/testdata/src/CheckExportedFunctionDocs/foo_test.go
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,6 @@ | ||
package pkg | ||
|
||
import "testing" | ||
|
||
// This is a test | ||
func TestFoo(t *testing.T) {} |
35 changes: 35 additions & 0 deletions
35
stylecheck/testdata/src/CheckExportedTypeDocs/CheckExportedTypeDocs.go
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,35 @@ | ||
package pkg | ||
|
||
// Some type | ||
type t1 struct{} | ||
|
||
// Some type // want `comment on exported type` | ||
type T2 struct{} | ||
|
||
// T3 is amazing | ||
type T3 struct{} | ||
|
||
type ( | ||
// Some type // want `comment on exported type` | ||
T4 struct{} | ||
// The T5 type is amazing | ||
T5 struct{} | ||
// Some type | ||
t6 struct{} | ||
) | ||
|
||
// Some types | ||
type ( | ||
T7 struct{} | ||
T8 struct{} | ||
) | ||
|
||
// Some types | ||
type ( | ||
T9 struct{} | ||
) | ||
|
||
func fn() { | ||
// Some type | ||
type T1 struct{} | ||
} |
19 changes: 19 additions & 0 deletions
19
stylecheck/testdata/src/CheckExportedVarDocs/CheckExportedVarDocs.go
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,19 @@ | ||
package pkg | ||
|
||
// Whatever | ||
var a int | ||
|
||
// Whatever // want `should be of the form` | ||
var B int | ||
|
||
// Whatever | ||
var ( | ||
// Whatever | ||
C int | ||
) | ||
|
||
func fn() { | ||
// Whatever | ||
var D int | ||
_ = D | ||
} |