OSDN Git Service

[fix] : Fixed paru option error
[alterlinux/alterlinux.git] / docs / CONTRIBUTING.md
1 # 貢献する方法 -日本語-
2
3 English version is [here](CONTRIBUTING.md#how-to-contribute---english-)
4  
5 ## コーディング規約
6
7 ### 全体
8
9 - なるべく`bash`のビルトインコマンドを使用する
10 - 外部コマンドを使用する場合は依存パッケージを追加する(極力使用しないでください)
11
12 ### 出力
13
14 - エラーメッセージは全て`STDERR`に出力する
15 - メッセージ用の関数がある場合はその関数を使用する
16 - 最小限の出力とし、冗長な出力は引数で有効化された場合のみに許可する
17
18 ### 見た目
19
20 - インデントはスペース4つとする
21 - 引数の多いコマンド(`xorriso`など)やパイプを多用する場合は`\`で改行する
22 - コードにTodoを書く場合は日付とユーザー名を書く
23
24 ### 変数や関数
25
26 - 全ての関数に概要や使い方にコメントを書く
27 - 関数の定義は`function`を付けず、`my_func () {}`を使用する
28 - 全ての変数は`${hoge}`のように括弧を使用する
29 - 関数内でしか使用しない変数は必ず`local`で宣言する
30 - コマンド置き換えは`` `echo hoge` ``ではなく`$(echo hoge)`を使用する
31 - 算術式展開は`$(( m + n ))`を使用する
32 - ローカル変数、関数は名前を`_`から始める
33
34 ### if、for、test、case、while
35
36 - `test`コマンドは必ず`[[`を使用する
37 - `do`や`then`などは`while`、`for`、`if`と同じ行に書く
38 - `case`の際はなるべくインデントを揃える
39
40 ### 例
41
42 ```bash
43 # Usage: test_hoge <str>
44 test_hoge () {
45     local _var="${1}"
46     if [[ "${var}" = "hoge" ]]; then
47         echo "${var} is hoge"
48         return 0
49     else
50         echo "${var} is not hoge"
51         return 1
52     fi
53 }
54 ```
55
56 ### その他
57
58 - 極力相対パスを使用しない
59 - ファイルパスは必ず`""`で囲む
60
61 ## Issues
62
63 Issueを送る際は以下の情報を記述して下さい。
64
65 - インストールに使用したイメージファイルへのURL
66 - 問題が発生した環境
67 - どのようなことを行ったか
68 - スクリーンショットやログ等
69 - ビルドに問題が発生した際は作業ディレクトリにある`build_options`
70
71 ## プルリクエスト
72
73 日本語もしくは英語で内容を書いて下さい。内容とは具体的に以下のものを指します。
74
75 - どのような機能を追加するか(問題を修正するのか)
76 - 現在確認されている問題(その対処方法も書ければ)
77 - 参考にした文献について
78 - 動作を確認した環境や開発環境
79
80 ---
81
82 # How to Contribute - English-
83
84 ## Coding Conventions
85
86 ### General
87
88 - Use the `bash` built-in command if possible
89 - Add a dependency package if you use an external command (please try not to use it as much as possible)
90
91 ### Output
92
93 - Output all error messages to `STDERR`
94 - If you have a function for messages, use that function
95 - Minimize output and redundant output only allow when enabled by the argument
96
97 ### Looks
98
99 - Indent should be four spaces
100 - The line break with `\` when using a lot of commands with many arguments (`xorriso`, etc.) or a lot of pipes
101 - If you write a Todo in your code, write the date and user name
102
103 ### Variables and functions
104
105 - Write comments on all functions in summary and usage
106 - The function definition does not use a `function` but uses `my_func () {}`
107 - All variables use brackets like `${hoge}`
108 - Declare variables that are used only in the function by `local`
109 - Command substitution does not use a `` `echo hoge` `` but uses `$(echo hoge)`
110 - Arithmetic expansion uses `$(( m + n ))`
111 - Local variables, functions start their names with `_`
112
113 ### if, for, test, case, while
114
115 - The `test` command must use `[[`
116 - `do`, `then`, etc. write on the same line as `while`, `for` and `if`
117 - Align indents on `cases` as much as possible
118
119 ### Example
120
121 ```bash
122 # Usage: test_hoge <str>
123 test_hoge () {
124     local _var="${1}"
125     if [[ "${var}" = "hoge" ]]; then
126         echo "${var} is hoge"
127         return 0
128     else
129         echo "${var} is not hoge"
130         return 1
131     fi
132 }
133 ```
134
135 ### Other
136
137 - Use as few relative paths as possible.
138 - Make sure to enclose the file path in `""`.
139
140 ## Issues
141
142 When you send the issue, please include the following information.
143
144 - The URL to the image file used for the installation
145 - The environment in which the problem occurred
146 - What did we do
147 - Screenshots, logs, etc.
148 - If a problem happens when you're building, Please attach the file `build_options` in the working directory
149
150 ## Pull Request
151
152 Please write content in either Japanese or English. Specifically, the content refers to the following
153
154 - What features you are going to add (or fix the problem)
155 - Known issues (and how to deal with them if you can write about them)
156 - About the references
157 - Tested environment and development environment