@@ -11,34 +11,34 @@ source "bin/deps"
1111[[ -n $( command -v rubocop) ]] || {
1212 # shellcheck disable=SC1091
1313 source bin/setup
14- setup:: main gems
14+ setup. main gems
1515}
1616
1717export __git_pre=" /tmp/rules-ruby-git-status-before-commit.$$ "
1818export __git_post=" /tmp/rules-ruby-git-status-after-commit.$$ "
1919
20- __lint:: cleanup () {
20+ __lint. cleanup () {
2121 for f in " ${__git_pre} " " ${__git_post} " ; do
2222 [[ -f " ${f} " ]] && rm -f " ${f} "
2323 done
2424}
2525
26- deps:: start-clock
27- run:: set-all abort-on-error
26+ deps. start-clock
27+ run. set-all abort-on-error
2828
29- __lint:: actions () {
29+ __lint. actions () {
3030 local sep=" ${1:- ' , ' } "
31- printf " ${bldylw} $( lib:: array:: join " ${sep} " $( lib:: util:: functions-matching " lint:: " | sed ' s/ main//g' ) ) ${clr} "
31+ printf " ${bldylw} $( lib. array. join " ${sep} " $( lib. util. functions-matching " lint. " | sed ' s/ main//g' ) ) ${clr} "
3232}
3333
34- lint:: help () {
34+ lint. help () {
3535 printf "
3636$( help-header USAGE)
3737 ${bldblk} # without any arguments runs a complete setup.${clr}
3838$( help-usage " bin/linter" )
3939
4040 ${bldblk} # alternatively, a partial linter name can be passed:${clr}
41- $( help-usage " bin/linter [ $( __lint:: actions " | " ) ]" )
41+ $( help-usage " bin/linter [ $( __lint. actions " | " ) ]" )
4242
4343$( help-header DESCRIPTION:)
4444 Runs various linters either all serially, or by name based on
@@ -59,17 +59,17 @@ $(help-example bin/linter buildifier)
5959 exit 0
6060}
6161
62- lint:: rubocop () {
63- h2:: green " Running Rubocop, please wait..."
62+ lint. rubocop () {
63+ h2. green " Running Rubocop, please wait..."
6464 run " rubocop || rubocop -a"
6565 inf " Rubocop completed."
6666 ok:
6767}
6868
6969# runs buildifer from the PATH if it exists, otherwise bazel target
7070# we want before-commit to be as fast as possible.
71- lint:: buildifier () {
72- h2:: green " Buildifier"
71+ lint. buildifier () {
72+ h2. green " Buildifier"
7373 if [[ -n $( command -v buildifier) ]]; then
7474 info " Running $( command -v buildifier) .."
7575 run " find . -name 'BUILD*' -o -name 'WORKSPACE' -o -name '*.bzl' | grep -v '.git' | xargs buildifier -v"
@@ -79,25 +79,25 @@ lint::buildifier() {
7979 fi
8080}
8181
82- lint:: all () {
82+ lint. all () {
8383 # number of modified files
8484 local changes_before=$( git status -s | md5)
85- trap __lint:: cleanup EXIT
85+ trap __lint. cleanup EXIT
8686 git status -s > " ${__git_pre} "
8787
8888 set -e
89- run:: set-all abort-on-error
90- lint:: rubocop
89+ run. set-all abort-on-error
90+ lint. rubocop
9191
9292 set -e
93- run:: set-all abort-on-error
94- lint:: buildifier
93+ run. set-all abort-on-error
94+ lint. buildifier
9595
9696 git status -s > " ${__git_post} "
9797
9898 local changes_after=$( git status -s | md5)
9999 if [[ ${changes_before} != " ${changes_after} " ]]; then
100- hl:: subtle " Git status -s output changed after before-commit hook."
100+ hl. subtle " Git status -s output changed after before-commit hook."
101101 info " Changes before before-commit hook:"
102102 hr
103103 diff " ${pre} " " ${post} "
@@ -113,32 +113,32 @@ lint::all() {
113113}
114114
115115
116- lint:: main () {
116+ lint. main () {
117117 local action=" $1 "
118118 [[ " ${action} " == " -h" || ${action} == " --help" ]] && action=" help"
119- local func=" lint:: ${action} "
119+ local func=" lint. ${action} "
120120
121121 if [[ -n ${action} ]]; then
122- if lib:: util:: is-a-function " ${func} " ; then
122+ if lib. util. is-a-function " ${func} " ; then
123123 [[ ${action} != " help" ]] && h2 " Executing partial linting for ${bldylw}${action} "
124124 shift
125125 ${func} " $@ "
126126 local code=$?
127127 [[ ${code} -eq 0 ]] && success " Linter ${action} was successful"
128128 [[ ${code} -ne 0 ]] && error " Linter failed for ${action} "
129- deps:: print-duration
129+ deps. print-duration
130130 exit ${code}
131131 else
132- h1 " Invalid action provided." " Valid lint actions are: $( __lint:: actions) "
132+ h1 " Invalid action provided." " Valid lint actions are: $( __lint. actions) "
133133 exit 1
134134 fi
135135 else
136136 set +e
137- lint:: all
138- deps:: print-duration
137+ lint. all
138+ deps. print-duration
139139 fi
140140}
141141
142- lint:: main " $@ "
142+ lint. main " $@ "
143143
144144exit 0
0 commit comments