Skip to content

Commit 1dcc520

Browse files
authored
Merge pull request #1461 from pslldq/editorconfig
Add an .editorconfig file
2 parents cd19024 + e840077 commit 1dcc520

File tree

16 files changed

+143
-71
lines changed

16 files changed

+143
-71
lines changed

.editorconfig

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# top-most EditorConfig file
2+
root = true
3+
4+
[*]
5+
indent_style = space
6+
indent_size = 8
7+
tab_width = 8
8+
end_of_line = lf
9+
charset = utf-8
10+
trim_trailing_whitespace = true
11+
insert_final_newline = true
12+
13+
[docs/*.pod]
14+
indent_size = 4
15+
16+
[*.awk]
17+
indent_size = 4
18+
19+
[{test/greatest.h,test/functional-tests/test.sh,contrib/notification-history.sh,contrib/dunst_xr_theme_changer.sh}]
20+
indent_size = 4
21+
22+
[dunstrc*]
23+
indent_size = 4
24+
25+
# Just for historical purposes to avoid
26+
# manually reformatting whole files
27+
[src/wayland/pool-buffer.*]
28+
indent_style = tab
29+
30+
# looks to be external code
31+
[src/wayland/libgwater-wayland.*]
32+
indent_size = 4
33+
34+
[completions/*]
35+
indent_size = 4
36+
37+
[.valgrind.suppressions]
38+
indent_size = 3
39+
40+
[*.yml]
41+
indent_size = 2
42+
43+
[completions/*.zshcomp]
44+
indent_size = 2
45+
46+
[{Makefile,dunstctl,test/data/test-ini}]
47+
indent_style = tab
48+
49+
[test/functional-tests/dunstrc.vertical_align]
50+
indent_style =
51+
52+
# Contains external or generated files
53+
[src/wayland/protocols/**]
54+
indent_style =
55+
trim_trailing_whitespace = false

.editorconfig-checker.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"SpacesAfterTabs": true,
3+
"Disable": {
4+
"IndentSize": true
5+
}
6+
}

.github/workflows/main.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,3 +112,14 @@ jobs:
112112
runs-on: ubuntu-latest
113113
container:
114114
image: ghcr.io/dunst-project/docker-images:misc-doxygen
115+
116+
editorconfig:
117+
steps:
118+
- uses: actions/checkout@v4
119+
120+
- uses: editorconfig-checker/action-editorconfig-checker@main
121+
122+
- name: Check code matching .editorconfig rules with editorconfig-checker
123+
run: editorconfig-checker
124+
125+
runs-on: ubuntu-latest

HACKING.md

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,11 @@ documentation for this can be found at https://github.com/dunst-project/docker-i
7777
# Comments
7878

7979
- Comment system is held similar to JavaDoc
80-
- Use `@param` to describe all input parameters
81-
- Use `@return` to describe the output value
82-
- Use `@retval` to describe special return values (like `NULL`)
83-
- Documentation comments should start with a double star (`/**`)
84-
- Append `()` to function names and prepend variables with `#` to properly reference them in the docs
80+
- Use `@param` to describe all input parameters
81+
- Use `@return` to describe the output value
82+
- Use `@retval` to describe special return values (like `NULL`)
83+
- Documentation comments should start with a double star (`/**`)
84+
- Append `()` to function names and prepend variables with `#` to properly reference them in the docs
8585
- Add comments to all functions and methods
8686
- Markdown inside the comments is allowed and also desired
8787
- Add the comments to the prototype. Doxygen will merge the protoype and implementation documentation anyways.
@@ -104,21 +104,21 @@ documentation for this can be found at https://github.com/dunst-project/docker-i
104104
For logging, there are printf-like macros `LOG_(E|C|W|M|I|D)`.
105105

106106
- `LOG_E` (ERROR):
107-
- All messages, which lead to immediate abort and are caused by a programming error. The program needs patching and the error is not user recoverable.
108-
- e.g.: Switching over an enum, `LOG_E` would go into the default case.
107+
- All messages, which lead to immediate abort and are caused by a programming error. The program needs patching and the error is not user recoverable.
108+
- e.g.: Switching over an enum, `LOG_E` would go into the default case.
109109
- `LOG_C` (CRITICAL):
110-
- The program cannot continue to work. It is used in the wrong manner or some outer conditions are not met.
111-
- e.g.: `-config` parameter value is unreadable file
110+
- The program cannot continue to work. It is used in the wrong manner or some outer conditions are not met.
111+
- e.g.: `-config` parameter value is unreadable file
112112
- `DIE` (CRITICAL):
113-
- A shorthand for `LOG_C` and terminating the program after. This does not dump the core (unlike `LOG_E`).
113+
- A shorthand for `LOG_C` and terminating the program after. This does not dump the core (unlike `LOG_E`).
114114
- `LOG_W` (WARNING):
115-
- Something is not in shape, but it's recoverable.
116-
- e.g.: A value is not parsable in the config file, which will default.
115+
- Something is not in shape, but it's recoverable.
116+
- e.g.: A value is not parsable in the config file, which will default.
117117
- `LOG_M` (MESSAGE):
118-
- Important info, which informs about the state.
119-
- e.g.: An empty notification does get removed immediately.
118+
- Important info, which informs about the state.
119+
- e.g.: An empty notification does get removed immediately.
120120
- `LOG_I` (INFO):
121-
- Mostly unneccessary info, but important to debug (as the user) some use cases.
122-
- e.g.: print the notification contents after arriving
121+
- Mostly unneccessary info, but important to debug (as the user) some use cases.
122+
- e.g.: print the notification contents after arriving
123123
- `LOG_D` (DEBUG):
124-
- Only important during development or tracing some bugs (as the developer).
124+
- Only important during development or tracing some bugs (as the developer).

Makefile

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,9 @@ ${OBJ} ${TEST_OBJ}: Makefile config.mk
7676

7777
DATE_FMT = +%Y-%m-%d
7878
ifdef SOURCE_DATE_EPOCH
79-
BUILD_DATE ?= $(shell date -u -d "@$(SOURCE_DATE_EPOCH)" "$(DATE_FMT)" 2>/dev/null || date -u -r "$(SOURCE_DATE_EPOCH)" "$(DATE_FMT)" 2>/dev/null || date -u "$(DATE_FMT)")
79+
BUILD_DATE ?= $(shell date -u -d "@$(SOURCE_DATE_EPOCH)" "$(DATE_FMT)" 2>/dev/null || date -u -r "$(SOURCE_DATE_EPOCH)" "$(DATE_FMT)" 2>/dev/null || date -u "$(DATE_FMT)")
8080
else
81-
BUILD_DATE ?= $(shell date "$(DATE_FMT)")
81+
BUILD_DATE ?= $(shell date "$(DATE_FMT)")
8282
endif
8383
src/dunst.o: src/dunst.c
8484
${CC} -o $@ -c $< ${CPPFLAGS} ${CFLAGS} \
@@ -224,10 +224,10 @@ clean-wayland-protocols:
224224
rm -f src/wayland/protocols/*.h
225225

226226
.PHONY: install install-dunst install-dunstctl install-dunstrc \
227-
install-service install-service-dbus install-service-systemd \
228-
uninstall uninstall-dunstctl uninstall-dunstrc \
229-
uninstall-service uninstall-service-dbus uninstall-service-systemd \
230-
uninstall-keepconf uninstall-purge
227+
install-service install-service-dbus install-service-systemd \
228+
uninstall uninstall-dunstctl uninstall-dunstrc \
229+
uninstall-service uninstall-service-dbus uninstall-service-systemd \
230+
uninstall-keepconf uninstall-purge
231231
install: install-dunst install-dunstctl install-dunstrc install-service
232232

233233
install-dunst: dunst doc

completions/_dunstctl.zshcomp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,10 @@ case $state in
7171
;;
7272

7373
history-pop)
74-
local -a history_ids;
75-
history_ids=(
76-
`dunstctl history | jq -M '.data[0][].id.data'`
77-
)
74+
local -a history_ids;
75+
history_ids=(
76+
`dunstctl history | jq -M '.data[0][].id.data'`
77+
)
7878
_describe history_ids history_ids && ret=0
7979
;;
8080

completions/dunst.bashcomp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ _dunst() {
22
local opts cur prev split=false
33
_get_comp_words_by_ref cur prev
44
COMPREPLY=()
5-
opts='-v -version --version -verbosity -conf -config -print --print -startup_notification --startup_notification -h -help --help'
5+
opts='-v -version --version -verbosity -conf -config -print --print -startup_notification --startup_notification -h -help --help'
66

77
case "$prev" in
8-
-verbosity) COMPREPLY=( $( compgen -W 'crit warn mesg info debug' -- "$cur") )
8+
-verbosity) COMPREPLY=( $( compgen -W 'crit warn mesg info debug' -- "$cur") )
99
return ;;
1010
-conf|--config) _filedir
1111
return ;;

contrib/notification-history.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ tests() {
1010
history_json="$(dunstctl history)"
1111
history_items="$(printf '%s' "$history_json" | jq -r '.data[0][] | .appname.data , (.timestamp.data | tostring) , .summary.data | gsub("[\\n]"; "\\n")')" # the gsub is to really ensure no escaped new lines in the data lead us to print new lines. New lines in data have to be escaped. (Because) Actual newlines are the field separator essential to the logic of the while loop below, and rofi further down.
1212

13-
#history_items ends up looking like arrays with an order with this meaning:
13+
#history_items ends up looking like arrays with an order with this meaning:
1414
#appname (newline) timestamp (newline) summary (newline)
1515
#
1616
#NetworkManager

docs/dunst.1.pod.in

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,11 +111,11 @@ See dunst(5) for the list of accepted hints.
111111

112112
Some examples:
113113

114-
notify-send -h string:fgcolor:#ff4444
114+
notify-send -h string:fgcolor:#ff4444
115115

116-
notify-send -h string:bgcolor:#4444ff -h string:fgcolor:#ff4444 -h string:frcolor:#44ff44
116+
notify-send -h string:bgcolor:#4444ff -h string:fgcolor:#ff4444 -h string:frcolor:#44ff44
117117

118-
notify-send -h int:value:42 "Working ..."
118+
notify-send -h int:value:42 "Working ..."
119119

120120
=head1 MISCELLANEOUS
121121

docs/dunst.5.pod

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1122,7 +1122,7 @@ You may also specify a transparency component by using the format #RGBA or #RRGG
11221122
B<NOTE>: '#' is interpreted as a comment, to use it the entire value needs to be quoted.
11231123
For example:
11241124

1125-
separator_color="#123456"
1125+
separator_color="#123456"
11261126

11271127
=head1 NOTIFY-SEND HINTS
11281128

@@ -1183,11 +1183,11 @@ The transient value.
11831183

11841184
Some examples:
11851185

1186-
notify-send -h string:fgcolor:#ff4444
1186+
notify-send -h string:fgcolor:#ff4444
11871187

1188-
notify-send -h string:bgcolor:#4444ff -h string:fgcolor:#ff4444 -h string:frcolor:#44ff44
1188+
notify-send -h string:bgcolor:#4444ff -h string:fgcolor:#ff4444 -h string:frcolor:#44ff44
11891189

1190-
notify-send -h int:value:42 "Working ..."
1190+
notify-send -h int:value:42 "Working ..."
11911191

11921192
=head1 ACTIONS
11931193

0 commit comments

Comments
 (0)