From c21203f34bd6bfcaf809cec4e1f8ffec62576fff Mon Sep 17 00:00:00 2001 From: Emma Roy Date: Thu, 1 Oct 2026 22:32:23 -0400 Subject: [PATCH] update submitty_test with twig-lint, yaml-lint, shell-lint --- .../testing/linting_static_analysis.md | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/_docs/developer/testing/linting_static_analysis.md b/_docs/developer/testing/linting_static_analysis.md index 68856b9b..9a449be3 100644 --- a/_docs/developer/testing/linting_static_analysis.md +++ b/_docs/developer/testing/linting_static_analysis.md @@ -133,10 +133,13 @@ bash .setup/SUBMITTY_TEST.sh [options] - `phpcs`: Runs PHP CodeSniffer. [option: `--fix`] - `phpstan`: Runs PHP static analysis. [option: `--memory-limit <#>G`, `--generate-baseline`] - `php-lint`: Runs both PHP CodeSniffer and PHPStan (default options only). +- `twig-lint`: Lints all Twig templates. [option: `--format FORMAT`, `--show-deprecations`, `/path/to/file`] - `php-unit`: Runs PHP unit tests. [option: `--filter testFunctionName`, `--debug`] - `js-lint`: Runs eslint. [option: `--fix`] - `js-unit`: Runs the jest test suite. [option: `--api`] - `css-lint`: Runs stylelint. [option: `--fix`] +- `shell-lint`: Runs ShellCheck. +- `yaml-lint`: Runs yamllint. - `py-flake8`: Runs flake8. [option: `/path/to/specific_file.py`] - `py-pylint`: Runs pylint. [option: `/path/to/specific_file.py`] - `py-lint`: Runs pylint & flake8. [option: `/path/to/specific_file.py`] @@ -155,6 +158,13 @@ submitty_test phpcs --fix submitty_test phpstan ``` +## Twig Linting: +```bash +submitty_test twig-lint +submitty_test --show-deprecations +submitty_test /app/templates/File.twig # or any other path to a Twig file +``` + ## PHP Unit Testing: ```bash @@ -231,6 +241,38 @@ npm run css-stylelint:fix See also: [CSS Style Guide](/developer/coding_style_guide/css) +## Shell Linting + +Code in Submitty's `filename.sh` files is linted using [ShellCheck](https://github.com/koalaman/shellcheck/wiki). As with other languages, `submitty_test` can be used as an alias for the `SUBMITTY_TEST.sh` script. + +```bash +submitty_test shell-lint +``` + +Alternatively, you can run ShellCheck on your host system or on vagrant by running: + +```bash +python3 run_shellcheck.py +``` + +***NOTE:** To run the `run_shellcheck.py` wrapper script for shellcheck, you must be in the project root on your host system or in `/usr/local/submitty/GIT_CHECKOUT/Submitty` on the VM.* + +## YAML Linting + +YAML and YML are linted using [yamllint](https://yamllint.readthedocs.io/en/stable/). As with other languages, `submitty_test` can be used as an alias for the `SUBMITTY_TEST.sh` script. + +```bash +submitty_test yaml-lint +``` + +Alternatively, you can run yamllint on your host system (yamllint is not installed on the VM) by running: + +```bash +yamllint . +``` + +***NOTE:** For yamllint to see the .yamllint baseline file, you must be in the project root on your host system.* + ## Python Linting Python is linted using [flake8](https://flake8.pycqa.org/en/latest/) and [pylint](https://pylint.readthedocs.io/en/stable/) in Submitty. As with other languages, `submitty_test` can be used as an alias for the `SUBMITTY_TEST.sh` script.