Enable pre-commit (#366)

This commit is contained in:
Hans Dembinski 2022-09-28 12:11:50 +02:00 committed by GitHub
parent 10c19df918
commit 1c9077a6e1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 56 additions and 15 deletions

39
.pre-commit-config.yaml Normal file
View File

@ -0,0 +1,39 @@
# To use:
#
# pre-commit run -a
#
# Or:
#
# pre-commit install # (runs every time you commit in git)
#
# To update this file:
#
# pre-commit autoupdate
#
# See https://github.com/pre-commit/pre-commit
repos:
# Standard hooks
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.1.0
hooks:
- id: check-case-conflict
- id: check-docstring-first
- id: check-executables-have-shebangs
- id: check-merge-conflict
- id: check-symlinks
- id: check-yaml
args: ["--allow-multiple-documents"]
- id: debug-statements
- id: mixed-line-ending
- id: sort-simple-yaml
- id: file-contents-sorter
- id: trailing-whitespace
exclude: .*.(xml?)|(svg?)
# C++ formatting
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v13.0.1
hooks:
- id: clang-format
types_or: [c++, c]

View File

@ -38,8 +38,9 @@ class variant : public iterator_mixin<variant<Ts...>> {
template <class T>
using requires_bounded_type = std::enable_if_t<is_bounded_type<T>::value>;
using metadata_type = std::remove_const_t<std::remove_reference_t<decltype(
traits::metadata(std::declval<std::remove_pointer_t<mp11::mp_first<variant>>>()))>>;
using metadata_type =
std::remove_const_t<std::remove_reference_t<decltype(traits::metadata(
std::declval<std::remove_pointer_t<mp11::mp_first<variant>>>()))>>;
public:
// cannot import ctors with using directive, it breaks gcc and msvc

View File

@ -433,8 +433,9 @@ using has_non_inclusive_axis = mp11::mp_any_of<axis_types<Axes>, is_not_inclusiv
template <class T>
constexpr std::size_t type_score() {
return sizeof(T) *
(std::is_integral<T>::value ? 1 : std::is_floating_point<T>::value ? 10 : 100);
return sizeof(T) * (std::is_integral<T>::value ? 1
: std::is_floating_point<T>::value ? 10
: 100);
}
// arbitrary ordering of types

View File

@ -6,11 +6,11 @@
#include <boost/core/lightweight_test.hpp>
#include <boost/histogram/axis/integer.hpp>
#include "throw_exception.hpp"
#include <boost/histogram/histogram.hpp>
#include <boost/histogram/make_histogram.hpp>
#include <boost/range/adaptor/filtered.hpp>
#include <boost/range/numeric.hpp>
#include "throw_exception.hpp"
using namespace boost::histogram;
using namespace boost::adaptors;

View File

@ -7,7 +7,6 @@
#include <boost/core/lightweight_test.hpp>
#include <boost/histogram/axis/ostream.hpp>
#include <boost/histogram/axis/regular.hpp>
#include "throw_exception.hpp"
#include <boost/histogram/histogram.hpp>
#include <boost/histogram/indexed.hpp>
#include <boost/histogram/literals.hpp>
@ -17,6 +16,7 @@
#include <boost/units/systems/si/length.hpp>
#include <limits>
#include "is_close.hpp"
#include "throw_exception.hpp"
using namespace boost::histogram;
using namespace boost::histogram::literals;