Commit add18279 authored by Leo's avatar Leo

Add more documentation on STYLE and make the implementation simpler

parent e263b57b
......@@ -40,6 +40,10 @@ Won't cause any issues, are specific style issues pertinent to a concerned devel
or contributor. the _APKBUILD\_STYLE_ variable can be set to a specific value to enable
a subset of checks that the specific developer or user uses.
When a check belongs to this category this manual page also provides information on which
developers use a specific style check as developers can sometimes both want to have the
same check done on their own style.
Current valid values are:
- leo (style linting for leo)
......@@ -180,12 +184,20 @@ The APKBUILD's *pkgname* variable is quoted. It must not be quoted.
Severity: Style, Certainty: Possible
Present in the _APKBUILD\_STYLE_ of:
- leo
## pkgver-quoted [AL4]
The APKBUILD's *pkgver* variable is quoted. It must not be quoted.
Severity: Style, Certainty: Possible
Present in the _APKBUILD\_STYLE_ of:
- leo
## empty-variable [AL5]
The APKBUILD has variables that are empty values, they can safely be removed.
......@@ -247,6 +259,10 @@ space.
Severity: Style, Certainty: Certain
Present in the _APKBUILD\_STYLE_ of:
- leo
## space-after-function-parenthesis [AL11]
The APKBUILD doesn't have a space after the function parenthesis or has more
......@@ -254,6 +270,10 @@ than one space. Use only one space after the function parenthesis.
Severity: Style, Certainty: Certain
Present in the _APKBUILD\_STYLE_ of:
- leo
## newline-opening-brace [AL12]
The APKBUILD has a newline before the opening brace of a function. Put the
......@@ -262,6 +282,10 @@ function parenthesis.
Severity: Style, Certainty: Certain
Present in the _APKBUILD\_STYLE_ of:
- leo
## superfluous-cd-builddir [AL13]
The APKBUILD has *cd "$builddir"* statements that are superfluous. Remove them.
......
......@@ -74,14 +74,12 @@ unnecessary_return_1() {
}
pkgname_quoted() {
[ "$APKBUILD_STYLE" != "leo" ] && return 0
[ "$SKIP_PKGNAME_QUOTED" ] && return 0
[ "$SKIP_AL3" ] && return 0
scan '^pkgname="[^$]+"' "pkgname must not be quoted" 'AL3' 'TP'
}
pkgver_quoted() {
[ "$APKBUILD_STYLE" != "leo" ] && return 0
[ "$SKIP_PKGVER_QUOTED" ] && return 0
[ "$SKIP_AL4" ] && return 0
scan '^pkgver="[^$]+"' "pkgver must not be quoted" 'AL4' 'TP'
......@@ -125,21 +123,18 @@ function_keyword() {
}
space_before_function_parenthesis() {
[ "$APKBUILD_STYLE" != "leo" ] && return 0
[ "$SKIP_SPACE_BEFORE_FUNCTION_PARENTHESIS" ] && return 0
[ "$SKIP_AL10" ] && return 0
scan '^\t*[^ ]* *\(\)' 'do not use space before function parenthesis' 'AL10' 'TC'
}
space_after_function_parenthesis() {
[ "$APKBUILD_STYLE" != "leo" ] && return 0
[ "$SKIP_SPACE_AFTER_FUNCTION_PARENTHESIS" ] && return 0
[ "$SKIP_AL11" ] && return 0
scan '^\t*[^ ]*\(\)(| *){' 'use one space after function parenthesis' 'AL11' 'TC'
}
newline_opening_brace() {
[ "$APKBUILD_STYLE" != "leo" ] && return 0
[ "$SKIP_NEWLINE_OPENING_BRACE" ] && return 0
[ "$SKIP_AL12" ] && return 0
scan '^\t*[^ ]*\(\)$' 'do not use a newline before function opening brace' 'AL12' 'TC'
......@@ -220,6 +215,15 @@ _builddir_is_set() {
fi
}
_run_apkbuild_leo() {
# Run all tests from Leo
pkgname_quoted &
pkgver_quoted &
space_before_function_parenthesis &
space_after_function_parenthesis &
newline_opening_brace &
}
ret=0
for apkbuild; do
if [ -f "$apkbuild" ]; then
......@@ -232,18 +236,16 @@ for apkbuild; do
default_builddir_value &
_builddir_is_set &
# Run apkbuild styles from leo
[ "$APKBUILD_STYLE" = "leo" ] && _run_apkbuild_leo &
unnecessary_return_1 &
pkgname_quoted &
pkgver_quoted &
empty_variable &
custom_variable &
indent_tabs &
trailing_whitespace &
backticks_usage &
function_keyword &
space_before_function_parenthesis &
space_after_function_parenthesis &
newline_opening_brace &
pkgname_has_uppercase &
pkgver_has_pkgrel &
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment