diff options
author | bors-servo <lbergstrom+bors@mozilla.com> | 2016-08-04 12:31:17 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-08-04 12:31:17 -0500 |
commit | 4bc629b369242d16675161ab6af8141dab0bb556 (patch) | |
tree | f2bee6e15579264bdd26191391be866a02e13c32 /python/tidy/servo_tidy_tests/test_tidy.py | |
parent | aced80b56de7921faec73cc1d0fd92c0dd4aa325 (diff) | |
parent | 7952bd00b687c3c1f5458f1750267e2bc1469ddd (diff) | |
download | servo-4bc629b369242d16675161ab6af8141dab0bb556.tar.gz servo-4bc629b369242d16675161ab6af8141dab0bb556.zip |
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 -->
Diffstat (limited to 'python/tidy/servo_tidy_tests/test_tidy.py')
-rw-r--r-- | python/tidy/servo_tidy_tests/test_tidy.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/python/tidy/servo_tidy_tests/test_tidy.py b/python/tidy/servo_tidy_tests/test_tidy.py index 6497fa016b7..b08e6057541 100644 --- a/python/tidy/servo_tidy_tests/test_tidy.py +++ b/python/tidy/servo_tidy_tests/test_tidy.py @@ -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]) |