aboutsummaryrefslogtreecommitdiffstats
path: root/python/tidy/servo_tidy_tests/test_tidy.py
diff options
context:
space:
mode:
authorJim Berlage <jberlage@mdsol.com>2016-07-05 12:15:40 -0500
committerJim Berlage <jberlage@mdsol.com>2016-07-22 11:53:14 -0500
commit7952bd00b687c3c1f5458f1750267e2bc1469ddd (patch)
tree1ecca5e37f3bf72fa2c4c24ea74abba8003fc1ea /python/tidy/servo_tidy_tests/test_tidy.py
parent1e0321f7dde5f33f7d26bbd4f088622fa3660477 (diff)
downloadservo-7952bd00b687c3c1f5458f1750267e2bc1469ddd.tar.gz
servo-7952bd00b687c3c1f5458f1750267e2bc1469ddd.zip
Add linting for shell scripts
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.
Diffstat (limited to 'python/tidy/servo_tidy_tests/test_tidy.py')
-rw-r--r--python/tidy/servo_tidy_tests/test_tidy.py6
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 8db19a5efd7..3ad7e03d667 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])