Skip to content

Commit

Permalink
Fix false positive travis build (oppia#6002)
Browse files Browse the repository at this point in the history
* Fixes false positive builds on Travis.

* Add timeout proportional to the number of files to lint

* Set proportion for a timeout

* Add timeout multiplier
  • Loading branch information
nithusha21 authored and DubeySandeep committed Dec 19, 2018
1 parent 04f4b8f commit 85057a7
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions scripts/pre_commit_linter.py
Original file line number Diff line number Diff line change
Expand Up @@ -729,10 +729,18 @@ def _pre_commit_linter(all_files):
process.daemon = False
process.start()

for process in linting_processes:
file_groups_to_lint = [
html_files_to_lint_for_css, css_files_to_lint,
js_files_to_lint, py_files_to_lint]
number_of_files_to_lint = sum(
len(file_group) for file_group in file_groups_to_lint)

TIMEOUT_MULTIPLIER = 1000
for file_group, process in zip(file_groups_to_lint, linting_processes):
# Require timeout parameter to prevent against endless waiting for the
# linting function to return.
process.join(timeout=200)
process.join(timeout=(
TIMEOUT_MULTIPLIER * len(file_group) / number_of_files_to_lint))

js_messages = []
while not js_stdout.empty():
Expand Down

0 comments on commit 85057a7

Please sign in to comment.