aboutsummaryrefslogtreecommitdiffstats
path: root/python/tidy
diff options
context:
space:
mode:
authorSijmen Schoon <me@sijmenschoon.nl>2016-12-03 19:52:47 +0100
committerSijmen Schoon <me@sijmenschoon.nl>2016-12-03 19:52:59 +0100
commit42e675942c5579790db13ab564986825550b1f27 (patch)
treedf96efa7eaa4d046ed18a6b3d57c468612b2ca5b /python/tidy
parentc974b61d7fe3b63dc6ec81e52b7a4894f537e7a0 (diff)
downloadservo-42e675942c5579790db13ab564986825550b1f27.tar.gz
servo-42e675942c5579790db13ab564986825550b1f27.zip
Implement tidy commit message test
Tests for work in progress commits.
Diffstat (limited to 'python/tidy')
-rw-r--r--python/tidy/servo_tidy/tidy.py20
1 files changed, 19 insertions, 1 deletions
diff --git a/python/tidy/servo_tidy/tidy.py b/python/tidy/servo_tidy/tidy.py
index 18bfcb6713e..682100f6e01 100644
--- a/python/tidy/servo_tidy/tidy.py
+++ b/python/tidy/servo_tidy/tidy.py
@@ -942,6 +942,21 @@ def run_lint_scripts(only_changed_files=False, progress=True):
yield error
+def check_commits(path='.'):
+ """Gets all commits since the last merge."""
+ args = ['git', 'log', '-n1', '--merges', '--format=%H']
+ last_merge = subprocess.check_output(args, cwd=path).strip()
+ args = ['git', 'log', '{}..HEAD'.format(last_merge), '--format=%s']
+ commits = subprocess.check_output(args, cwd=path).lower().splitlines()
+
+ for commit in commits:
+ # .split() to only match entire words
+ if 'wip' in commit.split():
+ yield ('.', 0, 'no commits should contain WIP')
+
+ raise StopIteration
+
+
def scan(only_changed_files=False, progress=True):
# check config file for errors
config_errors = check_config_file(CONFIG_FILE_PATH)
@@ -957,8 +972,11 @@ def scan(only_changed_files=False, progress=True):
dep_license_errors = check_dep_license_errors(get_dep_toml_files(only_changed_files), progress)
# other lint checks
lint_errors = run_lint_scripts(only_changed_files, progress)
+ # check commits for WIP
+ commit_errors = check_commits()
# chain all the iterators
- errors = itertools.chain(config_errors, directory_errors, file_errors, dep_license_errors, lint_errors)
+ errors = itertools.chain(config_errors, directory_errors, file_errors, dep_license_errors, lint_errors,
+ commit_errors)
error = None
for error in errors: