From 76dc828fe9b5c6e7314615343f198245bd9304be Mon Sep 17 00:00:00 2001
From: Kai Bao
Date: Wed, 15 Oct 2025 10:53:35 +0200
Subject: [PATCH 1/2] adding .pre-commit-config.yaml to opm-grid
---
.pre-commit-config.yaml | 42 +++++++++++++++++++++++++++++++++++++++++
1 file changed, 42 insertions(+)
create mode 100644 .pre-commit-config.yaml
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
new file mode 100644
index 000000000..83c9a9d89
--- /dev/null
+++ b/.pre-commit-config.yaml
@@ -0,0 +1,42 @@
+# Pre-commit configuration for OPM-grid
+# This configuration uses the pre-commit framework to automatically format source files
+# before commits, ensuring consistent code style across the project.
+#
+# Installation:
+# -------------
+# 1. Install pre-commit (choose one method):
+# - Via pip: pip install pre-commit
+# - Via conda: conda install -c conda-forge pre-commit
+# - Via homebrew (macOS): brew install pre-commit
+# - Via package manager (Ubuntu/Debian): apt install pre-commit
+#
+# 2. Install the hooks in your local repository:
+# pre-commit install
+#
+# Usage:
+# ------
+# - Hooks run automatically on every commit
+# - To run manually on all files: pre-commit run --all-files
+# - To run on specific files: pre-commit run --files
+# - To skip hooks for a commit: git commit --no-verify
+# - To update hook versions: pre-commit autoupdate
+#
+# What these hooks do:
+# -------------------
+# - trailing-whitespace: Removes trailing whitespace from lines
+# (preserves Markdown hard line breaks with --markdown-linebreak-ext=md)
+# - end-of-file-fixer: Ensures files end with exactly one newline
+#
+
+repos:
+ - repo: https://github.com/pre-commit/pre-commit-hooks
+ rev: v6.0.0 # Latest release as of August 2025
+ hooks:
+ - id: trailing-whitespace
+ args: [--markdown-linebreak-ext=md]
+ types_or: [c, c++, python, shell, yaml, cmake, markdown, text]
+ exclude: '^(build/|\.git/)'
+
+ - id: end-of-file-fixer
+ types_or: [c, c++, python, shell, yaml, cmake, markdown, text]
+ exclude: '^(build/|\.git/)'
From bfe1906117b04ba55e2d3c0a4c31bae6e366dbf4 Mon Sep 17 00:00:00 2001
From: Kai Bao
Date: Wed, 15 Oct 2025 10:53:55 +0200
Subject: [PATCH 2/2] updating the repo with the new .pre-commit-config.yaml
---
INSTALL | 6 +++---
doc/EquationNotes.tex | 4 ++--
doc/doxygen/bestpractice.wml | 2 +-
doc/man1/mirror_grid.1 | 2 +-
tests/CORNERPOINT_ACTNUM.DATA | 4 ++--
5 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/INSTALL b/INSTALL
index 507a37c1c..141f9725c 100644
--- a/INSTALL
+++ b/INSTALL
@@ -10,7 +10,7 @@ Getting started
Suppose you have downloaded all DUNE modules of interest to your
computer and extracted then in one common directory. See [1] for a
-list of available modules.
+list of available modules.
To compile the modules Dune has to check several components of
your system and whether prerequisites within the modules are met. For
@@ -22,7 +22,7 @@ automake tools. Run
to commence those tests and build all modules you have
downloaded. Don't worry about messages telling you that libraries are
missing: they are only needed for grid-self-checks we need for
-developing.
+developing.
You can customize the build to your specific needs by using an options file
(see below)
@@ -74,7 +74,7 @@ dunecontrol --only=dune-common autogen --help
(In the svn version this has to be calles after running autogen.)
-An example of an options file is
+An example of an options file is
# use a special compiler (g++ version 3.4) and install to a custom
# directory, default is /usr/local/bin
diff --git a/doc/EquationNotes.tex b/doc/EquationNotes.tex
index abaef1ee0..4a0adb8e4 100644
--- a/doc/EquationNotes.tex
+++ b/doc/EquationNotes.tex
@@ -44,9 +44,9 @@ \subsection{The transport equation}
\end{align*}
Using equation \eqref{eq:GradPcap} we eliminate the phase pressures.
\begin{align*}
- \Kb\nabla p_{cow} & = -\lambda_o^{-1}\vb_o + \rho_o\Kb\gb
+ \Kb\nabla p_{cow} & = -\lambda_o^{-1}\vb_o + \rho_o\Kb\gb
+ \lambda_w^{-1}\vb_w - \rho_w\Kb\gb \\
- & = -\lambda_o^{-1}\vb_o
+ & = -\lambda_o^{-1}\vb_o
+ \lambda_w^{-1}\vb_w + (\rho_o - \rho_w)\Kb\gb \\
\end{align*}
Now we use equation~\eqref{eq:Vtot} to eliminate $\vb_o$:
diff --git a/doc/doxygen/bestpractice.wml b/doc/doxygen/bestpractice.wml
index 64df4cc48..0bedf45e5 100644
--- a/doc/doxygen/bestpractice.wml
+++ b/doc/doxygen/bestpractice.wml
@@ -57,4 +57,4 @@ source files and by the include statements in these source files.
source files are parsed. Entering a @defgroup statement makes
this module known to doxygen so that all modules mentioned in the
modules file are listed first and in the order they are
-defined there.
\ No newline at end of file
+defined there.
diff --git a/doc/man1/mirror_grid.1 b/doc/man1/mirror_grid.1
index 90c9a4dc1..52bf5ee09 100644
--- a/doc/man1/mirror_grid.1
+++ b/doc/man1/mirror_grid.1
@@ -2,7 +2,7 @@
.SH NAME
mirror_grid \- Mirror the grid in one direction.
.SH SYNOPSIS
-.B mirror_grid
+.B mirror_grid
\fI\,filename.grdecl\/\fR
\fI\,direction\/\fR
.SH DESCRIPTION
diff --git a/tests/CORNERPOINT_ACTNUM.DATA b/tests/CORNERPOINT_ACTNUM.DATA
index c83f0718c..d571afc22 100644
--- a/tests/CORNERPOINT_ACTNUM.DATA
+++ b/tests/CORNERPOINT_ACTNUM.DATA
@@ -1,4 +1,4 @@
-RUNSPEC
+RUNSPEC
DIMENS
10 10 5 /
@@ -200,7 +200,7 @@ ZCORN
/
ACTNUM
- 200*0 100*1 200*0 /
+ 200*0 100*1 200*0 /
PORO
500*0.15 /