Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions .bazelrc
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
# Disable header-only parsing to avoid generating header-only
# compile actions that some tools (like hedron's compile-commands
# extractor) can't handle. This prevents running into errors such
# as "No source files found in compile args" when running
# `bazel run @hedron_compile_commands//:refresh_all`.
build --features=-parse_headers

# Fix for "relocation refers to local symbol in discarded section"
build --copt=-fno-asynchronous-unwind-tables
build --linkopt=-Wl,--gc-sections
Expand Down
2 changes: 1 addition & 1 deletion .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ HeaderFilterRegex: ".*/openfeature/.*"
ExcludeHeaderFilterRegex: ".*\\.pb\\.h|.*\\.grpc\\.pb\\.h"

# Treat all warnings as errors (optional, good for strict CI/CD)
WarningsAsErrors: ""
WarningsAsErrors: "*"

CheckOptions:
- key: readability-identifier-naming.ClassCase
Expand Down
32 changes: 30 additions & 2 deletions .github/workflows/ci-format-test-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
steps:
- uses: actions/checkout@v6
with:
submodules: 'recursive'
submodules: "recursive"

- uses: bazel-contrib/setup-bazel@0.18.0
with:
Expand All @@ -31,25 +31,53 @@ jobs:
steps:
- uses: actions/checkout@v6
with:
submodules: 'recursive'
submodules: "recursive"

- uses: bazel-contrib/setup-bazel@0.18.0
with:
bazelisk-cache: true
disk-cache: ${{ github.workflow }}
repository-cache: true

- name: Build all targets
run: bazel build //...

- name: Build compilation database
run: bazel run @hedron_compile_commands//:refresh_all

- name: Debug DB
run: |
echo "Current Dir: $(pwd)"
ls -lh compile_commands.json
# Check if the file with errors is actually in the DB
grep "client_api.cpp" compile_commands.json | head -n 1 || echo "FILE NOT IN DB"

- uses: cpp-linter/cpp-linter-action@v2
id: linter
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
style: "file" # Use .clang-format config file.
tidy-checks: "" # Use .clang-tidy config file.
database: "compile_commands.json"
version: "21"
extra-args: "--system-headers -fdiagnostics-absolute-paths"

- name: Fail fast?!
if: steps.linter.outputs.checks-failed > 0
run: exit 1

- name: ☢️ NUCLEAR DEBUG - Manual Clang-Tidy Run
run: |
echo "=== 1. Checking Database Entry ==="
# Check how the file is referenced in the DB (Absolute vs Relative paths)
grep "openfeature/evaluation_context.h" compile_commands.json | head -n 1

echo "=== 2. Running Clang-Tidy Manually ==="
# We manually invoke clang-tidy on a file we KNOW has errors.
# We explicitly point to the config and the build folder.

clang-tidy -p . openfeature/evaluation_context.h --config-file=.clang-tidy || echo "Manual Run Failed as Expected"

echo "=== 3. Running Clang-Tidy 16 Manually ==="
/usr/bin/clang-tidy-20 -p . openfeature/evaluation_context.h --config-file=.clang-tidy || echo "Manual Run Failed as Expected"
1 change: 1 addition & 0 deletions openfeature/evaluation_context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
}

const std::any* EvaluationContext::GetValue(std::string_view key) const {
auto it = attributes_.find(std::string(key));

Check failure on line 18 in openfeature/evaluation_context.cpp

View workflow job for this annotation

GitHub Actions / lint

openfeature/evaluation_context.cpp:18:8 [readability-identifier-length]

variable name 'it' is too short, expected at least 3 characters
if (it != attributes_.end()) {
return &it->second;
}
Expand Down Expand Up @@ -73,11 +73,12 @@

EvaluationContext::Builder& EvaluationContext::Builder::WithAttribute(
std::string key, const char* value) {
Testing += 1;
return this->WithAttribute(std::move(key), std::string(value));
}

EvaluationContext EvaluationContext::Builder::build() const {
return EvaluationContext(targeting_key_, attributes_);

Check failure on line 81 in openfeature/evaluation_context.cpp

View workflow job for this annotation

GitHub Actions / lint

openfeature/evaluation_context.cpp:81:10 [modernize-return-braced-init-list]

avoid repeating the return type from the declaration; use a braced initializer list instead
}

} // namespace openfeature
4 changes: 3 additions & 1 deletion openfeature/evaluation_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,15 @@
Builder& WithAttribute(std::string key, const char* value);

// The build() method creates the final, immutable EvaluationContext object.
EvaluationContext build() const;

Check failure on line 54 in openfeature/evaluation_context.h

View workflow job for this annotation

GitHub Actions / lint

openfeature/evaluation_context.h:54:21 [readability-identifier-naming]

invalid case style for function 'build'

int Testing;

Check failure on line 56 in openfeature/evaluation_context.h

View workflow job for this annotation

GitHub Actions / lint

openfeature/evaluation_context.h:56:7 [readability-identifier-naming]

invalid case style for public member 'Testing'

private:
std::optional<std::string> targeting_key_;
std::map<std::string, std::any> attributes_;
};

} // namespace openfeature

#endif // CPP_SDK_INCLUDE_OPENFEATURE_EVALUATION_CONTEXT_H_
#endif // CPP_SDK_INCLUDE_OPENFEATURE_EVALUATION_CONTEXT_H_
Loading