Skip to content

Commit

Permalink
Maybe good?
Browse files Browse the repository at this point in the history
  • Loading branch information
John-LittleBearLabs committed Oct 11, 2024
1 parent fee1885 commit f7b3654
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 23 deletions.
1 change: 1 addition & 0 deletions .github/ut.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ echo Install dependencies
g++ --version
clang++ --version
conan --version
lcov --version
conan profile detect
echo Configure
mkdir build
Expand Down
4 changes: 2 additions & 2 deletions cmake/CodeCoverage.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ function(setup_target_for_coverage_lcov)
# Create baseline to make sure untouched files show up in the report
set(LCOV_BASELINE_CMD ${LCOV_PATH} ${Coverage_LCOV_ARGS}
--gcov-tool ${GCOV_PATH} -c --no-external -i -d .
--ignore-errors mismatch,unused
--ignore-errors mismatch
-b ${BASEDIR}
-o ${Coverage_NAME}.base )
# Run tests
Expand All @@ -283,7 +283,7 @@ function(setup_target_for_coverage_lcov)
# Capturing lcov counters and generating report
set(LCOV_CAPTURE_CMD
${LCOV_PATH} ${Coverage_LCOV_ARGS} --gcov-tool ${GCOV_PATH} --directory .
-b ${BASEDIR} --capture --no-external --ignore-errors mismatch,unused
-b ${BASEDIR} --capture --no-external --ignore-errors mismatch
--output-file ${Coverage_NAME}.capture
)
# add baseline counters
Expand Down
29 changes: 18 additions & 11 deletions library/.clang-tidy
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
Checks: 'bugp*,
-bugprone-reserved-identifier,
-bugprone-standalone-empty,
-bugprone-suspicious-semicolon,
misc*,
-misc-const-correctness,
-misc-header-include-cycle,
-misc-no-recursion,
mode*,
read*,
-readability-container-size-empty,
Checks: 'bugpr*,
-bugprone-c*,
-bugprone-d*,
-bugprone-e*,
-bugprone-f*,
-bugprone-i*,
-bugprone-l*,
-bugprone-m*,
-bugprone-n*,
-bugprone-o*,
-bugprone-p*,
-bugprone-r*,
-bugprone-s*,
-bugprone-t*,
-bugprone-u*,
misc-*,
moder*,
reada*,
-readability-else-after-return,
-readability-named-parameter'
CheckOptions:
Expand Down
9 changes: 5 additions & 4 deletions library/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -258,10 +258,11 @@ if(GTest_FOUND AND IN_WORKSPACE)
endif()
if(LCOV_PATH)
setup_target_for_coverage_lcov(
NAME cov
DEPENDENCIES run_tests
EXECUTABLE $<TARGET_FILE:unit_test_runner>
EXCLUDE ${unit_test_sources} ${pb_gen}
NAME cov
DEPENDENCIES run_tests
EXECUTABLE $<TARGET_FILE:unit_test_runner>
EXCLUDE
"*/*/*test.cc"
)
else()
message(WARNING "Cannot provide coverage report without lcov")
Expand Down
12 changes: 6 additions & 6 deletions library/src/ipfs_client/gw/multi_gateway_requestor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ bool Self::Process(RequestPtr const& req) {
}
std::advance(state_iter, 1);
}
if (std::get<2>(over_rate)) {
if (std::get<2>(over_rate) != nullptr) {
candidates.push_back(over_rate);
}
if (candidates.empty() && config_idx <= req->failures.size()) {
Expand Down Expand Up @@ -116,12 +116,12 @@ void Self::DoSend(RequestPtr req, std::string const& gw, GatewayState& state) {
<< req->debug_string();
return;
}
if (state.extra_ms()) {
if (state.extra_ms() != 0) {
desc->timeout_seconds += state.extra_ms() / 1000L + 1L;
}
auto start = ch::system_clock::now();
auto timeout_threshold =
ch::seconds(desc->timeout_seconds ? desc->timeout_seconds : 300) -
ch::seconds(desc->timeout_seconds != 0 ? desc->timeout_seconds : 300) -
ch::milliseconds(1);
auto hold_alive = shared_from_this();
auto cb = [this, hold_alive, req, gw, timeout_threshold, desc, start](
Expand Down Expand Up @@ -149,7 +149,7 @@ void Self::HandleResponse(HttpRequestDescription const& desc,
return;
}
auto i = state_.find(gw);
if (status == 200 || !status) {
if (status == 200 || (status == 0)) {
auto ct = hdrs("content-type");
auto roots = hdrs("X-Ipfs-Roots");
std::transform(ct.begin(), ct.end(), ct.begin(), ::tolower);
Expand All @@ -158,9 +158,9 @@ void Self::HandleResponse(HttpRequestDescription const& desc,
src.cat.gateway_url = gw;
if (ct.empty()) {
LOG(ERROR) << "No content-type header?";
} else if (desc.accept.size() &&
} else if ((desc.accept.size() != 0U) &&
ct.find(desc.accept) == std::string::npos) {
if (roots.size() && req->type == GatewayRequestType::DnsLink && req->RespondSuccessfully("", api_, src, roots)) {
if ((roots.size() != 0U) && req->type == GatewayRequestType::DnsLink && req->RespondSuccessfully("", api_, src, roots)) {
LOG(INFO) << "Wrong accept on a DNSLink request, but we still got the resolution.";
return;
}
Expand Down

0 comments on commit f7b3654

Please sign in to comment.