Skip to content

Commit

Permalink
use inclusive language (#10)
Browse files Browse the repository at this point in the history
* depend on 0.1.0 baggage core

* use inslucive language

* Update scripts/validate_language.sh

Co-authored-by: Yim Lee <[email protected]>

Co-authored-by: Yim Lee <[email protected]>
  • Loading branch information
ktoso and yim-lee authored Jan 25, 2021
1 parent e1bff92 commit f976533
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 7 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ Please refer to in-depth discussion and documentation in the [Swift Distributed

## Contributing

Please make sure to run the `./scripts/sanity.sh` script when contributing, it checks formatting and similar things.
Please make sure to run the `./scripts/soundness.sh` script when contributing, it checks formatting and similar things.

You can make ensure it always is run and passes before you push by installing a pre-push hook with git:

```
echo './scripts/sanity.sh' > .git/hooks/pre-push
echo './scripts/soundness.sh' > .git/hooks/pre-push
```
2 changes: 1 addition & 1 deletion Sources/Baggage/LoggingContext.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
///
/// ### Implementation notes
/// Conforming types MUST exhibit Value Semantics (i.e. be a pure `struct`, or implement the Copy-on-Write pattern),
/// in order to implement the `set` requirements of the baggage and logger effectively, and also for their user's sanity,
/// in order to implement the `set` requirements of the baggage and logger effectively, and also for ease of understanding,
/// as a reference semantics context type can be very confusing to use when shared between multiple threads, as often is the case in server side environments.
///
/// It is STRONGLY encouraged to use the `DefaultLoggingContext` as inspiration for a correct implementation of a `LoggingContext`,
Expand Down
4 changes: 2 additions & 2 deletions docker/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ services:
- CAP_NET_RAW
- CAP_NET_BIND_SERVICE

sanity:
soundness:
<<: *common
command: /bin/bash -xcl "./scripts/sanity.sh"
command: /bin/bash -xcl "./scripts/soundness.sh"

docs:
<<: *common
Expand Down
1 change: 1 addition & 0 deletions scripts/sanity.sh → scripts/soundness.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,6 @@ else
fi

bash $here/validate_license_headers.sh
bash $here/validate_language.sh
bash $here/validate_format.sh
bash $here/validate_naming.sh
31 changes: 31 additions & 0 deletions scripts/validate_language.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/bash
##===----------------------------------------------------------------------===##
##
## This source file is part of the Swift Distributed Tracing Baggage open source project
##
## Copyright (c) 2021 Apple Inc. and the Swift Distributed Tracing Baggage project authors
## Licensed under Apache License v2.0
##
## See LICENSE.txt for license information
##
## SPDX-License-Identifier: Apache-2.0
##
##===----------------------------------------------------------------------===##

set -eu

printf "=> Checking for unacceptable language... "
# This greps for unacceptable terminology. The square bracket[s] are so that
# "git grep" doesn't find the lines that greps :).
unacceptable_terms=(
-e blacklis[t]
-e whitelis[t]
-e slav[e]
-e sanit[y]
)
if git grep --color=never -i "${unacceptable_terms[@]}" > /dev/null; then
printf "\033[0;31mUnacceptable language found.\033[0m\n"
git grep -i "${unacceptable_terms[@]}"
exit 1
fi
printf "\033[0;32mokay.\033[0m\n"
4 changes: 2 additions & 2 deletions scripts/validate_license_headers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ here="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

function replace_acceptable_years() {
# this needs to replace all acceptable forms with 'YEARS'
sed -e 's/2019-2020/YEARS/' -e 's/2020/YEARS/'
sed -e 's/2019-2020/YEARS/' -e 's/2019-2021/YEARS/' -e 's/2020/YEARS/' -e 's/2021/YEARS/'
}

printf "=> Checking license headers\n"
tmp=$(mktemp /tmp/.swift-baggage-context-sanity_XXXXXX)
tmp=$(mktemp /tmp/.swift-baggage-context-soundness_XXXXXX)

for language in swift-or-c bash dtrace; do
printf " * $language... "
Expand Down

0 comments on commit f976533

Please sign in to comment.