Skip to content

Commit bbfc65e

Browse files
committed
fix(engine): address PR review comments
- Move output_format.h from userspace/falco/ to userspace/engine/ to fix reverse dependency (engine layer was including from app layer); update all include paths accordingly - Add SPDX-License-Identifier to output_format.h - Remove leftover m_first_event_in_category field from MarkdownFormatter (was set in begin_category() but never read) - Emit deprecation warning to stderr when --markdown is used Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: Paolo Polidori <paolo.polidori@sysdig.com>
1 parent 6ae5cc9 commit bbfc65e

8 files changed

Lines changed: 17 additions & 12 deletions

File tree

cmake/modules/cxxopts.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ elseif(NOT TARGET cxxopts)
3232

3333
ExternalProject_Add(
3434
cxxopts
35-
URL "https://github.com/jarro2783/cxxopts/archive/refs/tags/v3.0.0.tar.gz"
36-
URL_HASH "SHA256=36f41fa2a46b3c1466613b63f3fa73dc24d912bc90d667147f1e43215a8c6d00"
35+
URL "https://github.com/jarro2783/cxxopts/archive/refs/tags/v3.3.1.tar.gz"
36+
URL_HASH "SHA256=3bfc70542c521d4b55a46429d808178916a579b28d048bd8c727ee76c39e2072"
3737
CONFIGURE_COMMAND ""
3838
BUILD_COMMAND ""
3939
INSTALL_COMMAND ""

userspace/engine/falco_engine.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ limitations under the License.
3434
#include "falco_source.h"
3535
#include "falco_load_result.h"
3636
#include "filter_details_resolver.h"
37-
#include "../falco/output_format.h"
37+
#include "output_format.h"
3838

3939
//
4040
// This class acts as the primary interface between a program and the
@@ -63,7 +63,10 @@ class falco_engine {
6363

6464
// Print to stdout (using printf) a description of each field supported by this engine.
6565
// If source is non-empty, only fields for the provided source are printed.
66-
void list_fields(const std::string &source, bool verbose, bool names_only, output_format format) const;
66+
void list_fields(const std::string &source,
67+
bool verbose,
68+
bool names_only,
69+
output_format format) const;
6770

6871
// Provide an alternate rule reader, collector, and compiler
6972
// to compile any rules provided via load_rules*

userspace/engine/field_formatter.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ class TextFieldFormatter : public FieldFormatter {
5757

5858
void begin() override;
5959
void print_fieldclass(const sinsp_filter_factory::filter_fieldclass_info& fld_class,
60-
const std::set<std::string>& event_sources) override;
60+
const std::set<std::string>& event_sources) override;
6161
void print_field_name(const std::string& name) override;
6262
void end() override;
6363

@@ -72,7 +72,7 @@ class MarkdownFieldFormatter : public FieldFormatter {
7272

7373
void begin() override;
7474
void print_fieldclass(const sinsp_filter_factory::filter_fieldclass_info& fld_class,
75-
const std::set<std::string>& event_sources) override;
75+
const std::set<std::string>& event_sources) override;
7676
void print_field_name(const std::string& name) override;
7777
void end() override;
7878

@@ -87,7 +87,7 @@ class JsonFieldFormatter : public FieldFormatter {
8787

8888
void begin() override;
8989
void print_fieldclass(const sinsp_filter_factory::filter_fieldclass_info& fld_class,
90-
const std::set<std::string>& event_sources) override;
90+
const std::set<std::string>& event_sources) override;
9191
void print_field_name(const std::string& name) override;
9292
void end() override;
9393

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// SPDX-License-Identifier: Apache-2.0
12
/*
23
Copyright (C) 2026 The Falco Authors.
34

userspace/falco/app/actions/event_formatter.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,6 @@ void MarkdownFormatter::begin_category(const std::string& category) {
102102
printf("## %s\n\n", category.c_str());
103103
printf("Default | Dir | Name | Params \n");
104104
printf(":-------|:----|:-----|:-----\n");
105-
m_first_event_in_category = true;
106105
}
107106

108107
void MarkdownFormatter::print_event(const event_entry& e) {

userspace/falco/app/actions/event_formatter.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ limitations under the License.
2323
#include <memory>
2424
#include <nlohmann/json.hpp>
2525

26-
#include "../../output_format.h"
26+
#include "../../../engine/output_format.h"
2727

2828
struct ppm_param_info;
2929
struct ppm_event_info;
@@ -87,7 +87,6 @@ class MarkdownFormatter : public EventFormatter {
8787

8888
private:
8989
void print_param(const struct ppm_param_info* param);
90-
bool m_first_event_in_category{true};
9190
};
9291

9392
// JSON formatter

userspace/falco/app/options.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@ limitations under the License.
3030
namespace falco {
3131
namespace app {
3232

33-
static bool parse_output_format(const std::string& format_str, output_format& out, std::string& errstr) {
33+
static bool parse_output_format(const std::string &format_str,
34+
output_format &out,
35+
std::string &errstr) {
3436
if(format_str.empty()) {
3537
return true;
3638
}
@@ -117,6 +119,7 @@ bool options::parse(int argc, char **argv, std::string &errstr) {
117119
}
118120
} else if(markdown) {
119121
// If markdown flag is set and format is not specified, use MARKDOWN format
122+
fprintf(stderr, "WARNING: --markdown is deprecated, use --format markdown instead.\n");
120123
output_fmt = output_format::MARKDOWN;
121124
}
122125

userspace/falco/app/options.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ limitations under the License.
1818
#pragma once
1919

2020
#include <libsinsp/event.h>
21-
#include "../output_format.h"
21+
#include "../../engine/output_format.h"
2222

2323
#include <string>
2424
#include <vector>

0 commit comments

Comments
 (0)