| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -59,7 +59,7 @@ | |||
| 59 | 59 | # if empty, use defaults | |
| 60 | 60 | _valid_extensions = set([]) | |
| 61 | 61 | ||
| 62 | - __VERSION__ = '1.5.3' | ||
| 62 | + __VERSION__ = '1.5.4' | ||
| 63 | 63 | ||
| 64 | 64 | try: | |
| 65 | 65 | xrange # Python 2 | |
@@ -295,7 +295,6 @@ | |||
| 295 | 295 | 'build/include', | |
| 296 | 296 | 'build/include_subdir', | |
| 297 | 297 | 'build/include_alpha', | |
| 298 | - 'build/include_inline', | ||
| 299 | 298 | 'build/include_order', | |
| 300 | 299 | 'build/include_what_you_use', | |
| 301 | 300 | 'build/namespaces_headers', | |
@@ -311,13 +310,11 @@ | |||
| 311 | 310 | 'readability/constructors', | |
| 312 | 311 | 'readability/fn_size', | |
| 313 | 312 | 'readability/inheritance', | |
| 314 | - 'readability/pointer_notation', | ||
| 315 | 313 | 'readability/multiline_comment', | |
| 316 | 314 | 'readability/multiline_string', | |
| 317 | 315 | 'readability/namespace', | |
| 318 | 316 | 'readability/nolint', | |
| 319 | 317 | 'readability/nul', | |
| 320 | - 'readability/null_usage', | ||
| 321 | 318 | 'readability/strings', | |
| 322 | 319 | 'readability/todo', | |
| 323 | 320 | 'readability/utf8', | |
@@ -337,7 +334,6 @@ | |||
| 337 | 334 | 'runtime/string', | |
| 338 | 335 | 'runtime/threadsafe_fn', | |
| 339 | 336 | 'runtime/vlog', | |
| 340 | - 'runtime/v8_persistent', | ||
| 341 | 337 | 'whitespace/blank_line', | |
| 342 | 338 | 'whitespace/braces', | |
| 343 | 339 | 'whitespace/comma', | |
@@ -846,14 +842,6 @@ | |||
| 846 | 842 | 'Missing space after ,': r's/,\([^ ]\)/, \1/g', | |
| 847 | 843 | } | |
| 848 | 844 | ||
| 849 | - _NULL_TOKEN_PATTERN = re.compile(r'\bNULL\b') | ||
| 850 | - | ||
| 851 | - _V8_PERSISTENT_PATTERN = re.compile(r'\bv8::Persistent\b') | ||
| 852 | - | ||
| 853 | - _RIGHT_LEANING_POINTER_PATTERN = re.compile(r'[^=|(,\s><);&?:}]' | ||
| 854 | - r'(?<!(sizeof|return))' | ||
| 855 | - r'\s\*[a-zA-Z_][0-9a-zA-Z_]*') | ||
| 856 | - | ||
| 857 | 845 | _regexp_compile_cache = {} | |
| 858 | 846 | ||
| 859 | 847 | # {str, set(int)}: a map from error categories to sets of linenumbers | |
@@ -1094,11 +1082,10 @@ class _IncludeState(object): | |||
| 1094 | 1082 | # needs to move backwards, CheckNextIncludeOrder will raise an error. | |
| 1095 | 1083 | _INITIAL_SECTION = 0 | |
| 1096 | 1084 | _MY_H_SECTION = 1 | |
| 1097 | - _OTHER_H_SECTION = 2 | ||
| 1098 | - _OTHER_SYS_SECTION = 3 | ||
| 1099 | - _C_SECTION = 4 | ||
| 1100 | - _CPP_SECTION = 5 | ||
| 1101 | - | ||
| 1085 | + _C_SECTION = 2 | ||
| 1086 | + _CPP_SECTION = 3 | ||
| 1087 | + _OTHER_SYS_SECTION = 4 | ||
| 1088 | + _OTHER_H_SECTION = 5 | ||
| 1102 | 1089 | ||
| 1103 | 1090 | _TYPE_NAMES = { | |
| 1104 | 1091 | _C_SYS_HEADER: 'C system header', | |
@@ -1873,7 +1860,7 @@ def FindNextMultiLineCommentEnd(lines, lineix): | |||
| 1873 | 1860 | ||
| 1874 | 1861 | def RemoveMultiLineCommentsFromRange(lines, begin, end): | |
| 1875 | 1862 | """Clears a range of lines for multi-line comments.""" | |
| 1876 | - # Having // dummy comments makes the lines non-empty, so we will not get | ||
| 1863 | + # Having // <empty> comments makes the lines non-empty, so we will not get | ||
| 1877 | 1864 | # unnecessary blank line warnings later in the code. | |
| 1878 | 1865 | for i in range(begin, end): | |
| 1879 | 1866 | lines[i] = '/**/' | |
@@ -2247,7 +2234,7 @@ def CheckForCopyright(filename, lines, error): | |||
| 2247 | 2234 | """Logs an error if no Copyright message appears at the top of the file.""" | |
| 2248 | 2235 | ||
| 2249 | 2236 | # We'll say it should occur by line 10. Don't forget there's a | |
| 2250 | - # dummy line at the front. | ||
| 2237 | + # placeholder line at the front. | ||
| 2251 | 2238 | for line in xrange(1, min(len(lines), 11)): | |
| 2252 | 2239 | if re.search(r'Copyright', lines[line], re.I): break | |
| 2253 | 2240 | else: # means no copyright line was found | |
@@ -2533,21 +2520,6 @@ def CheckForBadCharacters(filename, lines, error): | |||
| 2533 | 2520 | error(filename, linenum, 'readability/nul', 5, 'Line contains NUL byte.') | |
| 2534 | 2521 | ||
| 2535 | 2522 | ||
| 2536 | - def CheckInlineHeader(filename, include_state, error): | ||
| 2537 | - """Logs an error if both a header and its inline variant are included.""" | ||
| 2538 | - | ||
| 2539 | - all_headers = dict(item for sublist in include_state.include_list | ||
| 2540 | - for item in sublist) | ||
| 2541 | - bad_headers = set('%s.h' % name[:-6] for name in all_headers.keys() | ||
| 2542 | - if name.endswith('-inl.h')) | ||
| 2543 | - bad_headers &= set(all_headers.keys()) | ||
| 2544 | - | ||
| 2545 | - for name in bad_headers: | ||
| 2546 | - err = '%s includes both %s and %s-inl.h' % (filename, name, name) | ||
| 2547 | - linenum = all_headers[name] | ||
| 2548 | - error(filename, linenum, 'build/include_inline', 5, err) | ||
| 2549 | - | ||
| 2550 | - | ||
| 2551 | 2523 | def CheckForNewlineAtEOF(filename, lines, error): | |
| 2552 | 2524 | """Logs an error if there is no newline char at the end of the file. | |
| 2553 | 2525 | ||
@@ -3571,7 +3543,7 @@ def CheckForFunctionLengths(filename, clean_lines, linenum, | |||
| 3571 | 3543 | """Reports for long function bodies. | |
| 3572 | 3544 | ||
| 3573 | 3545 | For an overview why this is done, see: | |
| 3574 | - https://google.github.io/styleguide/cppguide.html#Write_Short_Functions | ||
| 3546 | + https://google-styleguide.googlecode.com/svn/trunk/cppguide.xml#Write_Short_Functions | ||
| 3575 | 3547 | ||
| 3576 | 3548 | Uses a simplistic algorithm assuming other style guidelines | |
| 3577 | 3549 | (especially spacing) are followed. | |
@@ -3805,9 +3777,10 @@ def CheckSpacing(filename, clean_lines, linenum, nesting_state, error): | |||
| 3805 | 3777 | # get rid of comments and strings | |
| 3806 | 3778 | line = clean_lines.elided[linenum] | |
| 3807 | 3779 | ||
| 3808 | - # You shouldn't have spaces before your brackets, except maybe after | ||
| 3809 | - # 'delete []', 'return []() {};', or 'auto [abc, ...] = ...;'. | ||
| 3810 | - if Search(r'\w\s+\[', line) and not Search(r'(?:auto&?|delete|return)\s+\[', line): | ||
| 3780 | + # You shouldn't have spaces before your brackets, except for C++11 attributes | ||
| 3781 | + # or maybe after 'delete []', 'return []() {};', or 'auto [abc, ...] = ...;'. | ||
| 3782 | + if (Search(r'\w\s+\[(?!\[)', line) and | ||
| 3783 | + not Search(r'(?:auto&?|delete|return)\s+\[', line)): | ||
| 3811 | 3784 | error(filename, linenum, 'whitespace/braces', 5, | |
| 3812 | 3785 | 'Extra space before [') | |
| 3813 | 3786 | ||
@@ -4797,71 +4770,6 @@ def CheckAltTokens(filename, clean_lines, linenum, error): | |||
| 4797 | 4770 | 'Use operator %s instead of %s' % ( | |
| 4798 | 4771 | _ALT_TOKEN_REPLACEMENT[match.group(1)], match.group(1))) | |
| 4799 | 4772 | ||
| 4800 | - def CheckNullTokens(filename, clean_lines, linenum, error): | ||
| 4801 | - """Check NULL usage. | ||
| 4802 | - | ||
| 4803 | - Args: | ||
| 4804 | - filename: The name of the current file. | ||
| 4805 | - clean_lines: A CleansedLines instance containing the file. | ||
| 4806 | - linenum: The number of the line to check. | ||
| 4807 | - error: The function to call with any errors found. | ||
| 4808 | - """ | ||
| 4809 | - line = clean_lines.elided[linenum] | ||
| 4810 | - | ||
| 4811 | - # Avoid preprocessor lines | ||
| 4812 | - if Match(r'^\s*#', line): | ||
| 4813 | - return | ||
| 4814 | - | ||
| 4815 | - if line.find('/*') >= 0 or line.find('*/') >= 0: | ||
| 4816 | - return | ||
| 4817 | - | ||
| 4818 | - for match in _NULL_TOKEN_PATTERN.finditer(line): | ||
| 4819 | - error(filename, linenum, 'readability/null_usage', 2, | ||
| 4820 | - 'Use nullptr instead of NULL') | ||
| 4821 | - | ||
| 4822 | - def CheckV8PersistentTokens(filename, clean_lines, linenum, error): | ||
| 4823 | - """Check v8::Persistent usage. | ||
| 4824 | - | ||
| 4825 | - Args: | ||
| 4826 | - filename: The name of the current file. | ||
| 4827 | - clean_lines: A CleansedLines instance containing the file. | ||
| 4828 | - linenum: The number of the line to check. | ||
| 4829 | - error: The function to call with any errors found. | ||
| 4830 | - """ | ||
| 4831 | - line = clean_lines.elided[linenum] | ||
| 4832 | - | ||
| 4833 | - # Avoid preprocessor lines | ||
| 4834 | - if Match(r'^\s*#', line): | ||
| 4835 | - return | ||
| 4836 | - | ||
| 4837 | - if line.find('/*') >= 0 or line.find('*/') >= 0: | ||
| 4838 | - return | ||
| 4839 | - | ||
| 4840 | - for match in _V8_PERSISTENT_PATTERN.finditer(line): | ||
| 4841 | - error(filename, linenum, 'runtime/v8_persistent', 2, | ||
| 4842 | - 'Use v8::Global instead of v8::Persistent') | ||
| 4843 | - | ||
| 4844 | - def CheckLeftLeaningPointer(filename, clean_lines, linenum, error): | ||
| 4845 | - """Check for left-leaning pointer placement. | ||
| 4846 | - | ||
| 4847 | - Args: | ||
| 4848 | - filename: The name of the current file. | ||
| 4849 | - clean_lines: A CleansedLines instance containing the file. | ||
| 4850 | - linenum: The number of the line to check. | ||
| 4851 | - error: The function to call with any errors found. | ||
| 4852 | - """ | ||
| 4853 | - line = clean_lines.elided[linenum] | ||
| 4854 | - | ||
| 4855 | - # Avoid preprocessor lines | ||
| 4856 | - if Match(r'^\s*#', line): | ||
| 4857 | - return | ||
| 4858 | - | ||
| 4859 | - if '/*' in line or '*/' in line: | ||
| 4860 | - return | ||
| 4861 | - | ||
| 4862 | - for match in _RIGHT_LEANING_POINTER_PATTERN.finditer(line): | ||
| 4863 | - error(filename, linenum, 'readability/pointer_notation', 2, | ||
| 4864 | - 'Use left leaning pointer instead of right leaning') | ||
| 4865 | 4773 | ||
| 4866 | 4774 | def GetLineWidth(line): | |
| 4867 | 4775 | """Determines the width of the line in column positions. | |
@@ -5016,9 +4924,6 @@ def CheckStyle(filename, clean_lines, linenum, file_extension, nesting_state, | |||
| 5016 | 4924 | CheckSpacingForFunctionCall(filename, clean_lines, linenum, error) | |
| 5017 | 4925 | CheckCheck(filename, clean_lines, linenum, error) | |
| 5018 | 4926 | CheckAltTokens(filename, clean_lines, linenum, error) | |
| 5019 | - CheckNullTokens(filename, clean_lines, linenum, error) | ||
| 5020 | - CheckV8PersistentTokens(filename, clean_lines, linenum, error) | ||
| 5021 | - CheckLeftLeaningPointer(filename, clean_lines, linenum, error) | ||
| 5022 | 4927 | classinfo = nesting_state.InnermostClass() | |
| 5023 | 4928 | if classinfo: | |
| 5024 | 4929 | CheckSectionSpacing(filename, clean_lines, classinfo, linenum, error) | |
@@ -5204,10 +5109,11 @@ def CheckIncludeLine(filename, clean_lines, linenum, include_state, error): | |||
| 5204 | 5109 | include_state.include_list[-1].append((include, linenum)) | |
| 5205 | 5110 | ||
| 5206 | 5111 | # We want to ensure that headers appear in the right order: | |
| 5207 | - # 1) for foo.cc, foo.h | ||
| 5208 | - # 2) other project headers | ||
| 5209 | - # 3) c system files | ||
| 5210 | - # 4) cpp system files | ||
| 5112 | + # 1) for foo.cc, foo.h (preferred location) | ||
| 5113 | + # 2) c system files | ||
| 5114 | + # 3) cpp system files | ||
| 5115 | + # 4) for foo.cc, foo.h (deprecated location) | ||
| 5116 | + # 5) other google headers | ||
| 5211 | 5117 | # | |
| 5212 | 5118 | # We classify each include statement as one of those 5 types | |
| 5213 | 5119 | # using a number of techniques. The include_state object keeps | |
@@ -5470,7 +5376,7 @@ def CheckLanguage(filename, clean_lines, linenum, file_extension, | |||
| 5470 | 5376 | and line[-1] != '\\'): | |
| 5471 | 5377 | error(filename, linenum, 'build/namespaces_headers', 4, | |
| 5472 | 5378 | 'Do not use unnamed namespaces in header files. See ' | |
| 5473 | - 'https://google.github.io/styleguide/cppguide.html#Namespaces' | ||
| 5379 | + 'https://google-styleguide.googlecode.com/svn/trunk/cppguide.xml#Namespaces' | ||
| 5474 | 5380 | ' for more information.') | |
| 5475 | 5381 | ||
| 5476 | 5382 | ||
@@ -6592,8 +6498,6 @@ def ProcessFileData(filename, file_extension, lines, error, | |||
| 6592 | 6498 | ||
| 6593 | 6499 | CheckForNewlineAtEOF(filename, lines, error) | |
| 6594 | 6500 | ||
| 6595 | - CheckInlineHeader(filename, include_state, error) | ||
| 6596 | - | ||
| 6597 | 6501 | def ProcessConfigOverrides(filename): | |
| 6598 | 6502 | """ Loads the configuration files and processes the config overrides. | |
| 6599 | 6503 | ||
@@ -6612,7 +6516,7 @@ def ProcessConfigOverrides(filename): | |||
| 6612 | 6516 | if not base_name: | |
| 6613 | 6517 | break # Reached the root directory. | |
| 6614 | 6518 | ||
| 6615 | - cfg_file = os.path.join(abs_path, ".cpplint") | ||
| 6519 | + cfg_file = os.path.join(abs_path, "CPPLINT.cfg") | ||
| 6616 | 6520 | abs_filename = abs_path | |
| 6617 | 6521 | if not os.path.isfile(cfg_file): | |
| 6618 | 6522 | continue | |
| Back | FazBrowse Home | New Git URL |
0 commit comments