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

16 files changed

+143
-71
lines changed

.editorconfig

+55
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

+6
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

+11
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

+17-17
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

+6-6
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

+4-4
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

+2-2
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

+1-1
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

+3-3
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

+4-4
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

src/input.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@
55

66
/**
77
* Handle incoming mouse click events
8-
*
8+
*
99
* @param button code, A linux input event code
1010
* @param button_down State of the button
1111
* @param mouse_x X-position of the mouse, relative to the window
1212
* @param mouse_y Y-position of the mouse, relative to the window
1313
*
1414
*/
1515
void input_handle_click(unsigned int button, bool button_down, int mouse_x, int mouse_y);
16-
16+
1717
#endif
1818
/* vim: set ft=c tabstop=8 shiftwidth=8 expandtab textwidth=0: */

src/settings.h

+20-20
Original file line numberDiff line numberDiff line change
@@ -40,32 +40,32 @@ enum mouse_action { MOUSE_NONE, MOUSE_DO_ACTION, MOUSE_CLOSE_CURRENT,
4040
#define ZWLR_LAYER_SHELL_V1_LAYER_ENUM
4141
// Needed for compiling without wayland dependency
4242
enum zwlr_layer_shell_v1_layer {
43-
ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND = 0,
44-
ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM = 1,
45-
ZWLR_LAYER_SHELL_V1_LAYER_TOP = 2,
46-
ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY = 3,
43+
ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND = 0,
44+
ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM = 1,
45+
ZWLR_LAYER_SHELL_V1_LAYER_TOP = 2,
46+
ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY = 3,
4747
};
4848
#endif /* ZWLR_LAYER_SHELL_V1_LAYER_ENUM */
4949

5050
#ifndef ZWLR_LAYER_SURFACE_V1_ANCHOR_ENUM
5151
#define ZWLR_LAYER_SURFACE_V1_ANCHOR_ENUM
5252
enum zwlr_layer_surface_v1_anchor {
53-
/**
54-
* the top edge of the anchor rectangle
55-
*/
56-
ZWLR_LAYER_SURFACE_V1_ANCHOR_TOP = 1,
57-
/**
58-
* the bottom edge of the anchor rectangle
59-
*/
60-
ZWLR_LAYER_SURFACE_V1_ANCHOR_BOTTOM = 2,
61-
/**
62-
* the left edge of the anchor rectangle
63-
*/
64-
ZWLR_LAYER_SURFACE_V1_ANCHOR_LEFT = 4,
65-
/**
66-
* the right edge of the anchor rectangle
67-
*/
68-
ZWLR_LAYER_SURFACE_V1_ANCHOR_RIGHT = 8,
53+
/**
54+
* the top edge of the anchor rectangle
55+
*/
56+
ZWLR_LAYER_SURFACE_V1_ANCHOR_TOP = 1,
57+
/**
58+
* the bottom edge of the anchor rectangle
59+
*/
60+
ZWLR_LAYER_SURFACE_V1_ANCHOR_BOTTOM = 2,
61+
/**
62+
* the left edge of the anchor rectangle
63+
*/
64+
ZWLR_LAYER_SURFACE_V1_ANCHOR_LEFT = 4,
65+
/**
66+
* the right edge of the anchor rectangle
67+
*/
68+
ZWLR_LAYER_SURFACE_V1_ANCHOR_RIGHT = 8,
6969
};
7070
#endif /* ZWLR_LAYER_SURFACE_V1_ANCHOR_ENUM */
7171

src/wayland/wl.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -684,7 +684,7 @@ bool wl_have_fullscreen_window(void) {
684684
output_name = current_output->global_name;
685685

686686
struct toplevel_v1 *toplevel;
687-
wl_list_for_each(toplevel, &toplevel_list, link) {
687+
wl_list_for_each(toplevel, &toplevel_list, link) {
688688
if (!(toplevel->current.state & TOPLEVEL_STATE_FULLSCREEN &&
689689
toplevel->current.state &
690690
TOPLEVEL_STATE_ACTIVATED))

test/draw.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,8 @@ struct length get_small_max_height(void)
7777
// by notification content
7878
// future tests targeting dynamic sizing logic could be added
7979
// to address this limitation
80-
struct length height = { 0, 10 };
81-
return height;
80+
struct length height = { 0, 10 };
81+
return height;
8282
}
8383

8484
int get_expected_dimension_height(int layout_count, int height)
@@ -293,7 +293,7 @@ TEST test_calculate_dimensions_height_min(void)
293293
{
294294
struct length original_height = settings.height;
295295
bool orginal_gap_size = settings.gap_size;
296-
// NOTE: Should be big enough to fit the notification nicely
296+
// NOTE: Should be big enough to fit the notification nicely
297297
settings.height.min = 100;
298298
settings.height.max = 200;
299299
settings.gap_size = 0;

test/functional-tests/test.sh

+5-5
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,18 @@ function keypress {
1616
}
1717

1818
function tmp_dunstrc {
19-
cp "$TESTDIR/$1" "$TESTDIR/dunstrc.tmp"
20-
echo -e "\n$2" >> "$TESTDIR/dunstrc.tmp"
19+
cp "$TESTDIR/$1" "$TESTDIR/dunstrc.tmp"
20+
echo -e "\n$2" >> "$TESTDIR/dunstrc.tmp"
2121
}
2222

2323
function tmp_clean {
2424
rm "$TESTDIR/dunstrc.tmp"
2525
}
2626

2727
function start_dunst {
28-
killall dunst 2>/dev/null
29-
$DUNST -config "$TESTDIR/$1" &
30-
sleep 0.05
28+
killall dunst 2>/dev/null
29+
$DUNST -config "$TESTDIR/$1" &
30+
sleep 0.05
3131
}
3232

3333
function basic_notifications {

test/test-install.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@ export SERVICEDIR_SYSTEMD="/systemd"
1414
export SERVICEDIR_DBUS="/dbus"
1515

1616
do_make() { # for convenience/conciseness
17-
make -C "${BASE}" "$@"
17+
make -C "${BASE}" "$@"
1818
}
1919

2020
check_dest() {
21-
# Check file list given on stdin and see if all are actually present
22-
diff -u <(find "${DESTDIR}" -type f -printf "%P\n" | sort) <(sort -)
21+
# Check file list given on stdin and see if all are actually present
22+
diff -u <(find "${DESTDIR}" -type f -printf "%P\n" | sort) <(sort -)
2323
}
2424

2525
do_make install

0 commit comments

Comments
 (0)