• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/usr/bin/env python2.7
2
3# Copyright 2015 gRPC authors.
4#
5# Licensed under the Apache License, Version 2.0 (the "License");
6# you may not use this file except in compliance with the License.
7# You may obtain a copy of the License at
8#
9#     http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS,
13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
16
17# check for directory level 'README.md' files
18# check that all implementation and interface files have a \file doxygen comment
19
20import os
21import sys
22
23# where do we run
24_TARGET_DIRS = [
25    'include/grpc', 'include/grpc++', 'src/core', 'src/cpp', 'test/core',
26    'test/cpp'
27]
28
29# which file extensions do we care about
30_INTERESTING_EXTENSIONS = ['.c', '.h', '.cc']
31
32# find our home
33_ROOT = os.path.abspath(os.path.join(os.path.dirname(sys.argv[0]), '../../..'))
34os.chdir(_ROOT)
35
36errors = 0
37
38# walk directories, find things
39printed_banner = False
40for target_dir in _TARGET_DIRS:
41    for root, dirs, filenames in os.walk(target_dir):
42        if 'README.md' not in filenames:
43            if not printed_banner:
44                print 'Missing README.md'
45                print '================='
46                printed_banner = True
47            print root
48            errors += 1
49if printed_banner: print
50printed_banner = False
51for target_dir in _TARGET_DIRS:
52    for root, dirs, filenames in os.walk(target_dir):
53        for filename in filenames:
54            if os.path.splitext(filename)[1] not in _INTERESTING_EXTENSIONS:
55                continue
56            path = os.path.join(root, filename)
57            with open(path) as f:
58                contents = f.read()
59            if '\\file' not in contents:
60                if not printed_banner:
61                    print 'Missing \\file comment'
62                    print '======================'
63                    printed_banner = True
64                print path
65                errors += 1
66
67assert errors == 0, 'error count = %d' % errors
68