From f7810e7ecac96bf2efadb8ee948c3ddd8bece6fb Mon Sep 17 00:00:00 2001 From: Ryan O'Hara-Reid Date: Thu, 31 Jan 2019 16:10:03 +1100 Subject: [PATCH] Fix issue with codelingo verbosity on test function comments (#245) --- codelingo.yaml | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/codelingo.yaml b/codelingo.yaml index 6bcb1822..21d580ac 100644 --- a/codelingo.yaml +++ b/codelingo.yaml @@ -1,2 +1,33 @@ tenets: - - import: codelingo/effective-go + # Import effective Go bundle manually + - import: codelingo/effective-go/avoid-annotations-in-comments + - import: codelingo/effective-go/comment-first-word-as-subject + - import: codelingo/effective-go/good-package-name + - import: codelingo/effective-go/single-method-interface-name + - import: codelingo/effective-go/underscores-in-name + + # Overwrite one tenet with custom logic + # - import: codelingo/effective-go/comment-first-word-when-empty + - name: comment-first-word-when-empty + flows: + codelingo/review: + comment: | + Every exported function in a program should have a doc comment. The first sentence should be a summary that starts with the name ({{funcName}}) being declared. + From [effective go](https://golang.org/doc/effective_go.html#commentary). + codelingo/rewrite: + place: holder + query: | + import codelingo/ast/go + @review comment + @rewrite --prepend --line "// {{funcName}} is a function." + go.func_decl(depth = any): + # Customisation to exclude test packages + exclude: + go.ident: + name as funcname + regex(/_test/, funcname) + exclude: + go.comment_group + go.ident: + name as funcName + public == "true"