From ce33169ef7b744e56819a05b69ae6c4512dbbc39 Mon Sep 17 00:00:00 2001 From: Rohit Goswami Date: Tue, 18 Jul 2023 17:33:10 +0000 Subject: [PATCH] ENH: Add an fprettify configuration --- .fprettify.rc | 28 ++++++++++++++++++++++++++++ .github/workflows/pre_commit.yml | 16 ++++++++++++++++ .pre-commit-config.yaml | 14 ++++++++++++++ 3 files changed, 58 insertions(+) create mode 100644 .fprettify.rc create mode 100644 .github/workflows/pre_commit.yml create mode 100644 .pre-commit-config.yaml diff --git a/.fprettify.rc b/.fprettify.rc new file mode 100644 index 0000000..e66d43a --- /dev/null +++ b/.fprettify.rc @@ -0,0 +1,28 @@ +# Replace FORTRAN style relational operators with C-style +# .e.g '.lt.' -> '<' +enable-replacements=True +c-relations=True + +# White space settings +indent=4 +line-length=132 +strict-indent=True +strip-comments=True +whitespace-relational=True +whitespace-logical=True +whitespace-plusminus=True +whitespace-multdiv=True +whitespace-comma=True +whitespace-intrinsics=True +whitespace-print=False +whitespace-type=False + +# Control whitespace around '::' declarations +whitespace-decl=True +enable-decl=True + +# Don't indent pre-processor statements +disable-fypp=True + +# Modules don't need indentation +disable-indent-mod=True diff --git a/.github/workflows/pre_commit.yml b/.github/workflows/pre_commit.yml new file mode 100644 index 0000000..09d126f --- /dev/null +++ b/.github/workflows/pre_commit.yml @@ -0,0 +1,16 @@ +name: pre-commit + +on: + pull_request: + push: + branches: [main] + +jobs: + pre-commit: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v3 + with: + python-version: '3.9' + - uses: pre-commit/action@v2.0.3 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..8383b57 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,14 @@ +repos: +- repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.4.0 + hooks: + - id: trailing-whitespace + exclude: ^(src) + - id: end-of-file-fixer + - id: check-yaml + - id: check-added-large-files +- repo: https://github.com/pseewald/fprettify + rev: v0.3.7 + hooks: + - id: fprettify + args: ["-c", ".fprettify.rc"]