-
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.
✨ (#51) Add new hugdoc docstring linter
Fix: #51
- Loading branch information
1 parent
fadd566
commit a2836b5
Showing
3 changed files
with
32 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#! /bin/zsh | ||
|
||
# Detect missing docstrings from hugsql files | ||
|
||
# This linter could do a lot better with collecting line numbers and putting | ||
# into error-friendly format. This was a quick POC. | ||
|
||
# Look for occurrences of `-- :name ...\nNOT-- :doc` | ||
|
||
missings=( | ||
$(grep -Pzo -- '-- :name .*?\n[^-]' $1 | while read -r l; do | ||
sed -r 's/.*:name ([a-z<>?!-]+).*/\1/' ; done) | ||
) | ||
if (( $#missings > 0 )) | ||
then print "The following functions are missing docstrings:" | ||
print -l -- ${missings[1,-3]} | ||
exit 1 | ||
fi |
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