From e2325df0b94423305043b944d747bbb32aeacf4a Mon Sep 17 00:00:00 2001 From: Jan Philipp Thiele Date: Mon, 25 Nov 2024 14:14:03 +0100 Subject: [PATCH 1/8] [pre-commit] add check for large files --- .pre-commit-config.yaml | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100755 .pre-commit-config.yaml diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100755 index 000000000..9ce1deb5f --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,6 @@ +repos: +- repo: https://github.com/pre-commit/pre-commit-hooks + rev: v5.0.0 + hooks: + - id: check-added-large-files + args: [--maxkb=8192] From 6162031106980d890766836d1520d18641714a61 Mon Sep 17 00:00:00 2001 From: Jan Philipp Thiele Date: Mon, 25 Nov 2024 14:17:58 +0100 Subject: [PATCH 2/8] [pre-commit] add check for merge conflicts --- .pre-commit-config.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 9ce1deb5f..bd0fcc32e 100755 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -4,3 +4,4 @@ repos: hooks: - id: check-added-large-files args: [--maxkb=8192] + - id: check-merge-conflict From 0048c5a30104a4e210488beed2c5fd8950172c54 Mon Sep 17 00:00:00 2001 From: Jan Philipp Thiele Date: Mon, 25 Nov 2024 14:19:15 +0100 Subject: [PATCH 3/8] [pre-commit] add check for TOML and YAML syntax --- .pre-commit-config.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index bd0fcc32e..ee13d2303 100755 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -5,3 +5,6 @@ repos: - id: check-added-large-files args: [--maxkb=8192] - id: check-merge-conflict + - id: check-toml + - id: check-yaml + args: [--allow-multiple-documents] From b7c9a1356a7c000f2e9849b52dcf0297af93066e Mon Sep 17 00:00:00 2001 From: Jan Philipp Thiele Date: Mon, 25 Nov 2024 14:22:18 +0100 Subject: [PATCH 4/8] [pre-commit] add and apply end of file fixer --- .pre-commit-config.yaml | 1 + CITATIONS.bib | 3 --- docs/src/devel.md | 5 ----- docs/src/grid.md | 3 --- docs/src/impedance-derivation.tex | 10 ---------- docs/src/index.md | 2 -- docs/src/method.md | 2 -- docs/src/notebooks.md | 1 - docs/src/post.md | 1 - docs/src/solutions.md | 1 - docs/src/solver.md | 1 - docs/src/system.md | 1 - examples/.JuliaFormatter.toml | 1 - src/vfvm_history.jl | 1 - test/runtests.jl | 4 ---- test/test_formfactors.jl | 1 - test/test_state.jl | 1 - 17 files changed, 1 insertion(+), 38 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ee13d2303..b5c85c0c3 100755 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -8,3 +8,4 @@ repos: - id: check-toml - id: check-yaml args: [--allow-multiple-documents] + - id: end-of-file-fixer diff --git a/CITATIONS.bib b/CITATIONS.bib index 61bf2887a..4deb5c011 100644 --- a/CITATIONS.bib +++ b/CITATIONS.bib @@ -224,6 +224,3 @@ @inproceedings{cances2020four doi="10.1007/978-3-030-43651-3_13", organization={Springer} } - - - diff --git a/docs/src/devel.md b/docs/src/devel.md index c5d04cfb6..f8bdf4499 100644 --- a/docs/src/devel.md +++ b/docs/src/devel.md @@ -6,8 +6,3 @@ The pluto notebooks in this package are "triple use": - As typical Pluto notebooks, they are self-contained in the senses that they contain their own Project and Manifest files. So users can just download and execute them. - If they run with the environment variable `PLUTO_PROJECT` set to some julia environment, this environment will activated at the start of the notebook. In particular, they use `Revise.jl` so they can be run during development of VoronoiFVM.jl. See also https://github.com/fonsp/Pluto.jl/issues/1788 . - During CI tests, they are run as scripts. For this purpose they are wrapped into temporary modules, and @test macros can be used in the notebooks. - - - - - diff --git a/docs/src/grid.md b/docs/src/grid.md index c59d0120d..ed0861406 100644 --- a/docs/src/grid.md +++ b/docs/src/grid.md @@ -48,6 +48,3 @@ Pages = [ ] Order = [:function] ``` - - - diff --git a/docs/src/impedance-derivation.tex b/docs/src/impedance-derivation.tex index d498fab25..41f0f5757 100644 --- a/docs/src/impedance-derivation.tex +++ b/docs/src/impedance-derivation.tex @@ -366,13 +366,3 @@ \section{Algorithmic implementation} \end{description} \end{document} - - - - - - - - - - diff --git a/docs/src/index.md b/docs/src/index.md index 06330bbd0..3ac6091db 100644 --- a/docs/src/index.md +++ b/docs/src/index.md @@ -13,5 +13,3 @@ Please consider a pull request updating `CITATION.bib` if you have published wor ```@bibliography * ``` - - diff --git a/docs/src/method.md b/docs/src/method.md index 28e962935..3e088e596 100644 --- a/docs/src/method.md +++ b/docs/src/method.md @@ -165,5 +165,3 @@ The entities describing the discrete system can be subdivided into two categorie The solution of the nonlinear systems of equations is performed by Newton's method combined with various direct and iterative linear solvers. The Jacobi matrices used in Newton's method are assembled from the constitutive functions with the help of forward mode automatic differentiation implemented in [ForwardDiff.jl](https://github.com/JuliaDiff/ForwardDiff.jl). - - diff --git a/docs/src/notebooks.md b/docs/src/notebooks.md index b960be710..3a7788511 100644 --- a/docs/src/notebooks.md +++ b/docs/src/notebooks.md @@ -3,4 +3,3 @@ About the notebooks [Pluto.jl](https://github.com/fonsp/Pluto.jl) notebooks provide a great opportunity to put together code, text and graphics in a reproducible and accessible way. Therefore, the examples for this package are being amended by a series of Pluto notebooks. Like the example code, the notebook code is tested during CI. - diff --git a/docs/src/post.md b/docs/src/post.md index d29c3a77c..7f3991f59 100644 --- a/docs/src/post.md +++ b/docs/src/post.md @@ -63,4 +63,3 @@ after the solution of the unexcited stationary system. Modules = [VoronoiFVM] Pages = ["vfvm_impedance.jl"] ``` - diff --git a/docs/src/solutions.md b/docs/src/solutions.md index ad953bad9..df82335de 100644 --- a/docs/src/solutions.md +++ b/docs/src/solutions.md @@ -23,4 +23,3 @@ Pages=["vfvm_sparsesolution.jl"] Modules = [VoronoiFVM] Pages=["vfvm_transientsolution.jl"] ``` - diff --git a/docs/src/solver.md b/docs/src/solver.md index 2da03a02a..39bb1325a 100644 --- a/docs/src/solver.md +++ b/docs/src/solver.md @@ -160,4 +160,3 @@ NoBlock EquationBlock PointBlock ``` - diff --git a/docs/src/system.md b/docs/src/system.md index c06e7c6c0..b7a25fd45 100644 --- a/docs/src/system.md +++ b/docs/src/system.md @@ -121,4 +121,3 @@ VoronoiFVM.SparseSystem viewK viewL ``` - diff --git a/examples/.JuliaFormatter.toml b/examples/.JuliaFormatter.toml index 7d3256dd2..d322980b0 100644 --- a/examples/.JuliaFormatter.toml +++ b/examples/.JuliaFormatter.toml @@ -1,4 +1,3 @@ style = "sciml" always_for_in = false separate_kwargs_with_semicolon = true - diff --git a/src/vfvm_history.jl b/src/vfvm_history.jl index 495140997..b38189429 100644 --- a/src/vfvm_history.jl +++ b/src/vfvm_history.jl @@ -169,4 +169,3 @@ history_details(sol) = details(sol.history) Return summary of solver history from last `solve` call, if `log` was set to true. """ history_summary(sol) = summary(sol.history) - diff --git a/test/runtests.jl b/test/runtests.jl index 0487827da..230cd8c4d 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -96,7 +96,3 @@ elseif haskey(ENV,"NOTEBOOKS_ONLY") else run_all_tests(; run_notebooks = VERSION < v"1.12.0-DEV.0" , notebooksonly = false) end - - - - diff --git a/test/test_formfactors.jl b/test/test_formfactors.jl index e5fedd40c..5af9f0614 100644 --- a/test/test_formfactors.jl +++ b/test/test_formfactors.jl @@ -25,4 +25,3 @@ end end - diff --git a/test/test_state.jl b/test/test_state.jl index 06e17cbe6..17665a334 100644 --- a/test/test_state.jl +++ b/test/test_state.jl @@ -49,4 +49,3 @@ function runtests() end end - From 98d1f5975bba14bd431463d3563930342dd013a1 Mon Sep 17 00:00:00 2001 From: Jan Philipp Thiele Date: Mon, 25 Nov 2024 14:26:38 +0100 Subject: [PATCH 5/8] [pre-commit] add no master branch commit check --- .pre-commit-config.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index b5c85c0c3..42f8b1585 100755 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -9,3 +9,5 @@ repos: - id: check-yaml args: [--allow-multiple-documents] - id: end-of-file-fixer + - id: no-commit-to-branch + args: [--branch,master] From 74042b9e5c40f30835a646594222724dc67fe8b0 Mon Sep 17 00:00:00 2001 From: Jan Philipp Thiele Date: Mon, 25 Nov 2024 14:29:11 +0100 Subject: [PATCH 6/8] [pre-commit] add hardcoded secret check --- .pre-commit-config.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 42f8b1585..b444f7424 100755 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -11,3 +11,7 @@ repos: - id: end-of-file-fixer - id: no-commit-to-branch args: [--branch,master] +- repo: https://github.com/gitleaks/gitleaks + rev: v8.16.3 + hooks: + - id: gitleaks From f7e96e06beba8dbeec578b140e39f80b609ef2b3 Mon Sep 17 00:00:00 2001 From: Jan Philipp Thiele Date: Mon, 25 Nov 2024 14:34:23 +0100 Subject: [PATCH 7/8] [pre-commit] add codespell check --- .pre-commit-config.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index b444f7424..83a49f5a2 100755 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -15,3 +15,7 @@ repos: rev: v8.16.3 hooks: - id: gitleaks +- repo: https://github.com/codespell-project/codespell + rev: v2.2.4 + hooks: + - id: codespell From 96ac9227c1f5a5caa5cac8420230489a6b333c18 Mon Sep 17 00:00:00 2001 From: Jan Philipp Thiele Date: Mon, 25 Nov 2024 14:38:48 +0100 Subject: [PATCH 8/8] [pre-commit] add CI workflow file --- .github/workflows/pre-commit.yml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 .github/workflows/pre-commit.yml diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml new file mode 100644 index 000000000..eac2920e5 --- /dev/null +++ b/.github/workflows/pre-commit.yml @@ -0,0 +1,21 @@ +name: pre-commit + +on: + pull_request: + +jobs: + pre-commit: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: julia-actions/setup-julia@v2 + with: + version: 1.11 + - run: | + julia --project=@runic -e ' + using Pkg + Pkg.add("Runic")' + env: + PYTHON: "" + - uses: actions/setup-python@v5 + - uses: pre-commit/action@v3.0.1