diff options
author | Emmanuele Bassi <ebassi@gnome.org> | 2022-01-17 11:22:52 +0000 |
---|---|---|
committer | Emmanuele Bassi <ebassi@gmail.com> | 2022-03-03 14:06:11 +0000 |
commit | 430ba87d96d10bfa5fbf0d237d19a30c200996a2 (patch) | |
tree | 1bfa654ad277c92ea85232f37356717b9f44df41 | |
parent | 2a2d1ae1c68d1c5364685cd64d723afced27d795 (diff) | |
download | libgweather-430ba87d96d10bfa5fbf0d237d19a30c200996a2.tar.gz |
tests: Add coding style check
Since we're going to run it on our CI pipeline, we might as well do this
in the test suite. This should allow people to catch coding style issues
before opening a merge request. And by "people" I really mean "me".
-rw-r--r-- | libgweather/meson.build | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/libgweather/meson.build b/libgweather/meson.build index b5d0b4d..f573d45 100644 --- a/libgweather/meson.build +++ b/libgweather/meson.build @@ -150,7 +150,6 @@ gweather_enum_types = gnome.mkenums('gweather-enum-types', install_headers(gweather_headers + ['gweather.h'], subdir: header_subdir) gweather_c_sources = [ - gweather_enum_types, 'gweather.c', 'gweather-info.c', 'gweather-location.c', @@ -166,10 +165,15 @@ gweather_priv_sources = [ 'weather-moon.c', ] -introspection_sources = gweather_c_sources + gweather_headers +introspection_sources = [ + gweather_enum_types, + gweather_c_sources, + gweather_headers, +] libgweather_static = static_library('gweather', sources: [ + gweather_enum_types, gweather_c_sources, gweather_priv_sources, ], @@ -180,7 +184,8 @@ libgweather_static = static_library('gweather', ], ) -libgweather_static_dep = declare_dependency(sources: gweather_c_sources, +libgweather_static_dep = declare_dependency( + sources: gweather_enum_types, include_directories: [ include_directories('.'), include_directories('..'), @@ -277,4 +282,13 @@ pkgconfig.generate( if get_option('tests') subdir('tests') subdir('tools') + + clang_format = find_program('clang-format', required: false) + if clang_format.found() + test('style-format', clang_format, + args: ['--dry-run', '--Werror', gweather_c_sources], + workdir: meson.current_source_dir(), + suite: ['lint'], + ) + endif endif |