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

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

Issue 2329463004: ABANDONED CL: Changes needed to make things compile after running rewrite_to_chrome_style tool. (Closed)
Patch Set: Rebasing the fixes... Created 3 years, 10 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
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 2912 matching lines...) Expand 10 before | Expand all | Expand 10 after
2923 character_after_identifier = matched.group('character_after_identifier') 2923 character_after_identifier = matched.group('character_after_identifier')
2924 2924
2925 # If we removed a non-for-control statement, the character after 2925 # If we removed a non-for-control statement, the character after
2926 # the identifier should be '='. With this rule, we can avoid 2926 # the identifier should be '='. With this rule, we can avoid
2927 # warning for cases like "if (val & INT_MAX) {". 2927 # warning for cases like "if (val & INT_MAX) {".
2928 if control_statement and character_after_identifier != '=': 2928 if control_statement and character_after_identifier != '=':
2929 return 2929 return
2930 2930
2931 is_function_arguments = is_function_arguments or character_after_identif ier == '(' 2931 is_function_arguments = is_function_arguments or character_after_identif ier == '('
2932 2932
2933 # Remove "m_" and "s_" to allow them.
2934 modified_identifier = sub(r'(^|(?<=::))[ms]_', '', identifier)
2935 if not file_state.is_objective_c() and modified_identifier.find('_') >= 0:
2936 # Various exceptions to the rule: JavaScript op codes functions, con st_iterator.
2937 if (not (filename.find('JavaScriptCore') >= 0 and modified_identifie r.find('op_') >= 0)
2938 and not (filename.find('gtk') >= 0 and modified_identifier.s tartswith('webkit_') >= 0)
2939 and not (filename.find('StructTraits.h') >= 0)
2940 and not modified_identifier.startswith('tst_')
2941 and not modified_identifier.startswith('webkit_dom_object_')
2942 and not modified_identifier.startswith('webkit_soup')
2943 and not modified_identifier.startswith('NPN_')
2944 and not modified_identifier.startswith('NPP_')
2945 and not modified_identifier.startswith('NP_')
2946 and not modified_identifier.startswith('qt_')
2947 and not modified_identifier.startswith('_q_')
2948 and not modified_identifier.startswith('cairo_')
2949 and not modified_identifier.startswith('Ecore_')
2950 and not modified_identifier.startswith('Eina_')
2951 and not modified_identifier.startswith('Evas_')
2952 and not modified_identifier.startswith('Ewk_')
2953 and not modified_identifier.startswith('cti_')
2954 and not modified_identifier.find('::qt_') >= 0
2955 and not modified_identifier.find('::_q_') >= 0
2956 and not modified_identifier == "const_iterator"
2957 and not modified_identifier == "vm_throw"
2958 and not modified_identifier == "DFG_OPERATION"):
2959 error(line_number, 'readability/naming/underscores', 4, identifi er +
2960 " is incorrectly named. Don't use underscores in your iden tifier names.")
2961
2962 # Check for variables named 'l', these are too easy to confuse with '1' in some fonts 2933 # Check for variables named 'l', these are too easy to confuse with '1' in some fonts
2963 if modified_identifier == 'l': 2934 if identifier == 'l':
2964 error(line_number, 'readability/naming', 4, identifier + 2935 error(line_number, 'readability/naming', 4, identifier +
2965 " is incorrectly named. Don't use the single letter 'l' as an identifier name.") 2936 " is incorrectly named. Don't use the single letter 'l' as an identifier name.")
2966 2937
2967 # There can be only one declaration in non-for-control statements. 2938 # There can be only one declaration in non-for-control statements.
2968 if control_statement: 2939 if control_statement:
2969 return 2940 return
2970 # We should continue checking if this is a function 2941 # We should continue checking if this is a function
2971 # declaration because we need to check its arguments. 2942 # declaration because we need to check its arguments.
2972 # Also, we need to check multiple declarations. 2943 # Also, we need to check multiple declarations.
2973 if character_after_identifier != '(' and character_after_identifier != ' ,': 2944 if character_after_identifier != '(' and character_after_identifier != ' ,':
(...skipping 623 matching lines...) Expand 10 before | Expand all | Expand 10 after
3597 3568
3598 def check(self, lines): 3569 def check(self, lines):
3599 _process_lines(self.file_path, self.file_extension, lines, 3570 _process_lines(self.file_path, self.file_extension, lines,
3600 self.handle_style_error, self.min_confidence) 3571 self.handle_style_error, self.min_confidence)
3601 3572
3602 3573
3603 # FIXME: Remove this function (requires refactoring unit tests). 3574 # FIXME: Remove this function (requires refactoring unit tests).
3604 def process_file_data(filename, file_extension, lines, error, min_confidence, fs =None): 3575 def process_file_data(filename, file_extension, lines, error, min_confidence, fs =None):
3605 checker = CppChecker(filename, file_extension, error, min_confidence, fs) 3576 checker = CppChecker(filename, file_extension, error, min_confidence, fs)
3606 checker.check(lines) 3577 checker.check(lines)
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/WebSettingsImpl.cpp ('k') | third_party/WebKit/public/platform/WebData.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698