Commit 48779f87 authored by Alexander Jaust's avatar Alexander Jaust
Browse files

Make Clang format fail on misformatted files

parent df7d8644
Pipeline #19616 passed with stages
in 3 minutes and 34 seconds
......@@ -8,13 +8,13 @@ stages:
check-style-clang-10:
stage: check
script:
- ./scripts/format/run-clang-format.sh > clang-format-output.txt
- ./scripts/format/run-clang-format.sh > clang-format-output.txt 2>&1
- if [ -s clang-format-output.txt ]; then cat clang-format-output.txt; echo "Some files need reformatting. Check the output and run ./scripts/format/run-clang-format.sh and commit again."; false; fi
needs: []
artifacts:
when: on_failure
paths:
- style-patch.diff
- clang-format-output.txt
expire_in: 2 days
check-style-black:
......
......@@ -2,6 +2,7 @@
## Not released yet
- 2022-07-27: Make sure clang-format fails when files a badly formatted.
- 2022-05-25: Add CMake guards to prevent build targe generation of cases that depend of `dune-subgrid`, if `dune-subgrid` is not installed.
- 2022-05-24: Added missing include of `limits` in `couplingadapter.cc`.
- 2022-05-17: Added base setup for extended documentation to be hosted on ReadTheDocs and being created by `mkdocs`. Also adds a base configuration and style of the documentation.
......
#!/usr/bin/env sh
#!/usr/bin/env bash
set -e
# Runs clang-format on all *.cc and *.hh files
find dumux-precice/ -regex '.*\.\(cc\|hh\)' -exec clang-format-10 --dry-run -style=file -i {} \;
find examples/ -regex '.*\.\(cc\|hh\)' -exec clang-format-10 --dry-run -style=file -i {} \;
find postprocessing/ -regex '.*\.\(cc\|hh\|hpp\|cpp\)' -exec clang-format-10 --dry-run -style=file -i {} \;
DIRECTORIES=("dumux-precice/" "examples/" "test/" "postprocessing/")
for DIRECTORY in "${DIRECTORIES[@]}"; do
#echo "Check files in ${DIRECTORY}"
for FILE in $(find "${DIRECTORY}" -regex '.*\.\(cc\|hh\)' ); do
#echo "$FILE"
clang-format-10 --dry-run -style=file -Werror -i ${FILE}
done
if [ $? -ne 0 ]; then
exit $?
fi
done
exit 0
\ No newline at end of file
......@@ -115,7 +115,7 @@ class DarcySubProblem : public PorousMediumFlowProblem<TypeTag>
using CouplingManager = GetPropType<TypeTag, Properties::CouplingManager>;
public:
public:
DarcySubProblem(std::shared_ptr<const GridGeometry> gridGeometry,
std::shared_ptr<CouplingManager> couplingManager)
: ParentType(gridGeometry, "Darcy"),
......@@ -278,7 +278,7 @@ class DarcySubProblem : public PorousMediumFlowProblem<TypeTag>
//! Get the coupling manager
const CouplingManager &couplingManager() const { return *couplingManager_; }
private:
private:
bool onLowerBoundary_(const GlobalPosition &globalPos) const
{
return globalPos[1] < this->gridGeometry().bBoxMin()[1] + eps_;
......
......@@ -121,7 +121,7 @@ class StokesSubProblem : public NavierStokesProblem<TypeTag>
using CouplingManager = GetPropType<TypeTag, Properties::CouplingManager>;
public:
public:
using Indices = typename ModelTraits::Indices;
StokesSubProblem(std::shared_ptr<const GridGeometry> gridGeometry,
......@@ -394,7 +394,7 @@ class StokesSubProblem : public NavierStokesProblem<TypeTag>
// \}
private:
private:
bool onLeftBoundary_(const GlobalPosition &globalPos) const
{
return globalPos[0] < this->gridGeometry().bBoxMin()[0] + eps_;
......
......@@ -49,7 +49,7 @@ class OnePSpatialParams
using Element = typename GridView::template Codim<0>::Entity;
using GlobalPosition = typename Element::Geometry::GlobalCoordinate;
public:
public:
// export permeability type
using PermeabilityType = Scalar;
......@@ -86,7 +86,7 @@ class OnePSpatialParams
return alphaBJ_;
}
private:
private:
Scalar permeability_;
Scalar alphaBJ_;
};
......
......@@ -115,7 +115,7 @@ class DarcySubProblem : public PorousMediumFlowProblem<TypeTag>
using CouplingManager = GetPropType<TypeTag, Properties::CouplingManager>;
public:
public:
DarcySubProblem(std::shared_ptr<const GridGeometry> gridGeometry,
std::shared_ptr<CouplingManager> couplingManager)
: ParentType(gridGeometry, "Darcy"),
......@@ -278,7 +278,7 @@ class DarcySubProblem : public PorousMediumFlowProblem<TypeTag>
//! Get the coupling manager
const CouplingManager &couplingManager() const { return *couplingManager_; }
private:
private:
bool onLowerBoundary_(const GlobalPosition &globalPos) const
{
return globalPos[1] < this->gridGeometry().bBoxMin()[1] + eps_;
......
......@@ -121,7 +121,7 @@ class StokesSubProblem : public NavierStokesProblem<TypeTag>
using CouplingManager = GetPropType<TypeTag, Properties::CouplingManager>;
public:
public:
using Indices = typename ModelTraits::Indices;
StokesSubProblem(std::shared_ptr<const GridGeometry> gridGeometry,
......@@ -392,7 +392,7 @@ class StokesSubProblem : public NavierStokesProblem<TypeTag>
// \}
private:
private:
bool onLeftBoundary_(const GlobalPosition &globalPos) const
{
return globalPos[0] < this->gridGeometry().bBoxMin()[0] + eps_;
......
......@@ -49,7 +49,7 @@ class OnePSpatialParams
using Element = typename GridView::template Codim<0>::Entity;
using GlobalPosition = typename Element::Geometry::GlobalCoordinate;
public:
public:
// export permeability type
using PermeabilityType = Scalar;
......@@ -86,7 +86,7 @@ class OnePSpatialParams
return alphaBJ_;
}
private:
private:
Scalar permeability_;
Scalar alphaBJ_;
};
......
......@@ -49,7 +49,7 @@ class OnePSpatialParams
using Element = typename GridView::template Codim<0>::Entity;
using GlobalPosition = typename Element::Geometry::GlobalCoordinate;
public:
public:
// export permeability type
using PermeabilityType = Scalar;
......@@ -90,7 +90,7 @@ class OnePSpatialParams
return alphaBJ_;
}
private:
private:
Scalar permeability_;
Scalar porosity_;
Scalar alphaBJ_;
......
......@@ -70,7 +70,7 @@ class FreeFlowSubProblem : public NavierStokesProblem<TypeTag>
using CouplingManager = GetPropType<TypeTag, Properties::CouplingManager>;
public:
public:
FreeFlowSubProblem(std::shared_ptr<const FVGridGeometry> fvGridGeometry,
std::shared_ptr<CouplingManager> couplingManager)
: ParentType(fvGridGeometry, "Stokes"),
......@@ -302,7 +302,7 @@ class FreeFlowSubProblem : public NavierStokesProblem<TypeTag>
// \}
private:
private:
bool onLeftBoundary_(const GlobalPosition &globalPos) const
{
return globalPos[0] < this->gridGeometry().bBoxMin()[0] + eps_;
......
......@@ -70,7 +70,7 @@ class PorousMediumSubProblem : public PorousMediumFlowProblem<TypeTag>
using CouplingManager = GetPropType<TypeTag, Properties::CouplingManager>;
public:
public:
PorousMediumSubProblem(std::shared_ptr<const FVGridGeometry> fvGridGeometry,
std::shared_ptr<CouplingManager> couplingManager)
: ParentType(fvGridGeometry, "Darcy"),
......@@ -215,7 +215,7 @@ class PorousMediumSubProblem : public PorousMediumFlowProblem<TypeTag>
//! Get the coupling manager
const CouplingManager &couplingManager() const { return *couplingManager_; }
private:
private:
bool onLeftBoundary_(const GlobalPosition &globalPos) const
{
return globalPos[0] < this->gridGeometry().bBoxMin()[0] + eps_;
......
......@@ -49,7 +49,7 @@ class OnePSpatialParams
using Element = typename GridView::template Codim<0>::Entity;
using GlobalPosition = typename Element::Geometry::GlobalCoordinate;
public:
public:
// export permeability type
using PermeabilityType = Scalar;
......@@ -90,7 +90,7 @@ class OnePSpatialParams
return alphaBJ_;
}
private:
private:
Scalar permeability_;
Scalar porosity_;
Scalar alphaBJ_;
......
......@@ -132,7 +132,7 @@ class StokesSubProblem : public NavierStokesProblem<TypeTag>
using CouplingManager = GetPropType<TypeTag, Properties::CouplingManager>;
#endif
public:
public:
#if ENABLEMONOLITHIC
StokesSubProblem(std::shared_ptr<const GridGeometry> gridGeometry,
std::shared_ptr<CouplingManager> couplingManager)
......@@ -411,7 +411,7 @@ class StokesSubProblem : public NavierStokesProblem<TypeTag>
// \}
private:
private:
bool onLeftBoundary_(const GlobalPosition &globalPos) const
{
return globalPos[0] < this->gridGeometry().bBoxMin()[0] + eps_;
......
......@@ -126,7 +126,7 @@ class DarcySubProblem : public PorousMediumFlowProblem<TypeTag>
using CouplingManager = GetPropType<TypeTag, Properties::CouplingManager>;
#endif
public:
public:
#if ENABLEMONOLITHIC
DarcySubProblem(std::shared_ptr<const GridGeometry> fvGridGeometry,
std::shared_ptr<CouplingManager> couplingManager)
......@@ -303,7 +303,7 @@ class DarcySubProblem : public PorousMediumFlowProblem<TypeTag>
const CouplingManager &couplingManager() const { return *couplingManager_; }
#endif
private:
private:
bool onLeftBoundary_(const GlobalPosition &globalPos) const
{
return globalPos[0] < this->fvGridGeometry().bBoxMin()[0] + eps_;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment