Skip to content
Snippets Groups Projects
Commit 36151e1e authored by Simon F's avatar Simon F Committed by Natanael Copa
Browse files

Update CODINGSTYLE.md

Spotted some minor typos, improved some wordings
parent 1926d74a
No related branches found
No related tags found
No related merge requests found
...@@ -6,7 +6,7 @@ and thus the quality of Alpine Linux, we kindly ask to follow these ...@@ -6,7 +6,7 @@ and thus the quality of Alpine Linux, we kindly ask to follow these
recommendations. recommendations.
## Language ## Language
Alpine Linux APKBUILD files are inherently just POSIX shell scripts. Try avoid Alpine Linux APKBUILD files are inherently just POSIX shell scripts. Please avoid
extensions, even if they work or are accepted by busybox ash. (using keyword extensions, even if they work or are accepted by busybox ash. (using keyword
`local` is an exception) `local` is an exception)
...@@ -14,8 +14,8 @@ extensions, even if they work or are accepted by busybox ash. (using keyword ...@@ -14,8 +14,8 @@ extensions, even if they work or are accepted by busybox ash. (using keyword
Use snake_case. Functions, variables etc. should be lower-cased with Use snake_case. Functions, variables etc. should be lower-cased with
underscores to separate words. underscores to separate words.
Local 'private' variables and functions n global scope should be pre-fixed Local 'private' variables and functions in global scope should be prefixed
with a single underscore to avoid nameclash with internal variables in with a single underscore to avoid name collisions with internal variables in
`abuild`. `abuild`.
Double underscores are reserved and should not be used. Double underscores are reserved and should not be used.
...@@ -24,7 +24,7 @@ _my_variable="data" ...@@ -24,7 +24,7 @@ _my_variable="data"
``` ```
### Bracing ### Bracing
Curly braces for functions are on the same line. Curly braces for functions should be on the same line.
```sh ```sh
prepare() { prepare() {
...@@ -32,7 +32,7 @@ prepare() { ...@@ -32,7 +32,7 @@ prepare() {
} }
``` ```
Markers to indicate a compound statement, are on the same line. Markers to indicate a compound statement should be on the same line.
#### if ...; then #### if ...; then
...@@ -52,7 +52,7 @@ Markers to indicate a compound statement, are on the same line. ...@@ -52,7 +52,7 @@ Markers to indicate a compound statement, are on the same line.
#### for ...; do #### for ...; do
```sh ```sh
for ...; do for x in foo bar baz; do
... ...
done done
``` ```
...@@ -60,13 +60,13 @@ Markers to indicate a compound statement, are on the same line. ...@@ -60,13 +60,13 @@ Markers to indicate a compound statement, are on the same line.
### Spacing ### Spacing
All keywords and operators are separated by a space. All keywords and operators are separated by a space.
For cleanliness sake, make sure there is however never any trailing whitespace. For cleanliness sake, ensure there is no trailing whitespace.
## Identation ## Identation
Indentation is one tab character, alignment is done using spaces. For example Indentation is one tab character per level, alignment is done using spaces.
using the >------- characters to indicate a tab: For example (using the >------- characters to indicate a tab):
```sh ```sh
prepare() build()
{ {
>-------make DESTDIR="${pkgdir}" \ >-------make DESTDIR="${pkgdir}" \
>------- PREFIX="/usr" >------- PREFIX="/usr"
...@@ -99,7 +99,7 @@ foo_bar="$foo" ...@@ -99,7 +99,7 @@ foo_bar="$foo"
``` ```
## Subshell usage ## Subshell usage
Use `$()` syntax, not backticks, as backticks are hard to spot. Use `$()` syntax, not backticks.
## Sorting ## Sorting
Some items tend to benefit from being sorted. A list of sources, dependencies Some items tend to benefit from being sorted. A list of sources, dependencies
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment