Skip to content

Commit

Permalink
lint: linter for package docstrings (mmcloughlin#59)
Browse files Browse the repository at this point in the history
  • Loading branch information
mmcloughlin authored Jan 23, 2019
1 parent f1e854a commit 9c913ee
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 0 deletions.
6 changes: 6 additions & 0 deletions script/lib.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Print an error message to the terminal.
print_error() {
local red='\033[0;31m'
local nocolor='\033[0m'
printf "${red}error${nocolor}\t$1\n"
}
3 changes: 3 additions & 0 deletions script/lint
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,6 @@ golangci-lint run ./... ./examples/...

# Check asm declarations.
asmdecl ./...

# Custom linters.
./script/linter/pkgdoc
12 changes: 12 additions & 0 deletions script/linter/pkgdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash -e

source script/lib.sh

status=0
pkgs=$(go list -f '{{if not .Doc}}{{.ImportPath}}{{end}}' ./...)
for pkg in ${pkgs}; do
print_error "${pkg} missing docstring"
status=1
done

exit ${status}
2 changes: 2 additions & 0 deletions tests/fixedbugs/issue50/doc.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// Package issue50 tests for 32-bit MOVD/MOVQ instruction forms.
package issue50

0 comments on commit 9c913ee

Please sign in to comment.