Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(295)

Side by Side Diff: third_party/WebKit/Tools/Scripts/webkitpy/style/checkers/cpp.py

Issue 2386353002: Teach check-webkit-py in one more place that indent is now 2 spaces (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # -*- coding: utf-8 -*- 1 # -*- coding: utf-8 -*-
2 # 2 #
3 # Copyright (C) 2009, 2010, 2012 Google Inc. All rights reserved. 3 # Copyright (C) 2009, 2010, 2012 Google Inc. All rights reserved.
4 # Copyright (C) 2009 Torch Mobile Inc. 4 # Copyright (C) 2009 Torch Mobile Inc.
5 # Copyright (C) 2009 Apple Inc. All rights reserved. 5 # Copyright (C) 2009 Apple Inc. All rights reserved.
6 # Copyright (C) 2010 Chris Jerdonek (cjerdonek@webkit.org) 6 # Copyright (C) 2010 Chris Jerdonek (cjerdonek@webkit.org)
7 # 7 #
8 # Redistribution and use in source and binary forms, with or without 8 # Redistribution and use in source and binary forms, with or without
9 # modification, are permitted provided that the following conditions are 9 # modification, are permitted provided that the following conditions are
10 # met: 10 # met:
(...skipping 1947 matching lines...) Expand 10 before | Expand all | Expand 10 after
1958 error: The function to call with any errors found. 1958 error: The function to call with any errors found.
1959 """ 1959 """
1960 1960
1961 line = clean_lines.elided[line_number] # Get rid of comments and strings. 1961 line = clean_lines.elided[line_number] # Get rid of comments and strings.
1962 1962
1963 else_match = match(r'(?P<else_indentation>\s*)(\}\s*)?else(\s+if\s*\(|(?P<el se>\s*(\{\s*)?\Z))', line) 1963 else_match = match(r'(?P<else_indentation>\s*)(\}\s*)?else(\s+if\s*\(|(?P<el se>\s*(\{\s*)?\Z))', line)
1964 if not else_match: 1964 if not else_match:
1965 return 1965 return
1966 1966
1967 else_indentation = else_match.group('else_indentation') 1967 else_indentation = else_match.group('else_indentation')
1968 inner_indentation = else_indentation + ' ' * 4 1968 inner_indentation = else_indentation + ' ' * 2
1969 1969
1970 previous_lines = clean_lines.elided[:line_number] 1970 previous_lines = clean_lines.elided[:line_number]
1971 previous_lines.reverse() 1971 previous_lines.reverse()
1972 line_offset = 0 1972 line_offset = 0
1973 encountered_exit_statement = False 1973 encountered_exit_statement = False
1974 1974
1975 for current_line in previous_lines: 1975 for current_line in previous_lines:
1976 line_offset -= 1 1976 line_offset -= 1
1977 1977
1978 # Skip not only empty lines but also those with preprocessor directives 1978 # Skip not only empty lines but also those with preprocessor directives
(...skipping 1660 matching lines...) Expand 10 before | Expand all | Expand 10 after
3639 3639
3640 def check(self, lines): 3640 def check(self, lines):
3641 _process_lines(self.file_path, self.file_extension, lines, 3641 _process_lines(self.file_path, self.file_extension, lines,
3642 self.handle_style_error, self.min_confidence) 3642 self.handle_style_error, self.min_confidence)
3643 3643
3644 3644
3645 # FIXME: Remove this function (requires refactoring unit tests). 3645 # FIXME: Remove this function (requires refactoring unit tests).
3646 def process_file_data(filename, file_extension, lines, error, min_confidence, fs =None): 3646 def process_file_data(filename, file_extension, lines, error, min_confidence, fs =None):
3647 checker = CppChecker(filename, file_extension, error, min_confidence, fs) 3647 checker = CppChecker(filename, file_extension, error, min_confidence, fs)
3648 checker.check(lines) 3648 checker.check(lines)
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698