OLD | NEW |
1 #!/usr/bin/python2.4 | 1 #!/usr/bin/python2.4 |
2 # | 2 # |
3 # Copyright (c) 2009 Google Inc. All rights reserved. | 3 # Copyright (c) 2009 Google Inc. All rights reserved. |
4 # | 4 # |
5 # Redistribution and use in source and binary forms, with or without | 5 # Redistribution and use in source and binary forms, with or without |
6 # modification, are permitted provided that the following conditions are | 6 # modification, are permitted provided that the following conditions are |
7 # met: | 7 # met: |
8 # | 8 # |
9 # * Redistributions of source code must retain the above copyright | 9 # * Redistributions of source code must retain the above copyright |
10 # notice, this list of conditions and the following disclaimer. | 10 # notice, this list of conditions and the following disclaimer. |
(...skipping 3036 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3047 | 3047 |
3048 # The policy is that if you #include something in foo.h you don't need to | 3048 # The policy is that if you #include something in foo.h you don't need to |
3049 # include it again in foo.cc. Here, we will look at possible includes. | 3049 # include it again in foo.cc. Here, we will look at possible includes. |
3050 # Let's copy the include_state so it is only messed up within this function. | 3050 # Let's copy the include_state so it is only messed up within this function. |
3051 include_state = include_state.copy() | 3051 include_state = include_state.copy() |
3052 | 3052 |
3053 # Did we find the header for this file (if any) and succesfully load it? | 3053 # Did we find the header for this file (if any) and succesfully load it? |
3054 header_found = False | 3054 header_found = False |
3055 | 3055 |
3056 # Use the absolute path so that matching works properly. | 3056 # Use the absolute path so that matching works properly. |
3057 abs_filename = os.path.abspath(filename) | 3057 abs_filename = FileInfo(filename).FullName() |
3058 | 3058 |
3059 # For Emacs's flymake. | 3059 # For Emacs's flymake. |
3060 # If cpplint is invoked from Emacs's flymake, a temporary file is generated | 3060 # If cpplint is invoked from Emacs's flymake, a temporary file is generated |
3061 # by flymake and that file name might end with '_flymake.cc'. In that case, | 3061 # by flymake and that file name might end with '_flymake.cc'. In that case, |
3062 # restore original file name here so that the corresponding header file can be | 3062 # restore original file name here so that the corresponding header file can be |
3063 # found. | 3063 # found. |
3064 # e.g. If the file name is 'foo_flymake.cc', we should search for 'foo.h' | 3064 # e.g. If the file name is 'foo_flymake.cc', we should search for 'foo.h' |
3065 # instead of 'foo_flymake.h' | 3065 # instead of 'foo_flymake.h' |
3066 abs_filename = re.sub(r'_flymake\.cc$', '.cc', abs_filename) | 3066 abs_filename = re.sub(r'_flymake\.cc$', '.cc', abs_filename) |
3067 | 3067 |
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3352 _cpplint_state.ResetErrorCounts() | 3352 _cpplint_state.ResetErrorCounts() |
3353 for filename in filenames: | 3353 for filename in filenames: |
3354 ProcessFile(filename, _cpplint_state.verbose_level) | 3354 ProcessFile(filename, _cpplint_state.verbose_level) |
3355 _cpplint_state.PrintErrorCounts() | 3355 _cpplint_state.PrintErrorCounts() |
3356 | 3356 |
3357 sys.exit(_cpplint_state.error_count > 0) | 3357 sys.exit(_cpplint_state.error_count > 0) |
3358 | 3358 |
3359 | 3359 |
3360 if __name__ == '__main__': | 3360 if __name__ == '__main__': |
3361 main() | 3361 main() |
OLD | NEW |