From 53b9062f9e845fc732417ffdbcb6717553d45fae Mon Sep 17 00:00:00 2001 From: John Bampton Date: Mon, 1 Mar 2021 02:26:13 +1000 Subject: [PATCH] Add pre-commit check to sort and remove duplicates from the spelling wordlist (#13170) --- .pre-commit-config.yaml | 6 ++++ BREEZE.rst | 5 +-- STATIC_CODE_CHECKS.rst | 2 ++ breeze-complete | 1 + docs/spelling_wordlist.txt | 27 ++++++++-------- .../pre_commit_sort_spelling_wordlist.sh | 32 +++++++++++++++++++ 6 files changed, 57 insertions(+), 16 deletions(-) create mode 100755 scripts/ci/pre_commit/pre_commit_sort_spelling_wordlist.sh diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 37b505aca1..2dce4e6462 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -409,6 +409,12 @@ repos: language: system files: ^.pre-commit-config.yaml$|^INTHEWILD.md$ require_serial: true + - id: sort-spelling-wordlist + name: Sort alphabetically and uniquify spelling_wordlist.txt + entry: ./scripts/ci/pre_commit/pre_commit_sort_spelling_wordlist.sh + language: system + files: ^.pre-commit-config.yaml$|^docs/spelling_wordlist.txt$ + require_serial: true - id: helm-lint name: Lint Helm Chart entry: ./scripts/ci/pre_commit/pre_commit_helm_lint.sh diff --git a/BREEZE.rst b/BREEZE.rst index ddb11819d4..e6d8b6a88c 100644 --- a/BREEZE.rst +++ b/BREEZE.rst @@ -2279,8 +2279,9 @@ This is the current syntax for `./breeze <./breeze>`_: pre-commit-hook-names provide-create-sessions providers-init-file provider-yamls pydevd pydocstyle pylint pylint-tests python-no-log-warn pyupgrade restrict-start_date rst-backticks setup-order setup-extra-packages shellcheck - sort-in-the-wild stylelint trailing-whitespace update-breeze-file update-extras - update-local-yml-file update-setup-cfg-file version-sync yamllint + sort-in-the-wild sort-spelling-wordlist stylelint trailing-whitespace + update-breeze-file update-extras update-local-yml-file update-setup-cfg-file + version-sync yamllint You can pass extra arguments including options to to the pre-commit framework as passed after --. For example: diff --git a/STATIC_CODE_CHECKS.rst b/STATIC_CODE_CHECKS.rst index 1c28dd9c94..89bbc69ab6 100644 --- a/STATIC_CODE_CHECKS.rst +++ b/STATIC_CODE_CHECKS.rst @@ -164,6 +164,8 @@ require Breeze Docker images to be installed locally: ----------------------------------- ---------------------------------------------------------------- ------------ ``sort-in-the-wild`` Sort INTHEWILD.md alphabetically. ----------------------------------- ---------------------------------------------------------------- ------------ +``sort-spelling-wordlist`` Sort alphabetically and uniquify spelling_wordlist.txt. +----------------------------------- ---------------------------------------------------------------- ------------ ``stylelint`` Checks CSS files with stylelint. ----------------------------------- ---------------------------------------------------------------- ------------ ``trailing-whitespace`` Removes trailing whitespace at end of line. diff --git a/breeze-complete b/breeze-complete index 3e34c0d108..9dc4bd5d77 100644 --- a/breeze-complete +++ b/breeze-complete @@ -132,6 +132,7 @@ setup-order setup-extra-packages shellcheck sort-in-the-wild +sort-spelling-wordlist stylelint trailing-whitespace update-breeze-file diff --git a/docs/spelling_wordlist.txt b/docs/spelling_wordlist.txt index 97347d5312..a97e1077fd 100644 --- a/docs/spelling_wordlist.txt +++ b/docs/spelling_wordlist.txt @@ -15,8 +15,6 @@ Ansible AppBuilder Arg Args -asctime -ashb Async Atlassian Auth @@ -147,6 +145,7 @@ Flink FluentD Fokko Formaturas +Fspark Fundera GCS GH @@ -238,10 +237,10 @@ Lyft Maheshwari Makefile Mapreduce +Mariadb Masternode Maxime Memorystore -Mariadb Mesos MessageAttributes Metastore @@ -313,6 +312,7 @@ Reddit Redhat ReidentifyContentResponse Reinitialising +ResourceRequirements Riccomini Roadmap Robinhood @@ -353,7 +353,6 @@ SubscriberClient Subtasks Sumit Systemd -Terraform TCP TLS TTY @@ -363,6 +362,7 @@ Taskfail Templated Templating Teradata +Terraform TextToSpeechClient Tez Thinknear @@ -390,6 +390,7 @@ Vertica Vevo VideoIntelligenceServiceClient Vikram +VolumeMount WTF WaiterModel Wasb @@ -478,17 +479,17 @@ autoscaling avro aws awsbatch +backcompat backend backends -backcompat backfill backfilled backfilling backfills backoff backport -backports backported +backports backreference backtick backticks @@ -1024,13 +1025,13 @@ openfaas oper opsgenie optimise +optionality ora -orm orchestrator orgtbl +orm os ot -optionality overridable oversubscription pagerduty @@ -1146,7 +1147,6 @@ repo repos reqs resetdb -ResourceRequirements resourceVersion resultset resumable @@ -1158,8 +1158,8 @@ romeoandjuliet rootcss rowid rpc -rshift rsa +rshift rst rtype ru @@ -1207,8 +1207,8 @@ sigv skipable sku sla -slackclient slack_sdk +slackclient slas smtp sortable @@ -1278,16 +1278,16 @@ superclass svg swp symlink -symlinks symlinking +symlinks sync'ed sys syspath systemd +tableId tableau tableauserverclient tablefmt -tableId tagKey tagValue tao @@ -1382,7 +1382,6 @@ videointelligence vikramkoka virtualenv vm -VolumeMount volumeMounts wasb webProperty diff --git a/scripts/ci/pre_commit/pre_commit_sort_spelling_wordlist.sh b/scripts/ci/pre_commit/pre_commit_sort_spelling_wordlist.sh new file mode 100755 index 0000000000..9b309b9f83 --- /dev/null +++ b/scripts/ci/pre_commit/pre_commit_sort_spelling_wordlist.sh @@ -0,0 +1,32 @@ +#!/usr/bin/env bash +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +# shellcheck source=scripts/ci/libraries/_script_init.sh +. "$( dirname "${BASH_SOURCE[0]}" )/../libraries/_script_init.sh" + +SPELLING_WORDLIST="${AIRFLOW_SOURCES}/docs/spelling_wordlist.txt" +readonly SPELLING_WORDLIST + +export LC_ALL=C + +temp_file=$(mktemp) +< "${SPELLING_WORDLIST}" sort | uniq > "${temp_file}" + +cat "${temp_file}" > "${SPELLING_WORDLIST}" + +rm "${temp_file}"