Skip to content

Commit

Permalink
feat: add trademark-check
Browse files Browse the repository at this point in the history
Signed-off-by: ZHANG Yuntian <[email protected]>
  • Loading branch information
RadxaYuntian committed Jun 2, 2024
1 parent f5a4d8e commit 5a4b5c7
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .pre-commit-hooks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,8 @@
entry: pre_commit_hooks/main.sh check-title-initial
language: script
types_or: [markdown]
- id: trademark-check
name: Enforce proper standard when referencing trademarks
entry: pre_commit_hooks/main.sh trademark-check
language: script
types: [markdown]
22 changes: 22 additions & 0 deletions pre_commit_hooks/trademark-check.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/usr/bin/env bash

check() {
local ret=0 registered=(
"Fogwise"
)

# Add missing (r) to trademarks
for i in "${registered[@]}"; do
if grep -E "$i " "$1"
then
echo "$1: $i: (r) missing on trademark." >&2
ret=1
if ! $DRY_RUN
then
sed -i -E "s/$i /${i}® /g" "$1"
fi
fi
done

return $ret
}

0 comments on commit 5a4b5c7

Please sign in to comment.