Skip to content

Add lint check for workshop material (trial) - #10

Closed
cmvcordova wants to merge 5 commits into
mainfrom
add-workshop-lint
Closed

cmvcordova wants to merge 5 commits into
mainfrom
add-workshop-lint

Conversation

@cmvcordova

@cmvcordova cmvcordova commented Oct 1, 2026 •

Copy link
Copy Markdown
Member

Trial of a lint check for workshop material, prompted by #9, where a missing comma made the notebook invalid JSON and nothing flagged it.

What it does

On every pull request it checks the files that PR changes.

Fails the check (the file cannot be opened or run at all):

  • .ipynb is not valid JSON
  • .py, .R or .sh does not parse
  • .Rmd / .qmd has a broken YAML header or a code chunk that is never closed
  • .mlx is not a valid archive

Warns only (annotations and a job summary, check still passes):

  • a notebook code cell or an Rmd/qmd chunk does not parse
  • a notebook was committed with an error output
  • a notebook uses a relative image path, which does not render in Colab

Cell-level syntax is a warning on purpose: student notebooks contain intentional blanks.

It is a separate workflow from the PR checklist one, which is untouched. It runs on pull_request with a read-only token and no secrets, so it is safe for forks.

How it was tested

Run locally against the files touched by 29 past pull requests across the organisation (93 files, 16 repositories):

  • 2 hard failures: Update names and date #9 here, and an attendee practice PR in IntroToGitHub (a .R file containing a sentence). None on the 26 merged PRs.
  • Each check was confirmed to fire on a deliberately broken copy of a real file.

On a GitHub runner, in this PR (each run takes about 10 seconds):

  • clean repository: passes, with 9 warnings shown as annotations (run);
  • with the notebook from Update names and date #9 committed temporarily (033374d, reverted in 6c30035): fails with line 21: not valid JSON, the notebook cannot be opened (run).

Because this PR changes the linter itself, it lints every file in the repository; a normal PR only has its changed files checked. The temporary commit and its revert disappear with a squash merge.

Not covered

  • Nothing is executed, so wrong results in code that runs are not caught.
  • The R path (installing R on the runner) is not exercised here, since this repository has no R files.
  • .m files are not checked.

If the trial works, the script and workflow could move to MiCM_PR_Bot and be synced to the other workshop repositories.

🤖 Generated with Claude Code

Checks the files a pull request changes: notebooks must be valid JSON,
Python, R and shell scripts must parse, Rmd/qmd headers and chunks must
be well formed. Those fail the check. Code cells that do not parse,
committed error outputs and relative image paths are reported as
warnings, since student notebooks contain intentional blanks.

Runs on pull_request with a read-only token, separate from the
checklist workflow.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Oct 1, 2026

Copy link
Copy Markdown

PR Checklist

PR: #10
Author: @cmvcordova

Please confirm the following before requesting review:

  • You have read the workshop contribution guidelines
  • You have included a README outlining the workshop and its contents
  • You have included requirements and setup instructions in the README.md
  • You have tested the workshop exercises and data sets
  • You have organized your repo to match the workshop template structure
  • You have included a pdf copy of your slides to facilitate review
  • All changes or contributions are clearly explained in the PR description

Reply to this comment or check off the boxes when complete.

cmvcordova and others added 4 commits October 1, 2026 15:43
Reverted in the next commit.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This reverts commit 033374d.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Test caller: points at the add-workshop-lint branch of MiCM_PR_Bot.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@cmvcordova

Copy link
Copy Markdown
Member Author

Rerouted to QLS-MiCM/MiCM_PR_Bot#2: the linter and a reusable workflow now live there, and workshop repos only need a thin caller. Closing this without merging.

The add-workshop-lint branch here is left in place as a test bed. Its last commit is the thin caller pointing at the add-workshop-lint branch of MiCM_PR_Bot (passing run). It can be deleted once MiCM_PR_Bot#2 is settled.

@cmvcordova cmvcordova closed this Oct 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant