mirror of
https://github.com/servo/servo.git
synced 2025-07-22 23:03:42 +01:00
Auto merge of #12295 - jimberlage:12158/shell-linting, r=aneeshusa
Add linting for shell scripts <!-- Please describe your changes on the following line: --> This changes tidy to check shell scripts for the proper shebang and options. It does not check that variables are formatted correctly. It also adds a check for the MPL 2.0 license in shell scripts. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes fix #12158 (github issue number if applicable). <!-- Either: --> - [X] There are tests for these changes OR - [ ] These changes do not require tests because _____ <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/12295) <!-- Reviewable:end -->
This commit is contained in:
commit
4bc629b369
10 changed files with 104 additions and 13 deletions
|
@ -48,6 +48,12 @@ class CheckTidiness(unittest.TestCase):
|
|||
self.assertEqual('incorrect license', errors.next()[2])
|
||||
self.assertNoMoreErrors(errors)
|
||||
|
||||
def test_shell(self):
|
||||
errors = tidy.collect_errors_for_files(iterFile('shell_tidy.sh'), [], [tidy.check_shell], print_text=False)
|
||||
self.assertEqual('script does not have shebang "#!/usr/bin/env bash"', errors.next()[2])
|
||||
self.assertEqual('script is missing options "set -o errexit", "set -o pipefail"', errors.next()[2])
|
||||
self.assertNoMoreErrors(errors)
|
||||
|
||||
def test_rust(self):
|
||||
errors = tidy.collect_errors_for_files(iterFile('rust_tidy.rs'), [], [tidy.check_rust], print_text=False)
|
||||
self.assertEqual('use statement spans multiple lines', errors.next()[2])
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue