Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add MegaLinter for JSON and GitHub Workflow files #573

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

bitonality
Copy link
Contributor

MegaLinter

MegaLinter is an aggregate linter that combines a huge collection of different language/format linters and consolidates their configs. It's a hard fork of SuperLinter, but I prefer MegaLinter's approach to documentation and security more than SuperLinter. If you are unfamiliar with either of these aggregate linters, you can check out MegaLinter's website (https://megalinter.io/latest/).

This PR enables linting for GitHub actions and static JSON from MegaLinter.

JSON

Lints JSON files to make sure we aren't checking in malformed configurations/settings files. Reports are served as a pull request comment and inline on the file viewer for the PR. The JSON linter has auto-fixing disabled and is set to only emit errors. JSON linting only occurs on JSON files that change within the PR being evaluated. Example below:

jsonlint fail

GitHub Actions

Lints GitHub actions yml/yaml for correct syntax and reports errors that would typically silently fail or not behave as expected. This helps cut down on the amount of iterations needed to test GitHub actions and ensures that our workflows remain robust and stable. GitHub workflow linting will evaluate on ALL workflow files when one or more is changed. This is because workflows can cross reference each other and we want to ensure that we aren't breaking workflows not involved in the pull request. Example below:

actionlint

Pull Request reporting

megalinter

MegaLinter automatically adds a report to the PR comments with links to the relevant logs so devs can easily identify where the problems are. Linting is configured to run whenever a PR is created or updated.

Future Extensibility

MegaLinter already has out of the box support for the following use cases that are relevant to us:

  • clang-format and cpplint for our C++ code.
  • luacheck for our lua scripts
  • pylint/ruff/bandit/black/flake8 for our python scripts
  • clippy for rust
  • markdownlint/remark-lint/markdown-link-check for markdown/docs validation
  • cspell/vale for spell checking in docs or in code
  • gitleaks for static secret scanning
  • git_diff for checking for merge conflict markers

Copy link
Contributor

🦙 MegaLinter status: ❌ ERROR

Descriptor Linter Files Fixed Errors Elapsed time
❌ ACTION actionlint 5 4 0.02s
✅ JSON jsonlint 3 0 0.19s

See detailed report in MegaLinter reports

MegaLinter is graciously provided by OX Security

@bitonality
Copy link
Contributor Author

What's our mechanism of integrating discord with github web hooks? I think it would be nice to disable discord notifications on specific messages (we currently get a notification whenever the linter runs for the first time on any PR)

@narknon
Copy link
Collaborator

narknon commented Jun 17, 2024

I don't know if we can get that granual, it's just standard webhook settings

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.

2 participants