|
1 | | -# Contributing code |
| 1 | +# Anarchy's contributing guide |
2 | 2 |
|
3 | | -* Follow shell scripting best practices (mostly as described in |
| 3 | +You can help contribute to Anarchy in many ways, including |
| 4 | + |
| 5 | +## Writing code |
| 6 | + |
| 7 | +* Follow shell scripting best practices (e.g. as described in |
4 | 8 | [Google's shell style guide](https://google.github.io/styleguide/shell.xml)) |
5 | | -* Try to be POSIX compliant (if that's not possible target bash) |
6 | | -* Use `${variable}` instead of `$variable` |
7 | | -* Constants should be `UPPER_CASE`, other variables `lower_case` |
| 9 | +* Try to be POSIX compliant |
| 10 | +* Use `"${variable}"` instead of `$variable` |
| 11 | +* Constants (and global variables) should be in `UPPER_CASE`, other variables |
| 12 | +should be in `lower_case` |
8 | 13 | * Use single square brackets (`[ condition ]`) for conditionals |
9 | 14 | (e.g. in 'if' statements) |
10 | | -* Write good comments where needed (e.g. in complicated loops/functions) |
11 | | -* Use different error codes when exiting (0 for proper exit, 1+ for error exits) |
12 | | -and explain them at the top of the file |
13 | | -* Use the `log` function as much as possible (as long as it makes sense) |
| 15 | +* Write clean and readable code |
| 16 | +* Write comments where needed (e.g. explaining functions) |
| 17 | +* Explain what arguments a function takes (if any) |
| 18 | +* Use different error codes when exiting and explain when they occur |
| 19 | +at the top of the file |
| 20 | +* If you've created a new file or made big changes (judge this by yourself), |
| 21 | +you can add a copyright disclaimer below the shebang and any other copyright |
| 22 | +notices (e.g. `Copyright (C) Jane Doe <contact@jane.doe>`) |
| 23 | +* Use the `log` function if necessary |
14 | 24 | * Always line wrap at 80 characters |
15 | | -* Scripts don't need a `.sh` suffix and should have a `-` between words |
16 | | -* Libraries (`libs` directory) should always have a `.sh` suffix and an |
17 | | -explanation of what they do |
| 25 | +* Scripts are named `setup-*` (without a `.sh` extension) |
| 26 | +* Libraries (`lib` directory) should always have a `.sh` suffix and NO shebang |
18 | 27 | * Neither script nor libraries should be executable (their permissions are |
19 | 28 | set during compilation) |
| 29 | +* Use shellscript to error-check your code |
| 30 | +* Test your code before submitting a PR (unless it's a draft) |
20 | 31 |
|
21 | | -Check for compliance and errors with [shellcheck](https://www.shellcheck.net/): |
22 | | - |
23 | | -`shellcheck -s sh -x <script>` |
24 | | - |
25 | | -**Always test your scripts before submitting the PR.** |
26 | | - |
27 | | -If you need help remembering commands or want to check out some tips |
28 | | -visit [devhints.io](https://devhints.io/bash) to do so. |
29 | | - |
30 | | -# Translating |
| 32 | +## Translating (updating existing translations) |
31 | 33 |
|
32 | 34 | Anarchy Linux supports a bunch of languages, most of which need maintainers. |
33 | 35 |
|
34 | 36 | * Make sure to use the UTF-8 encoding |
35 | | -* Don't change the variable names (e.g. intro_msg=) |
36 | | -* Don't remove any occurrence of (e.g. \n or \n\n - new lines) |
37 | | -* Don't remove any special characters (e.g. $a, or quotes) |
38 | | -* Don't edit variables within the text (e.g. /dev/${DRIVE} or ${user}) |
39 | | -* Add yourself to the maintainers list |
40 | | -(and your email for possible further communication) |
| 37 | +* Don't change the variable names (e.g. `intro_msg=`) |
| 38 | +* Don't remove any occurrence of `\n` or `\n\n` (new lines) |
| 39 | +* Don't remove any special characters (e.g. `$a` or quotes) |
| 40 | +* Don't edit variables within the text (e.g. `/dev/${DRIVE}` or `${user}`) |
41 | 41 | * Compare the finished file with english.conf |
| 42 | +* If you intend to maintain the translation, add yourself as a maintainer |
| 43 | +at the top of the file (example below) |
| 44 | +* If there are existing maintainers, add yourself on a new line below theirs |
| 45 | + |
| 46 | +``` |
| 47 | +# Maintainer: John Doe <contact@john.doe> |
| 48 | +# Maintainer: Jane Doe <contact@jane.doe> |
| 49 | +``` |
42 | 50 |
|
43 | 51 | _Comparing language files to one another makes Anarchy more consistent |
44 | 52 | and easier to update in the future._ |
45 | 53 |
|
46 | | -## Translating new languages |
| 54 | +## Translating Anarchy to new languages |
47 | 55 |
|
48 | 56 | * Ask yourself if you're committed enough to translate the whole file |
49 | 57 | (check english.conf for size comparison - ~500 translations) |
50 | 58 | * Copy the `english.conf` file and rename it to your language's |
51 | | -english name (e.g. "portuguese.conf" or "spanish.conf") |
| 59 | +english name (e.g. `portuguese.conf` or `spanish.conf`) |
52 | 60 | * Change the LANG variable to your language's UTF-8 locale (e.g. `sl_SI.UTF-8`) |
53 | | -* Check general rules/recommendations below |
| 61 | +* Read above recommendations |
0 commit comments