diff --git a/.cspell.json b/.cspell.json index b11d0b40..81734c25 100644 --- a/.cspell.json +++ b/.cspell.json @@ -26,7 +26,7 @@ ], "ignoreRegExpList": [ // Copyright notice - "Copyright ((\\(c\\)|\\(C\\)|©) )?.*", + "Copyright .*", // GHA actions/workflows "uses: .+@", // GHA context (repo name, owner name, etc.) @@ -35,6 +35,8 @@ "( |\\[)@[\\w_-]+", // Git config username "git config user.name .*", + // Username in todo comment + "(TODO|FIXME)\\([\\w_., -]+\\)", // Cargo.toml authors "authors *= *\\[.*\\]", "\".* <[\\w_.+-]+@[\\w.-]+>\"" diff --git a/.github/.cspell/organization-dictionary.txt b/.github/.cspell/organization-dictionary.txt index 558844c4..b9ff7bda 100644 --- a/.github/.cspell/organization-dictionary.txt +++ b/.github/.cspell/organization-dictionary.txt @@ -85,6 +85,7 @@ acqrel alloc bools builtins +bytecount canonicalize consts ctypes @@ -98,6 +99,7 @@ inlateout intrinsics lateout mclass +memcpy msrv nand nomem @@ -110,6 +112,7 @@ rclass repr rfind rfold +rposition rsplit rustlib seqcst @@ -124,6 +127,8 @@ unsized upcastable // Other +armel +armhf binutils connrefused cygwin diff --git a/tools/tidy.sh b/tools/tidy.sh index 73c4d48a..56e2a903 100755 --- a/tools/tidy.sh +++ b/tools/tidy.sh @@ -41,6 +41,14 @@ warn() { fi should_fail=1 } +error() { + if [[ -n "${GITHUB_ACTIONS:-}" ]]; then + echo "::error::$*" + else + echo >&2 "error: $*" + fi + should_fail=1 +} if [[ $# -gt 0 ]]; then cat <()\`:" + echo "${cast_without_turbofish}" + fi fi # C/C++ (if exists) @@ -103,8 +116,8 @@ if [[ -n "$(git ls-files '*.yml')$(git ls-files '*.js')$(git ls-files '*.json')" permissions=$(yq '.permissions' "${workflow}" | jq -c) case "${permissions}" in '{"contents":"read"}' | '{"contents":"none"}' | '{}') ;; - null) warn "${workflow}: top level permissions not found; it must be 'contents: read' or weaker permissions" ;; - *) warn "${workflow}: only 'contents: read' and weaker permissions are allowed at top level; if you want to use stronger permissions, please set job-level permissions" ;; + null) error "${workflow}: top level permissions not found; it must be 'contents: read' or weaker permissions" ;; + *) error "${workflow}: only 'contents: read' and weaker permissions are allowed at top level; if you want to use stronger permissions, please set job-level permissions" ;; esac # Make sure the 'needs' section is not out of date. if grep -q '# tidy:needs' "${workflow}" && ! grep -Eq '# *needs: \[' "${workflow}"; then @@ -117,7 +130,7 @@ if [[ -n "$(git ls-files '*.yml')$(git ls-files '*.js')$(git ls-files '*.json')" printf -v jobs '%s, ' "${jobs_actual[@]}" sed -i "s/needs: \[.*\] # tidy:needs/needs: [${jobs%, }] # tidy:needs/" "${workflow}" check_diff "${workflow}" - warn "${workflow}: please update 'needs' section in 'ci-success' job" + error "${workflow}: please update 'needs' section in 'ci-success' job" fi fi done @@ -127,7 +140,7 @@ if [[ -n "$(git ls-files '*.yml')$(git ls-files '*.js')$(git ls-files '*.json')" fi fi if [[ -n "$(git ls-files '*.yaml')" ]]; then - warn "please use '.yml' instead of '.yaml' for consistency" + error "please use '.yml' instead of '.yaml' for consistency" git ls-files '*.yaml' fi @@ -199,7 +212,7 @@ EOF fi dup=$(sed '/^$/d' .github/.cspell/project-dictionary.txt "${dictionary}" | LC_ALL=C sort -f | uniq -d -i | (grep -v '//.*' || true)) if [[ -n "${dup}" ]]; then - warn "duplicated words in dictionaries; please remove the following words from .github/.cspell/project-dictionary.txt" + error "duplicated words in dictionaries; please remove the following words from .github/.cspell/project-dictionary.txt" echo "=======================================" echo "${dup}" echo "======================================="