Title
#core
Stefano Bonicatti

Stefano Bonicatti

09/25/2019, 6:10 PM
@zwass That's.. strange? How are you checking formatting and how are you fixing them?
zwass

zwass

09/25/2019, 6:15 PM
cmake --build . --target format
-- Found ccache: /usr/local/bin/ccache
-- osquery version: 4.0.2-15-g80d4a1df
-- Build type: RelWithDebInfo
-- Shared libraries: OFF
-- Importing: facebook/markupsafe
-- Importing: facebook/jinja2
-- Importing: facebook/augeas
-- Importing: facebook/boost
-- Importing: facebook/bzip2
-- Importing: facebook/gflags
-- Importing: facebook/glibc
-- Importing: facebook/glog
-- Importing: facebook/googletest
-- Importing: facebook/libarchive
-- Importing: facebook/libmagic
-- Importing: facebook/librdkafka
-- Importing: facebook/libxml2
-- Importing: facebook/linenoise-ng
-- Importing: facebook/lldpd
-- Importing: facebook/popt
-- Importing: facebook/rapidjson
-- Importing: facebook/rocksdb
-- Importing: facebook/sleuthkit
-- Importing: facebook/smartmontools
-- Importing: source/sqlite
-- Disabling the SQLite R*Tree module
-- Disabling the SQLite FTS extensions
-- Importing: facebook/ssdeep-cpp
-- Importing: facebook/thrift
-- Importing: facebook/yara
-- Importing: facebook/zlib
-- Importing: facebook/zstd
-- Importing: facebook/openssl
-- Importing: facebook/aws-sdk-cpp
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/zwass/dev/osquery/build
Scanning dependencies of target format
no modified files to format
Built target format
$ cmake --build . --target format_check
Modifications failed code formatting requirements

diff --git a/tests/integration/tables/known_hosts.cpp b/tests/integration/tables/known_hosts.cpp
index a61adca9..e41c8f8e 100644
--- a/tests/integration/tables/known_hosts.cpp
+++ b/tests/integration/tables/known_hosts.cpp
@@ -30,9 +30,7 @@ TEST_F(KnownHostsTest, test_sanity) {
                     "therefore won't be tested";
   } else {
     auto const row_map = ValidationMap{
-        {"uid", IntType},
-        {"key", NonEmptyString},
-        {"key_file", FileOnDisk},
+        {"uid", IntType}, {"key", NonEmptyString}, {"key_file", FileOnDisk},
     };
     validate_rows(rows, row_map);
   }
diff --git a/tests/integration/tables/process_envs.cpp b/tests/integration/tables/process_envs.cpp
index 41961370..e260de62 100644
--- a/tests/integration/tables/process_envs.cpp
+++ b/tests/integration/tables/process_envs.cpp
@@ -34,9 +34,7 @@ TEST_F(ProcessEnvs, test_sanity) {
   QueryData data = execute_query("select * from process_envs");

   ValidationMap row_map = {
-      {"pid", NonNegativeInt},
-      {"key", NonEmptyString},
-      {"value", NormalType},
+      {"pid", NonNegativeInt}, {"key", NonEmptyString}, {"value", NormalType},
   };
   validate_rows(data, row_map);


make[3]: *** [CMakeFiles/format_check] Error 1
make[2]: *** [CMakeFiles/format_check.dir/all] Error 2
make[1]: *** [CMakeFiles/format_check.dir/rule] Error 2
make: *** [format_check] Error 2
theopolis

theopolis

09/26/2019, 11:25 AM
was this resolved? I'm asking because I've seen in the past that newer versions of
clang-format
(clang) introduce new format preferences. If the CI is running a newer version then it may try to format the code differently. The solution is to apply the preference in our clang-format configuration and apply the formatting changes in a follow-up PR.
zwass

zwass

09/26/2019, 10:08 PM
I don’t think this is resolved. In the example above the format and check are inconsistent in the same environment.