Skip to content

Commit

Permalink
NGワードのチェックCIを追加
Browse files Browse the repository at this point in the history
  • Loading branch information
faithandbrave committed May 10, 2023
1 parent 68dea79 commit 058df35
Show file tree
Hide file tree
Showing 6 changed files with 69 additions and 4 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/ngword_check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: ngword check

on: [push, pull_request, workflow_dispatch]

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install requests
- uses: actions/checkout@v2
- name: check
run: python3 .github/workflows/script/ngword_check.py
46 changes: 46 additions & 0 deletions .github/workflows/script/ngword_check.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import glob
import os
import sys

NGWORD_LIST = [
("", "<br>", "<br/>"),
("", "</br>", "<br/>"),
("", "algined", "aligned"),
("", "condtion", "condition"),
("", "eror", "error"),
("", "exposion", "exposition"),
("", "noexpcet", "noexcept"),
("", "protmise_type", "promise_type"),
("", "repear", "repeat"),
("", "子ルーチン", "コルーチン"),
("reference/chrono", "dulation", "duration"),
("reference/random", "施行", "試行"),
("reference/random", "疑似", "擬似"),
]

def check_ngword(text: str, filename: str) -> bool:
found_error: bool = False

for target_dir, ngword, correct in NGWORD_LIST:
if not filename.startswith(target_dir):
continue

if ngword in text:
print("{}: the file includes ngword \"{}\". you should fix to \"{}\".".format(filename, ngword, correct))
found_error = True
return not found_error

if __name__ == '__main__':
found_error = False
current_dir = os.getcwd()
outer_link_dict = dict()
found_error = False
for p in sorted(list(glob.glob("**/*.md", recursive=True))):
with open(p) as f:
text = f.read()

if not check_ngword(text, p):
found_error = True

if found_error:
sys.exit(1)
2 changes: 1 addition & 1 deletion reference/expected/expected.void/op_constructor.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ constexpr explicit expected(unexpect_t, initializer_list<U> il, Args&&... args);
## 例外
- (2) : エラー値型の初期化から送出される例外。
- (3) : エラー値型の初期化から送出される例外。
- [`is_nothrow_move_constructible_v`](/reference/type_traits/is_nothrow_move_constructible.md)`<E>`であれば、ムーブコンストラクタはnoexpcet指定される
- [`is_nothrow_move_constructible_v`](/reference/type_traits/is_nothrow_move_constructible.md)`<E>`であれば、ムーブコンストラクタはnoexcept指定される
- (4), (5) : エラー値型の初期化から送出される例外。
- (6), (7) : エラー値型の初期化から送出される例外。
- (8) : 投げない。
Expand Down
2 changes: 1 addition & 1 deletion reference/expected/expected/op_constructor.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ constexpr bool converts-from-any-cvref =
- (1) : 正常値型の初期化から送出される例外。
- (2) : 正常値型またはエラー値型の初期化から送出される例外。
- (3) : 正常値型またはエラー値型の初期化から送出される例外。
- [`is_nothrow_move_constructible_v`](/reference/type_traits/is_nothrow_move_constructible.md)`<T>`かつ[`is_nothrow_move_constructible_v`](/reference/type_traits/is_nothrow_move_constructible.md)`<E>`であれば、ムーブコンストラクタはnoexpcet指定される
- [`is_nothrow_move_constructible_v`](/reference/type_traits/is_nothrow_move_constructible.md)`<T>`かつ[`is_nothrow_move_constructible_v`](/reference/type_traits/is_nothrow_move_constructible.md)`<E>`であれば、ムーブコンストラクタはnoexcept指定される
- (4), (5) : 正常値型またはエラー値型の初期化から送出される例外。
- (6) : 正常値型の初期化から送出される例外。
- (7), (8) : エラー値型の初期化から送出される例外。
Expand Down
2 changes: 1 addition & 1 deletion reference/ios/io_errc.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace std {
## 概要
入出力操作に関するエラーの種別を表す列挙型。エラーのカテゴリは [`iostream_category`](iostream_category.md)`()` で取得できる。
[`is_error_code_enum`](is_error_code_enum.md) の特殊化がされていることからわかるように、本列挙型は [`error_code`](../system_error/error_code.md) として使うことを意図しており、暗黙的に [`error_code`](../system_error/error_code.md) への変換が可能である。
なお、[`is_error_condition_enum`](../system_error/is_error_condition_enum.md) の特殊化はされていないため、本列挙型から [`error_condition`](../system_error/error_condition.md) に暗黙的に変換する事は出来ないが、[`make_eror_condition`](make_error_condition.md)`()` の呼び出し、および、一旦 [`error_code`](../system_error/error_code.md) に変換してから [`error_code`](../system_error/error_code.md)`::`[`default_error_condition`](../system_error/error_code/default_error_condition.md) を使用して変換する、などが可能である。
なお、[`is_error_condition_enum`](../system_error/is_error_condition_enum.md) の特殊化はされていないため、本列挙型から [`error_condition`](../system_error/error_condition.md) に暗黙的に変換する事は出来ないが、[`make_error_condition`](make_error_condition.md)`()` の呼び出し、および、一旦 [`error_code`](../system_error/error_code.md) に変換してから [`error_code`](../system_error/error_code.md)`::`[`default_error_condition`](../system_error/error_code/default_error_condition.md) を使用して変換する、などが可能である。
列挙値は唯一 `stream` のみが定義されている。
Expand Down
2 changes: 1 addition & 1 deletion reference/random/random_device.md
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,6 @@ int main()
- [random_deviceの実装(再訪) - 煙人計画](http://vaporoid.hateblo.jp/entry/2014/07/25/154852)
- [Replacing `/dev/urandom` May 4, 2016 - Security](https://lwn.net/Articles/685371/)
- [gccをwindowsで使うならstd::random_deviceを使ってはいけない - Qiita](http://qiita.com/nanashi/items/f94b78398a6c79d939e1)
- [MSC30-C. 疑似乱数の生成に rand() 関数を使用しない](https://www.jpcert.or.jp/sc-rules/c-msc30-c.html)
- [MSC30-C. 擬似乱数の生成に rand() 関数を使用しない](https://www.jpcert.or.jp/sc-rules/c-msc30-c.html)
- `CryptGenRandom`のエントロピー源(2005年時点): [Cryptographically Secure Random number on Windows without using CryptoAPI – Michael Howard's Web Log](https://blogs.msdn.microsoft.com/michael_howard/2005/01/14/cryptographically-secure-random-number-on-windows-without-using-cryptoapi/#div-comment-5543)

0 comments on commit 058df35

Please sign in to comment.