diff --git a/corsika/detail/framework/geometry/FourVector.inl b/corsika/detail/framework/geometry/FourVector.inl index 135790bfcfa83efaf1a78f218228d0c2557f5853..6c0a039e5466ef46d2d3014b7e91a6f0621c922c 100644 --- a/corsika/detail/framework/geometry/FourVector.inl +++ b/corsika/detail/framework/geometry/FourVector.inl @@ -95,7 +95,7 @@ namespace corsika { template <typename TTimeType, typename TSpaceVecType> typename FourVector<TTimeType, TSpaceVecType>::norm_type - FourVector<TTimeType, TSpaceVecType>::operator*(FourVector const& b) { + FourVector<TTimeType, TSpaceVecType>::operator*(FourVector const& b) { if constexpr (std::is_same<time_type, decltype(std::declval<space_type>() / meter * second)>::value) return timeLike_ * b.timeLike_ * constants::cSquared - spaceLike_.norm(); diff --git a/corsika/detail/framework/geometry/QuantityVector.inl b/corsika/detail/framework/geometry/QuantityVector.inl index 6ba02e4f8d4bd8e8cec5231d47ffb23d87931430..2ca24ee5a4a9c080276731e9652f7b03202a82ec 100644 --- a/corsika/detail/framework/geometry/QuantityVector.inl +++ b/corsika/detail/framework/geometry/QuantityVector.inl @@ -17,8 +17,8 @@ namespace corsika { template <typename TDimension> - inline typename QuantityVector<TDimension>::quantity_type - QuantityVector<TDimension>::operator[](size_t const index) const { + inline typename QuantityVector<TDimension>::quantity_type QuantityVector<TDimension>:: + operator[](size_t const index) const { return quantity_type(phys::units::detail::magnitude_tag, eigenVector_[index]); } diff --git a/corsika/detail/media/WeightProvider.inl b/corsika/detail/media/WeightProvider.inl index c075b236350127c9978fb7c08d87ed035292e5a8..af9849aa3ca75b9bdaeefc661d56232f1ab895f4 100644 --- a/corsika/detail/media/WeightProvider.inl +++ b/corsika/detail/media/WeightProvider.inl @@ -20,7 +20,7 @@ namespace corsika { template <class AConstIterator, class BConstIterator> typename WeightProviderIterator<AConstIterator, BConstIterator>::value_type - WeightProviderIterator<AConstIterator, BConstIterator>::operator*() const { + WeightProviderIterator<AConstIterator, BConstIterator>::operator*() const { return ((*aIter_) * (*bIter_)).magnitude(); } diff --git a/corsika/detail/modules/OnShellCheck.inl b/corsika/detail/modules/OnShellCheck.inl index ec31f8d704bfbc8bea2176ac7da29e41a19cc0ee..f8f0b0081657c4b7d03d0c66dc2dc71c75a6b71e 100644 --- a/corsika/detail/modules/OnShellCheck.inl +++ b/corsika/detail/modules/OnShellCheck.inl @@ -73,14 +73,13 @@ namespace corsika { if (throw_error_) { throw std::runtime_error( "OnShellCheck: error! shifted energy by large amount!"); + } } - } - // reset energy - p.setEnergy(e_shifted); - } - else { - CORSIKA_LOGGER_DEBUG(logger_, "particle mass for {} OK", pid); + // reset energy + p.setEnergy(e_shifted); + } else { + CORSIKA_LOGGER_DEBUG(logger_, "particle mass for {} OK", pid); } } } // namespace corsika diff --git a/do-clang-format.py b/do-clang-format.py index 076a5ccdf4c207ff448aef2453fa835233c0ff28..11409fe1fb325e140969adaf7a22cad97e1072ed 100755 --- a/do-clang-format.py +++ b/do-clang-format.py @@ -15,6 +15,8 @@ parser.add_argument('--apply', action="store_true", help="Apply clang-format to files which need changes.") parser.add_argument("--all", action="store_true", help="Check all files below current path instead of new/modified.") +parser.add_argument("--docker", action="store_true", + help="Use corsika/devel:clang-8 container to run clang-format. Make sure you are in group \"docker\". ") args = parser.parse_args() @@ -67,10 +69,17 @@ else: filelist_clean.append(f) filelist = filelist_clean -cmd = "clang-format" +cmd = ["clang-format"] if "CLANG_FORMAT" in os.environ: - cmd = os.environ["CLANG_FORMAT"] -cmd += " -style=file" + cmd = [os.environ["CLANG_FORMAT"]] +if args.docker: + USER=os.environ["USER"] + UID=os.getuid() + GID=os.getgid() + PWD=os.getcwd() + # note, currently in container it is clang-8 + cmd = "docker container run --rm -v {}:/corsika -w /corsika -u {}:{} corsika/devel:clang-8 clang-format-8".format(PWD,UID,GID) +cmd += " -style=file" if args.apply: for filename in filelist: subp.check_call(cmd.split() + ["-i", filename])