OLD | NEW |
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 """Generic presubmit checks that can be reused by other presubmit checks.""" | 5 """Generic presubmit checks that can be reused by other presubmit checks.""" |
6 | 6 |
7 import os as _os | 7 import os as _os |
8 _HERE = _os.path.dirname(_os.path.abspath(__file__)) | 8 _HERE = _os.path.dirname(_os.path.abspath(__file__)) |
9 | 9 |
10 | 10 |
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
311 long_text='\n'.join(errors))] | 311 long_text='\n'.join(errors))] |
312 return [] | 312 return [] |
313 | 313 |
314 | 314 |
315 def CheckLongLines(input_api, output_api, maxlen=80, source_file_filter=None): | 315 def CheckLongLines(input_api, output_api, maxlen=80, source_file_filter=None): |
316 """Checks that there aren't any lines longer than maxlen characters in any of | 316 """Checks that there aren't any lines longer than maxlen characters in any of |
317 the text files to be submitted. | 317 the text files to be submitted. |
318 """ | 318 """ |
319 maxlens = { | 319 maxlens = { |
320 'java': 100, | 320 'java': 100, |
| 321 # This is specifically for Android's handwritten makefiles (Android.mk). |
| 322 'mk': 200, |
321 '': maxlen, | 323 '': maxlen, |
322 } | 324 } |
323 # Note: these are C++ specific but processed on all languages. :( | 325 # Note: these are C++ specific but processed on all languages. :( |
324 MACROS = ('#define', '#include', '#import', '#pragma', '#if', '#endif') | 326 MACROS = ('#define', '#include', '#import', '#pragma', '#if', '#endif') |
325 | 327 |
326 # Special java statements. | 328 # Special java statements. |
327 SPECIAL_JAVA_STARTS = ('package ', 'import ') | 329 SPECIAL_JAVA_STARTS = ('package ', 'import ') |
328 | 330 |
329 def no_long_lines(file_extension, line): | 331 def no_long_lines(file_extension, line): |
330 # Allow special java statements to be as long as neccessary. | 332 # Allow special java statements to be as long as neccessary. |
(...skipping 674 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1005 snapshot("checking description") | 1007 snapshot("checking description") |
1006 results.extend(input_api.canned_checks.CheckChangeHasDescription( | 1008 results.extend(input_api.canned_checks.CheckChangeHasDescription( |
1007 input_api, output_api)) | 1009 input_api, output_api)) |
1008 results.extend(input_api.canned_checks.CheckDoNotSubmitInDescription( | 1010 results.extend(input_api.canned_checks.CheckDoNotSubmitInDescription( |
1009 input_api, output_api)) | 1011 input_api, output_api)) |
1010 snapshot("checking do not submit in files") | 1012 snapshot("checking do not submit in files") |
1011 results.extend(input_api.canned_checks.CheckDoNotSubmitInFiles( | 1013 results.extend(input_api.canned_checks.CheckDoNotSubmitInFiles( |
1012 input_api, output_api)) | 1014 input_api, output_api)) |
1013 snapshot("done") | 1015 snapshot("done") |
1014 return results | 1016 return results |
OLD | NEW |