Repository: oppia/oppia

Issue:
Add explanation to resolve the CODEOWNER file check
**Describe the bug**
The error log doesn't explain how to resolve the CODEOWNER bug while pushing a commit to origin.

**To Reproduce**
Steps to reproduce the behavior:
 1. Try renaming the files of the project (in order to conform to the new naming convention)
 2. Commit your changes and try to push to origin
 3. See error

**Observed behavior**
I only observed a failed message `FAILED   CODEOWNERS file check failed` and no explanation as to how it can be resolved.

**Expected behavior**
An explanation to resolve the issue. 

**Screenshots**
[Imgur Link](https://imgur.com/d2cgmh8)

**Desktop (please complete the following information; delete this section if the issue does not arise on desktop):**
 - OS: macOS 10.5.1
 - Browser: Chrome
 - Version: 78.0.3904.87

**Additional context**
This occurred when I was trying to fix #6975 

Add explanation to resolve the CODEOWNER file check
**Describe the bug**
The error log doesn't explain how to resolve the CODEOWNER bug while pushing a commit to origin.

**To Reproduce**
Steps to reproduce the behavior:
 1. Try renaming the files of the project (in order to conform to the new naming convention)
 2. Commit your changes and try to push to origin
 3. See error

**Observed behavior**
I only observed a failed message `FAILED   CODEOWNERS file check failed` and no explanation as to how it can be resolved.

**Expected behavior**
An explanation to resolve the issue. 

**Screenshots**
[Imgur Link](https://imgur.com/d2cgmh8)

**Desktop (please complete the following information; delete this section if the issue does not arise on desktop):**
 - OS: macOS 10.5.1
 - Browser: Chrome
 - Version: 78.0.3904.87

**Additional context**
This occurred when I was trying to fix #6975 



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
@@ -1394,7 +1394,8 @@ def _check_codeowner_file(verbose_mode_enabled):
                         break
                 if not match:
                     python_utils.PRINT(
-                        '%s is not covered under CODEOWNERS' % file_path)
+                        '%s is not listed in the .github/CODEOWNERS file.' % (
+                            file_path))
                     failed = True
 
         failed = failed or (
@@ -1402,10 +1403,12 @@ def _check_codeowner_file(verbose_mode_enabled):
                 important_rules_in_critical_section))
 
         if failed:
-            summary_message = '%s   CODEOWNERS file check failed' % (
-                _MESSAGE_TYPE_FAILED)
+            summary_message = (
+                '%s   CODEOWNERS file coverage check failed, see messages '
+                'above for files that need to be added or patterns that need '
+                'to be fixed.' % _MESSAGE_TYPE_FAILED)
         else:
-            summary_message = '%s  CODEOWNERS file check passed' % (
+            summary_message = '%s  CODEOWNERS file coverage check passed' % (
                 _MESSAGE_TYPE_SUCCESS)
 
         summary_messages.append(summary_message)
@@ -1766,7 +1769,8 @@ def _check_codeowner_file(verbose_mode_enabled):
                         break
                 if not match:
                     python_utils.PRINT(
-                        '%s is not covered under CODEOWNERS' % file_path)
+                        '%s is not listed in the .github/CODEOWNERS file.' % (
+                            file_path))
                     failed = True
 
         failed = failed or (
@@ -1774,8 +1778,10 @@ def _check_codeowner_file(verbose_mode_enabled):
                 important_rules_in_critical_section))
 
         if failed:
-            summary_message = '%s   CODEOWNERS file check failed' % (
-                _MESSAGE_TYPE_FAILED)
+            summary_message = (
+                '%s   CODEOWNERS file coverage check failed, see messages '
+                'above for files that need to be added or patterns that need '
+                'to be fixed.' % _MESSAGE_TYPE_FAILED)
         else:
             summary_message = '%s  CODEOWNERS file check passed' % (
                 _MESSAGE_TYPE_SUCCESS)
@@ -1895,8 +1901,8 @@ def _check_mandatory_patterns(self):
 
             if failed:
                 summary_message = (
-                    '%s  Mandatory pattern check failed' % (
-                        _MESSAGE_TYPE_FAILED))
+                    '%s  Mandatory pattern check failed, see errors above for'
+                    'patterns that should be added.' % _MESSAGE_TYPE_FAILED)
             else:
                 summary_message = (
                     '%s  Mandatory pattern check passed' % (
@@ -1961,8 +1967,10 @@ def _check_bad_patterns(self):
                             python_utils.PRINT('')
                             total_error_count += 1
             if failed:
-                summary_message = '%s Pattern checks failed' % (
-                    _MESSAGE_TYPE_FAILED)
+                summary_message = (
+                    '%s Pattern check failed, see errors above '
+                    'for patterns that should be removed.' % (
+                        _MESSAGE_TYPE_FAILED))
                 summary_messages.append(summary_message)
             else:
                 summary_message = '%s Pattern checks passed' % (
@@ -2167,8 +2175,10 @@ def _check_extra_js_files(self):
                 python_utils.PRINT(err_msg)
 
             if failed:
-                summary_message = '%s  Extra JS files check failed' % (
-                    _MESSAGE_TYPE_FAILED)
+                summary_message = (
+                    '%s  Extra JS files check failed, see '
+                    'message above on resolution steps.' % (
+                        _MESSAGE_TYPE_FAILED))
             else:
                 summary_message = '%s  Extra JS files check passed' % (
                     _MESSAGE_TYPE_SUCCESS)
@@ -2219,8 +2229,9 @@ def _check_js_and_ts_component_name_and_count(self):
         with _redirect_stdout(stdout):
             if failed:
                 summary_message = (
-                    '%s  JS and TS Component name and count check failed' %
-                    (_MESSAGE_TYPE_FAILED))
+                    '%s  JS and TS Component name and count check failed, '
+                    'see messages above for duplicate names.' % (
+                        _MESSAGE_TYPE_FAILED))
                 python_utils.PRINT(summary_message)
                 summary_messages.append(summary_message)
             else:
@@ -2353,8 +2364,10 @@ def _check_directive_scope(self):
 
         with _redirect_stdout(stdout):
             if failed:
-                summary_message = '%s   Directive scope check failed' % (
-                    _MESSAGE_TYPE_FAILED)
+                summary_message = (
+                    '%s   Directive scope check failed, '
+                    'see messages above for suggested fixes.' % (
+                        _MESSAGE_TYPE_FAILED))
                 python_utils.PRINT(summary_message)
                 summary_messages.append(summary_message)
             else:
@@ -2447,7 +2460,8 @@ def _check_sorted_dependencies(self):
         with _redirect_stdout(stdout):
             if failed:
                 summary_message = (
-                    '%s  Sorted dependencies check failed' % (
+                    '%s  Sorted dependencies check failed, fix files that '
+                    'that don\'t have sorted dependencies mentioned above.' % (
                         _MESSAGE_TYPE_FAILED))
             else:
                 summary_message = (
@@ -2510,7 +2524,8 @@ def _match_line_breaks_in_controller_dependencies(self):
 
             if failed:
                 summary_message = (
-                    '%s   Controller dependency line break check failed' % (
+                    '%s   Controller dependency line break check failed, '
+                    'see messages above for the affected files.' % (
                         _MESSAGE_TYPE_FAILED))
                 python_utils.PRINT(summary_message)
                 summary_messages.append(summary_message)
@@ -2690,8 +2705,10 @@ def _check_constants_declaration(self):
                                 'constants file.' % (filepath, constant))
 
             if failed:
-                summary_message = '%s  Constants declaration check failed' % (
-                    _MESSAGE_TYPE_FAILED)
+                summary_message = (
+                    '%s  Constants declaration check failed, '
+                    'see messages above for constants with errors.' % (
+                        _MESSAGE_TYPE_FAILED))
             else:
                 summary_message = '%s  Constants declaration check passed' % (
                     _MESSAGE_TYPE_SUCCESS)
@@ -2782,8 +2799,10 @@ def _check_html_directive_name(self):
                         python_utils.PRINT('')
 
             if failed:
-                summary_message = '%s   HTML directive name check failed' % (
-                    _MESSAGE_TYPE_FAILED)
+                summary_message = (
+                    '%s   HTML directive name check failed, see files above '
+                    'that did not end with _directive.html but '
+                    'should have.' % _MESSAGE_TYPE_FAILED)
                 summary_messages.append(summary_message)
             else:
                 summary_message = '%s   HTML directive name check passed' % (
@@ -2878,7 +2897,9 @@ def _check_division_operator(self):
             python_utils.PRINT('')
             if failed:
                 summary_message = (
-                    '%s Division operator check failed' % _MESSAGE_TYPE_FAILED)
+                    '%s Division operator check failed, "/" should not be '
+                    'used, remove the operator from files listed above.' % (
+                        _MESSAGE_TYPE_FAILED))
                 python_utils.PRINT(summary_message)
                 summary_messages.append(summary_message)
             else:
@@ -2921,7 +2942,9 @@ def _check_import_order(self):
             python_utils.PRINT('')
             if failed:
                 summary_message = (
-                    '%s   Import order checks failed' % _MESSAGE_TYPE_FAILED)
+                    '%s   Import order checks failed, file imports should be '
+                    'alphabetized, see affect files above.' % (
+                        _MESSAGE_TYPE_FAILED))
                 python_utils.PRINT(summary_message)
                 summary_messages.append(summary_message)
             else:
@@ -3089,7 +3112,8 @@ def _check_docstrings(self):
             python_utils.PRINT('')
             if failed:
                 summary_message = (
-                    '%s   Docstring check failed' % _MESSAGE_TYPE_FAILED)
+                    '%s   Docstring check failed, see files above with bad'
+                    'docstrings to be fixed.' % _MESSAGE_TYPE_FAILED)
                 python_utils.PRINT(summary_message)
                 summary_messages.append(summary_message)
             else:
@@ -3168,7 +3192,8 @@ def _check_comments(self):
             python_utils.PRINT('')
             if failed:
                 summary_message = (
-                    '%s   Comments check failed' % _MESSAGE_TYPE_FAILED)
+                    '%s   Comments check failed, fix files that have bad '
+                    'comment formating.' % _MESSAGE_TYPE_FAILED)
                 python_utils.PRINT(summary_message)
                 summary_messages.append(summary_message)
             else:
@@ -3206,8 +3231,9 @@ def _check_html_tags_and_attributes(self, debug=False):
                     failed = True
 
             if failed:
-                summary_message = '%s   HTML tag and attribute check failed' % (
-                    _MESSAGE_TYPE_FAILED)
+                summary_message = (
+                    '%s   HTML tag and attribute check failed, fix the HTML '
+                    'files listed above.' % _MESSAGE_TYPE_FAILED)
                 python_utils.PRINT(summary_message)
                 summary_messages.append(summary_message)
             else:
@@ -3269,8 +3295,9 @@ def _lint_html_files(self):
             if total_error_count:
                 python_utils.PRINT('(%s files checked, %s errors found)' % (
                     total_files_checked, total_error_count))
-                summary_message = '%s   HTML linting failed' % (
-                    _MESSAGE_TYPE_FAILED)
+                summary_message = (
+                    '%s   HTML linting failed, '
+                    'fix the HTML files listed above.' % _MESSAGE_TYPE_FAILED)
                 summary_messages.append(summary_message)
             else:
                 summary_message = '%s   HTML linting passed' % (


Test patch: