|
| 1 | +# 🧹 Super-Linter (Reusable Workflow) |
| 2 | + |
| 3 | +This repository provides a **centralized reusable GitHub Actions workflow** to lint and format code across multiple languages using the powerful [Super-Linter](https://github.com/super-linter/super-linter) maintained by GitHub. |
| 4 | + |
| 5 | +--- |
| 6 | + |
| 7 | +## 📌 What is Super-Linter? |
| 8 | + |
| 9 | +[Super-Linter](https://github.com/super-linter/super-linter) is a simple combination of multiple linters, written in different programming languages, all wrapped in a Docker container for convenience. It helps enforce consistent code quality across your entire codebase. |
| 10 | + |
| 11 | +It supports linting for: |
| 12 | + |
| 13 | +- 🐍 Python (Black) |
| 14 | +- 📄 YAML, Markdown, JSON |
| 15 | +- ⚙️ GitHub Actions workflows |
| 16 | +- 💻 Shell scripts (shfmt) |
| 17 | +- 📦 Dockerfiles (Hadolint) |
| 18 | +- 🌐 JavaScript (ESLint) |
| 19 | + |
| 20 | +--- |
| 21 | + |
| 22 | +## 🛠️ What This Workflow Does |
| 23 | + |
| 24 | +This workflow: |
| 25 | + |
| 26 | +- Lints code across supported languages |
| 27 | +- Automatically commits and pushes auto-fixes for python (e.g., from `black`.) |
| 28 | +- Shows inline linting errors directly in GitHub Actions Menu. |
| 29 | +- Can be reused in multiple repositories to standardize linting across teams and projects. |
| 30 | + |
| 31 | +--- |
| 32 | + |
| 33 | +## 📦 Languages Currently Enabled |
| 34 | + |
| 35 | +You can modify or extend these in the workflow: |
| 36 | + |
| 37 | +- Python: Black, Flake8 |
| 38 | +- YAML: yamllint |
| 39 | +- Markdown: markdownlint |
| 40 | +- JSON: eslint, prettier |
| 41 | +- GitHub Actions: actionlint |
| 42 | +- Shell: shfmt |
| 43 | +- Dockerfile: Hadolint |
| 44 | +- JavaScript (ES): ESLint |
| 45 | + |
| 46 | +--- |
| 47 | + |
| 48 | +## 📋 Example Output |
| 49 | + |
| 50 | +When run, it gives a report like: |
| 51 | + |
| 52 | +<img width="661" alt="image" src="https://github.com/user-attachments/assets/93732fd7-9351-4df1-9c8e-703fa5d6a79b" /> |
| 53 | + |
| 54 | +--- |
| 55 | + |
| 56 | + |
| 57 | +## 📁 Reference Structure |
| 58 | + |
| 59 | +To use this linter in another OHR repository, simply reference it in your repo's workflow: |
| 60 | + |
| 61 | +Create a file at: |
| 62 | +`openhorizonrobitcs/reponame/.github/workflows/lint.yml` |
| 63 | + |
| 64 | +```yaml |
| 65 | +name: Lint Code Base |
| 66 | + |
| 67 | +on: |
| 68 | + push: |
| 69 | + paths: |
| 70 | + - '**/*' |
| 71 | + pull_request: |
| 72 | + paths: |
| 73 | + - '**/*' |
| 74 | + workflow_dispatch: |
| 75 | + |
| 76 | +jobs: |
| 77 | + call-super-linter: |
| 78 | + uses: openhorizonrobotics/.github/.github/workflows/Superlinter.yml@main |
0 commit comments