Skip to content

Commit

Permalink
fix: linter errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Taepper committed Jun 17, 2024
1 parent 6be2b3d commit 872c50a
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 21 deletions.
2 changes: 2 additions & 0 deletions src/silo/query_engine/operators/selection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ Selection::Selection(std::unique_ptr<Predicate> predicate, uint32_t row_count)

Selection::~Selection() noexcept = default;

namespace {
std::string displayComparator(Comparator comparator) {
switch (comparator) {
case Comparator::EQUALS:
Expand All @@ -72,6 +73,7 @@ std::string displayComparator(Comparator comparator) {
}
throw std::runtime_error("found unhandled comparator");
}
} // namespace

std::string Selection::toString() const {
std::vector<std::string> predicate_strings;
Expand Down
24 changes: 13 additions & 11 deletions src/silo/storage/insertion_index.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,9 @@

namespace silo::storage::insertion {

namespace {
constexpr std::string_view REGEX_ANY = ".*";

template <typename SymbolType>
size_t ThreeMerHash<SymbolType>::operator()(
const std::array<typename SymbolType::Symbol, 3>& three_mer
) const {
size_t seed = 0;
for (const auto one_mer : three_mer) {
boost::hash_combine(seed, std::hash<typename SymbolType::Symbol>{}(one_mer));
}
return seed;
}

template <typename SymbolType>
std::vector<std::array<typename SymbolType::Symbol, 3>> extractThreeMers(
const std::string& search_pattern
Expand All @@ -54,6 +44,18 @@ std::vector<std::array<typename SymbolType::Symbol, 3>> extractThreeMers(
}
return {result.begin(), result.end()};
}
} // namespace

template <typename SymbolType>
size_t ThreeMerHash<SymbolType>::operator()(
const std::array<typename SymbolType::Symbol, 3>& three_mer
) const {
size_t seed = 0;
for (const auto one_mer : three_mer) {
boost::hash_combine(seed, std::hash<typename SymbolType::Symbol>{}(one_mer));
}
return seed;
}

template <typename SymbolType>
std::unique_ptr<roaring::Roaring> InsertionPosition<SymbolType>::searchWithThreeMerIndex(
Expand Down
16 changes: 9 additions & 7 deletions src/silo_api/info_handler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

namespace silo {

// NOLINTNEXTLINE(readability-identifier-naming)
// NOLINTNEXTLINE(readability-identifier-naming,misc-use-internal-linkage)
void to_json(nlohmann::json& json, const DatabaseInfo& databaseInfo) {
json = nlohmann::json{
{"sequenceCount", databaseInfo.sequence_count},
Expand All @@ -24,7 +24,7 @@ void to_json(nlohmann::json& json, const DatabaseInfo& databaseInfo) {
};
}

// NOLINTNEXTLINE(readability-identifier-naming)
// NOLINTNEXTLINE(readability-identifier-naming,misc-use-internal-linkage)
void to_json(nlohmann::json& json, const BitmapContainerSizeStatistic& statistics) {
json = nlohmann::json{
{"numberOfArrayContainers", statistics.number_of_array_containers},
Expand All @@ -41,7 +41,7 @@ void to_json(nlohmann::json& json, const BitmapContainerSizeStatistic& statistic
};
}

// NOLINTNEXTLINE(readability-identifier-naming)
// NOLINTNEXTLINE(readability-identifier-naming,misc-use-internal-linkage)
void to_json(nlohmann::json& json, const BitmapSizePerSymbol& bitmapSizePerSymbol) {
std::map<std::string, uint64_t> size_in_bytes_for_nlohmann;
for (const auto& [symbol, size] : bitmapSizePerSymbol.size_in_bytes) {
Expand All @@ -51,7 +51,7 @@ void to_json(nlohmann::json& json, const BitmapSizePerSymbol& bitmapSizePerSymbo
json = size_in_bytes_for_nlohmann;
}

// NOLINTNEXTLINE(readability-identifier-naming)
// NOLINTNEXTLINE(readability-identifier-naming,misc-use-internal-linkage)
void to_json(nlohmann::json& json, const BitmapContainerSize& bitmapContainerSize) {
json = nlohmann::json{
{"sectionLength", bitmapContainerSize.section_length},
Expand All @@ -62,7 +62,7 @@ void to_json(nlohmann::json& json, const BitmapContainerSize& bitmapContainerSiz
};
}

// NOLINTNEXTLINE(readability-identifier-naming)
// NOLINTNEXTLINE(readability-identifier-naming,misc-use-internal-linkage)
void to_json(nlohmann::json& json, const DetailedDatabaseInfo& databaseInfo) {
json = nlohmann::json{
{"bitmapSizePerSymbol", databaseInfo.sequences.at("main").bitmap_size_per_symbol},
Expand All @@ -73,8 +73,7 @@ void to_json(nlohmann::json& json, const DetailedDatabaseInfo& databaseInfo) {

} // namespace silo

namespace silo_api {

namespace {
std::map<std::string, std::string> getQueryParameter(const Poco::Net::HTTPServerRequest& request) {
std::map<std::string, std::string> map;
const Poco::URI uri(request.getURI());
Expand All @@ -85,6 +84,9 @@ std::map<std::string, std::string> getQueryParameter(const Poco::Net::HTTPServer
}
return map;
}
} // namespace

namespace silo_api {

InfoHandler::InfoHandler(DatabaseMutex& database)
: database(database) {}
Expand Down
8 changes: 5 additions & 3 deletions src/silo_api/rest_resource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,21 @@

#include "silo_api/error_request_handler.h"

namespace silo_api {

namespace {
void methodNotAllowed(
Poco::Net::HTTPServerRequest& request,
Poco::Net::HTTPServerResponse& response
) {
response.setContentType("application/json");
response.setStatus(Poco::Net::HTTPResponse::HTTP_METHOD_NOT_ALLOWED);
response.send() << nlohmann::json(ErrorResponse{
response.send() << nlohmann::json(silo_api::ErrorResponse{
.error = "Method not allowed",
.message = request.getMethod() + " is not allowed on resource " + request.getURI()
});
}
} // namespace

namespace silo_api {

void RestResource::handleRequest(
Poco::Net::HTTPServerRequest& request,
Expand Down

0 comments on commit 872c50a

Please sign in to comment.