OSDN Git Service

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