Skip to content

Remove unused logger in SpatialUtils#1833

Merged
MaticTonin merged 1 commit into
developfrom
bugfix/remove_unused_variable
Jun 8, 2026
Merged

Remove unused logger in SpatialUtils#1833
MaticTonin merged 1 commit into
developfrom
bugfix/remove_unused_variable

Conversation

@JakubFara

@JakubFara JakubFara commented Jun 2, 2026

Copy link
Copy Markdown
Collaborator

Remove unused variable

  • remove a logger from SpatialUtils.cpp

Summary by CodeRabbit

  • Refactor
    • Simplified internal spatial calculation functions by removing unnecessary logging parameters from function signatures, streamlining the computation workflow with no impact on end-user functionality.

@JakubFara JakubFara requested a review from aljazkonec1 June 2, 2026 13:01
@coderabbitai

coderabbitai Bot commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: b40a61cb-6e7c-48c6-9f94-a5102548d032

📥 Commits

Reviewing files that changed from the base of the PR and between 314a2c4 and 6974f35.

📒 Files selected for processing (1)
  • src/pipeline/utilities/SpatialLocationCalculator/SpatialUtils.cpp
📜 Recent review details
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2026-03-24T22:39:04.364Z
Learnt from: MaticTonin
Repo: luxonis/depthai-core PR: 1732
File: src/pipeline/Pipeline.cpp:705-705
Timestamp: 2026-03-24T22:39:04.364Z
Learning: Do not flag the `!= ""` part of the auto-calibration condition as redundant when it appears in `PipelineImpl::build()` (or closely related pipeline build logic). If the code uses `utility::getEnvAs<std::string>(..., default)` with a default such as `"ON_START"`, the explicit empty-string guard may still be intentional to treat an explicitly empty env var as “OFF/disabled” (or to avoid special-casing elsewhere). Only consider removing `!= ""` if the codebase has an explicit, enforceable guarantee that `DEPTHAI_AUTOCALIBRATION` can never be set to an empty string (e.g., via validated parsing/CI checks); otherwise, keep the guard.

Applied to files:

  • src/pipeline/utilities/SpatialLocationCalculator/SpatialUtils.cpp
🔇 Additional comments (2)
src/pipeline/utilities/SpatialLocationCalculator/SpatialUtils.cpp (2)

449-456: LGTM!


298-305: Verify computeSpatialDetection call sites updated — A repo-wide search for computeSpatialDetection( finds only the function definition and the single call from computeSpatialDetections in src/pipeline/utilities/SpatialLocationCalculator/SpatialUtils.cpp (~line 449), matching the updated signature (no remaining call sites to update).


📝 Walkthrough

Walkthrough

The PR removes the spdlog logger parameter from the computeSpatialDetection function signature and updates the corresponding call site in computeSpatialDetections to stop passing that argument.

Changes

Logger Parameter Removal

Layer / File(s) Summary
Remove logger parameter from computeSpatialDetection
src/pipeline/utilities/SpatialLocationCalculator/SpatialUtils.cpp
Function signature of computeSpatialDetection is updated to remove the std::shared_ptr<spdlog::async_logger>& parameter, and the call within computeSpatialDetections is updated to stop passing the logger argument.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

A logger departs on silent wings,
No more async whispers it brings,
Two simple edits make things right,
Function and caller both in flight! 🐰✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: removing an unused logger parameter from the SpatialUtils function signature.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch bugfix/remove_unused_variable

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 Infer (1.2.0)
src/pipeline/utilities/SpatialLocationCalculator/SpatialUtils.cpp

In file included from src/pipeline/utilities/SpatialLocationCalculator/SpatialUtils.cpp:1:
src/pipeline/utilities/SpatialLocationCalculator/SpatialUtils.hpp:2:10: fatal error: 'spdlog/async_logger.h' file not found
2 | #include <spdlog/async_logger.h>
| ^~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
Error: the following clang command did not run successfully:
/opt/infer-linux-x86_64-v1.2.0/lib/infer/facebook-clang-plugins/clang/install/bin/clang-18
@/tmp/coderabbit-infer/6974f354de711711ef1b77152c0ee5c1dd0c3bc0-e0058a19571e1ec0/tmp/clang_command_.tmp.8fe309.txt
++Contents of '/tmp/coderabbit-infer/6974f354de711711ef1b77152c0ee5c1dd0c3bc0-e0058a19571e1ec0/tmp/clang_command_.tmp.8fe309.txt':
"-cc1" "-load"
"/opt/infer-linux-x86_64-v1.2.0/lib/infer/infer/bin/../../facebook-clang-plugins/libtooling/build/FacebookClangPlugin.dylib"
"-add-plugin" "BiniouASTExporter" "-plugin-arg-BiniouASTExporter" "-"
"-plugin-arg-BiniouASTExporter" "PREPEND_CURRENT_D

... [truncated 1266 characters] ...

al-isystem" "/usr/local/include" "-internal-isystem"
"/usr/lib/gcc/x86_64-linux-gnu/12/../../../../x86_64-linux-gnu/include"
"-internal-externc-isystem" "/usr/include/x86_64-linux-gnu"
"-internal-externc-isystem" "/include" "-internal-externc-isystem"
"/usr/include" "-Wno-ignored-optimization-argument" "-Wno-everything"
"-fdeprecated-macro" "-ferror-limit" "19" "-fgnuc-version=4.2.1"
"-fskip-odr-check-in-gmf" "-fcxx-exceptions" "-fexceptions"
"-D__GCC_HAVE_DWARF2_CFI_ASM=1" "-o"
"/tmp/coderabbit-infer/e0058a19571e1ec0/file.o" "-x" "c++"
"src/pipeline/utilities/SpatialLocationCalculator/SpatialUtils.cpp" "-O0"
"-fno-builtin" "-include"
"/opt/infer-linux-x86_64-v1.2.0/lib/infer/infer/bin/../lib/clang_wrappers/global_defines.h"
"-Wno-everything"


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@MaticTonin

Copy link
Copy Markdown
Collaborator

PR was opened to remove this build warning:

[ 33%] Building CXX object CMakeFiles/depthai-core.dir/src/pipeline/node/test/MyProducer.cpp.o
[ 33%] Building CXX object CMakeFiles/depthai-core.dir/src/pipeline/node/test/MyConsumer.cpp.o
/home/luxonis-cv-team-slo/code/depthai-core/src/pipeline/utilities/SpatialLocationCalculator/SpatialUtils.cpp: In function ‘dai::SpatialImgDetection dai::utilities::SpatialUtils::computeSpatialDetection(const dai::ImgFrame&, const dai::ImgDetection&, const dai::span<const unsigned char>&, const dai::SpatialLocationCalculatorConfig&, int, const dai::ImgTransformation&, int, int, const std::shared_ptr<spdlog::async_logger>&)’:
/home/luxonis-cv-team-slo/code/depthai-core/src/pipeline/utilities/SpatialLocationCalculator/SpatialUtils.cpp:306:95: warning: unused parameter ‘logger’ [-Wunused-parameter]
  306 |                                                  const std::shared_ptr<spdlog::async_logger>& logger) {
      |                                                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~
[ 33%] Building CXX object CMakeFiles/depthai-core.dir/src/pipeline/node/UVC.cpp.o
[ 33%] Building CXX object CMakeFiles/depthai-core.dir/src/pipeline/node/internal/XLinkInHost.cpp.o

@MaticTonin MaticTonin merged commit 1c0fa35 into develop Jun 8, 2026
32 checks passed
@MaticTonin MaticTonin deleted the bugfix/remove_unused_variable branch June 8, 2026 08:21
mtramsak-luxonis pushed a commit that referenced this pull request Jun 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants