Repository: oppia/oppia

Issue:
Linter not working for multiple js files
**Describe the bug**
Running the pre_commit_linter on a single js file catches the error but when it is run on multiple files in a folder, errors are not caught.

**To Reproduce**
Steps to reproduce the behavior:
 1. Open the file `core/templates/dev/head/domain/learner_dashboard/LearnerDashboardActivityIdsObjectFactorySpec.js`
 2. Edit any line to make it longer than 80
 3. Run the linter as `python scripts/pre_commit_linter.py --files core/templates/dev/head/domain/learner_dashboard/LearnerDashboardActivityIdsObjectFactorySpec.js`
 4. You will see that the line is caught as error
 5. Now run the linter as `python scripts/pre_commit_linter.py --path core/templates/dev/head/domain/learner_dashboard/`
6. The last message will be Js linting finished and no error will be caught.

**Observed behavior**
Linter is not catching errors when there are multiple files.

**Expected behavior**
Errors should be caught in every case.

**Screenshots**
For first case: 
![image](https://user-images.githubusercontent.com/15226041/55556702-d31f2f00-5705-11e9-9f1d-e95faff25e6c.png)
For second case:
![image](https://user-images.githubusercontent.com/15226041/55556733-e16d4b00-5705-11e9-8af3-9853b78c2fbe.png)

**Desktop (please complete the following information; delete this section if the issue does not arise on desktop):**
 - OS: Ubuntu 16.04
 
\cc @oppia/dev-workflow-team 


Discussion:

Resolving patch:
diff --git a/scripts/pre_commit_linter.py b/scripts/pre_commit_linter.py
--- a/scripts/pre_commit_linter.py
+++ b/scripts/pre_commit_linter.py
@@ -302,6 +302,7 @@
     os.path.join(_PARENT_DIR, 'oppia_tools', 'pylint-quotes-0.1.9'),
     os.path.join(_PARENT_DIR, 'oppia_tools', 'selenium-2.53.2'),
     os.path.join(_PARENT_DIR, 'oppia_tools', 'PIL-1.1.7'),
+    os.path.join(_PARENT_DIR, 'oppia_tools', 'PyGithub-1.43.5'),
     os.path.join('third_party', 'backports.functools_lru_cache-1.5'),
     os.path.join('third_party', 'gae-pipeline-1.9.17.0'),
     os.path.join('third_party', 'bleach-1.2.2'),
@@ -1075,24 +1076,8 @@ def _lint_all_files(self):
             process.daemon = False
             process.start()
 
-        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 = 2000
-        for file_group, process in zip(file_groups_to_lint, linting_processes):
-            # try..except block is needed to catch ZeroDivisionError
-            # when there are no CSS, HTML, JavaScript and Python files to lint.
-            try:
-                # Require timeout parameter to prevent against endless
-                # waiting for the linting function to return.
-                process.join(timeout=(
-                    timeout_multiplier * (
-                        len(file_group) / number_of_files_to_lint)))
-            except ZeroDivisionError:
-                break
+        for process in linting_processes:
+            process.join()
 
         js_messages = []
         while not js_stdout.empty():


Test patch: