diff --git a/.bazelrc b/.bazelrc index dc68efa..0a5672e 100644 --- a/.bazelrc +++ b/.bazelrc @@ -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 diff --git a/.clang-tidy b/.clang-tidy index 55d9bb9..cbdebd2 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -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 diff --git a/.github/workflows/ci-format-test-lint.yml b/.github/workflows/ci-format-test-lint.yml index a46ac98..a136383 100644 --- a/.github/workflows/ci-format-test-lint.yml +++ b/.github/workflows/ci-format-test-lint.yml @@ -12,7 +12,7 @@ jobs: steps: - uses: actions/checkout@v6 with: - submodules: 'recursive' + submodules: "recursive" - uses: bazel-contrib/setup-bazel@0.18.0 with: @@ -31,7 +31,7 @@ jobs: steps: - uses: actions/checkout@v6 with: - submodules: 'recursive' + submodules: "recursive" - uses: bazel-contrib/setup-bazel@0.18.0 with: @@ -39,9 +39,19 @@ jobs: 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: @@ -49,7 +59,25 @@ jobs: 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" diff --git a/openfeature/evaluation_context.cpp b/openfeature/evaluation_context.cpp index 741aea0..85ee476 100644 --- a/openfeature/evaluation_context.cpp +++ b/openfeature/evaluation_context.cpp @@ -73,6 +73,7 @@ EvaluationContext::Builder& EvaluationContext::Builder::WithAttribute( EvaluationContext::Builder& EvaluationContext::Builder::WithAttribute( std::string key, const char* value) { + Testing += 1; return this->WithAttribute(std::move(key), std::string(value)); } diff --git a/openfeature/evaluation_context.h b/openfeature/evaluation_context.h index 51c876f..49450e3 100644 --- a/openfeature/evaluation_context.h +++ b/openfeature/evaluation_context.h @@ -53,6 +53,8 @@ class EvaluationContext::Builder { // The build() method creates the final, immutable EvaluationContext object. EvaluationContext build() const; + int Testing; + private: std::optional targeting_key_; std::map attributes_; @@ -60,4 +62,4 @@ class EvaluationContext::Builder { } // namespace openfeature -#endif // CPP_SDK_INCLUDE_OPENFEATURE_EVALUATION_CONTEXT_H_ +#endif // CPP_SDK_INCLUDE_OPENFEATURE_EVALUATION_CONTEXT_H_ \ No newline at end of file