Skip to content
Merged
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
36 changes: 36 additions & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
---
Checks: |
clang-diagnostic-*,
clang-analyzer-*,
-clang-analyzer-alpha*,
google-*,
modernize-*,
-modernize-avoid-c-arrays,
-modernize-use-trailing-return-type,
-modernize-use-nodiscard,

CheckOptions:
- key: google-readability-braces-around-statements.ShortStatementLines
value: '1'
- key: google-readability-function-size.StatementThreshold
value: '800'
- key: google-readability-namespace-comments.ShortNamespaceLines
value: '10'
- key: google-readability-namespace-comments.SpacesBeforeComments
value: '2'
29 changes: 29 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

# To use this, install the python package `pre-commit` and
# run once `pre-commit install`. This will setup a git pre-commit-hook
# that is executed on each commit and will report the linting problems.
# To run all hooks on all files use `pre-commit run -a`

repos:
- repo: https://github.com/pocc/pre-commit-hooks
rev: v1.3.5
hooks:
- id: clang-tidy
args: ['--quiet', '-p=build/compile_commands.json', '--config-file=.clang-tidy']
types_or: [c++, c]
5 changes: 3 additions & 2 deletions count/include/count_min_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ uint64_t count_min_sketch<W,A>::get_seed() const {

template<typename W, typename A>
double count_min_sketch<W,A>::get_relative_error() const {
return exp(1.0) / double(_num_buckets);
return exp(1.0) / static_cast<double>(_num_buckets);
}

template<typename W, typename A>
Expand Down Expand Up @@ -449,8 +449,9 @@ string<A> count_min_sketch<W,A>::to_string() const {
// count the number of used entries in the sketch
uint64_t num_nonzero = 0;
for (const auto entry: _sketch_array) {
if (entry != static_cast<W>(0.0))
if (entry != static_cast<W>(0.0)){
++num_nonzero;
}
}

// Using a temporary stream for implementation here does not comply with AllocatorAwareContainer requirements.
Expand Down