From f87793f6499694e9a6743950aa54ac5656589a29 Mon Sep 17 00:00:00 2001 From: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com> Date: Mon, 9 Sep 2024 14:13:19 +0530 Subject: [PATCH 1/5] Use Lychee pre-commit hook --- .github/workflows/links.yml | 49 ------------------------------ .gitignore | 3 ++ .pre-commit-config.yaml | 60 +++++++++++++++++++++++++++++-------- README.md | 1 - 4 files changed, 50 insertions(+), 63 deletions(-) delete mode 100644 .github/workflows/links.yml diff --git a/.github/workflows/links.yml b/.github/workflows/links.yml deleted file mode 100644 index 7fc6b6f..0000000 --- a/.github/workflows/links.yml +++ /dev/null @@ -1,49 +0,0 @@ -name: Check URLs with Lychee - -on: - push: - branches: - - main - pull_request: - schedule: - - cron: "0 3 * * *" - -jobs: - Check-URLs: - runs-on: ubuntu-latest - steps: - - - name: Restore Lychee cache - uses: actions/cache@v4 - with: - path: .lycheecache - key: cache-lychee-${{ github.sha }} - restore-keys: cache-lychee- - - - uses: actions/checkout@v4 - - - name: Link checker - id: lychee - uses: lycheeverse/lychee-action@2b973e86fc7b1f6b36a93795fe2c9c6ae1118621 - with: - # Same as those in the PyBaMM repository - args: | - --cache - --max-cache-age 3d . - --verbose - --no-progress - --timeout 10 - --max-retries 5 - --skip-missing - --exclude-loopback - --exclude https://twitter.com/* - --exclude "https://doi\.org|www.sciencedirect\.com/*" - --exclude https://plausible.io/pybamm.org - --accept 200,429,999 - format: markdown - jobSummary: true - fail: true - env: - GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} - - # TBD: automatically open an issue if any links fail diff --git a/.gitignore b/.gitignore index e858068..7d4281c 100644 --- a/.gitignore +++ b/.gitignore @@ -23,3 +23,6 @@ __pycache__/ # env Folder env/ + +# Lychee pre-commit hook +.lycheecache diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 08eac36..3705319 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -7,29 +7,63 @@ ci: # Standard hooks repos: -- repo: https://github.com/pre-commit/pre-commit-hooks + - repo: https://github.com/pre-commit/pre-commit-hooks rev: v4.6.0 hooks: - - id: trailing-whitespace - - id: end-of-file-fixer - - id: check-yaml - - id: check-added-large-files - - id: mixed-line-ending + - id: trailing-whitespace + - id: end-of-file-fixer + - id: check-yaml + - id: check-added-large-files + - id: mixed-line-ending + # Lychee: check links + - repo: https://github.com/lycheeverse/lychee.git + rev: v0.15.1 + hooks: + - id: lychee + pass_filenames: false + args: + - . + - --verbose + - --no-progress + - --timeout + - "10" + - --max-retries + - "5" + - --skip-missing + - --exclude-loopback + - --exclude + - https://twitter.com/* + - --exclude + - https://doi\.org|www.sciencedirect\.com/* + - --exclude + - https://plausible.io/pybamm.org + # Exclude the theme submodule and the built files. The latter are + # generated from the build and we don't bother with them because + # their links are either not relevant or are already checked. + - --exclude-path + - themes/ + - --exclude-path + - static/ + - --exclude-path + - public/ + - --exclude-path + - resources/ + - --accept + - 200,429,999 -# Python files -- repo: https://github.com/astral-sh/ruff-pre-commit + # Python files + - repo: https://github.com/astral-sh/ruff-pre-commit rev: v0.6.3 hooks: - - id: ruff + - id: ruff args: ["--fix", "--show-fixes"] - -# Spelling errors and typos -- repo: https://github.com/codespell-project/codespell + # Spelling errors and typos + - repo: https://github.com/codespell-project/codespell rev: v2.3.0 hooks: - - id: codespell + - id: codespell exclude: content/gsoc/2024/ankit-meda.md args: - "-Lrecuse,Meda" diff --git a/README.md b/README.md index d3affca..7c5daf8 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,6 @@ # pybamm.org [![Netlify](https://api.netlify.com/api/v1/badges/c4c60d47-1de1-4d0a-8a25-726d3cf100c8/deploy-status)](https://app.netlify.com/sites/pybamm-developer-preview/deploys) -[![Links](https://github.com/pybamm-team/pybamm.org/actions/workflows/links.yml/badge.svg)](https://github.com/pybamm-team/pybamm.org/actions/workflows/links.yml) [![pre-commit.ci](https://results.pre-commit.ci/badge/github/pybamm-team/pybamm.org/main.svg)](https://results.pre-commit.ci/latest/github/pybamm-team/pybamm.org/main) [![Gitpod](https://img.shields.io/badge/open%20in-Gitpod-blue?logo=gitpod)](https://gitpod.io/#https://github.com/pybamm-team/pybamm.org/) From bde13fcd3f664bb55e12cf5a60a5674b9934ee0e Mon Sep 17 00:00:00 2001 From: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com> Date: Tue, 10 Sep 2024 17:34:59 +0530 Subject: [PATCH 2/5] Fix formatting --- .pre-commit-config.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 23cc895..7d27d8c 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -52,8 +52,8 @@ repos: - --accept - 200,429,999 -# Python files -- repo: https://github.com/astral-sh/ruff-pre-commit + # Python files + - repo: https://github.com/astral-sh/ruff-pre-commit rev: v0.6.4 hooks: - id: ruff From 5ed54d97855065c7eed5ef04a45b57c122b22b1f Mon Sep 17 00:00:00 2001 From: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com> Date: Tue, 10 Sep 2024 17:48:03 +0530 Subject: [PATCH 3/5] Add `entry:` field with binary name --- .pre-commit-config.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 7d27d8c..a9bc3b5 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -21,6 +21,7 @@ repos: rev: v0.15.1 hooks: - id: lychee + entry: lychee pass_filenames: false args: - . From 87fe1a9a1a49643671f261b6ed506b332303899c Mon Sep 17 00:00:00 2001 From: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com> Date: Fri, 3 Jan 2025 00:35:47 +0530 Subject: [PATCH 4/5] Fix some links and bump some hooks' versions --- .pre-commit-config.yaml | 4 ++-- content/about/index.md | 2 +- content/community.md | 2 +- content/learn.md | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index f2240f2..d20dfcb 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -7,7 +7,7 @@ ci: # Standard hooks repos: -- repo: https://github.com/pre-commit/pre-commit-hooks + - repo: https://github.com/pre-commit/pre-commit-hooks rev: v5.0.0 hooks: - id: trailing-whitespace @@ -54,7 +54,7 @@ repos: - 200,429,999 # Python files -- repo: https://github.com/astral-sh/ruff-pre-commit + - repo: https://github.com/astral-sh/ruff-pre-commit rev: v0.8.4 hooks: - id: ruff diff --git a/content/about/index.md b/content/about/index.md index 41ab7e0..2338d75 100644 --- a/content/about/index.md +++ b/content/about/index.md @@ -26,7 +26,7 @@ donations and how you can support, please see the [Donate](/donate/) page. [Ionworks](https://ionworks.com/) is a company founded by members of the PyBaMM core development team to ensure [PyBaMM's long-term success](https://ionworks.com/blog/our-relationship-with-pybamm). Ionworks provides support and custom feature development for PyBaMM, as well as software to make modeling easier and faster. For companies who want to leverage the power, flexibility, and openness of the Python ecosystem for their battery simulation needs, Ionworks is the go-to partner. -[Contact Ionworks](https://ionworks.com/contact-us) to find out more. +[Contact Ionworks](https://ionworks.com/) to find out more. {{< figure >}} src = '/images/logos/ionworks-logo.png' diff --git a/content/community.md b/content/community.md index 8acf9a5..dee6cff 100644 --- a/content/community.md +++ b/content/community.md @@ -34,7 +34,7 @@ For general inquiries, other than topics listed above, you can contact us by ema [Ionworks](https://ionworks.com/) is a company founded by members of the PyBaMM core development team to ensure [PyBaMM's long-term success](https://ionworks.com/blog/our-relationship-with-pybamm). Ionworks provides support and custom feature development for PyBaMM, as well as software to make modeling easier and faster. For companies who want to leverage the power, flexibility, and openness of the Python ecosystem for their battery simulation needs, Ionworks is the go-to partner. -[Contact Ionworks](https://ionworks.com/contact-us) to find out more. +[Contact Ionworks](mailto:info@ionworks.com) to find out more. ## Governance diff --git a/content/learn.md b/content/learn.md index a3a2894..0a72fac 100644 --- a/content/learn.md +++ b/content/learn.md @@ -50,4 +50,4 @@ We regularly hold PyBaMM workshops. You can find a list of the workshops we have ## Get help -You can get help by posting questions on the [PyBaMM Slack channels](https://pybamm.org/slack/) or preferably in [GitHub discussions](https://github.com/pybamm-team/PyBaMM/discussions). You can also get paid support from [Ionworks](https://ionworks.com/contact-us). +You can get help by posting questions on the [PyBaMM Slack channels](https://pybamm.org/slack/) or preferably in [GitHub discussions](https://github.com/pybamm-team/PyBaMM/discussions). You can also get paid support from [Ionworks](https://ionworks.com/). From 9842478c902125528b10ea180c499873270283c7 Mon Sep 17 00:00:00 2001 From: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com> Date: Fri, 3 Jan 2025 00:57:18 +0530 Subject: [PATCH 5/5] Don't add Lychee CLI name to entry key --- .pre-commit-config.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index d20dfcb..6495aab 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -21,7 +21,6 @@ repos: rev: v0.15.1 hooks: - id: lychee - entry: lychee pass_filenames: false args: - .