MCPcopy Create free account
hub / github.com/ARM-software/ComputeLibrary / check_file

Function check_file

scripts/add_copyright.py:83–103  ·  view source on GitHub ↗
( path )

Source from the content-addressed store, hash-verified

81 return out
82
83def check_file( path ):
84 root, f = os.path.split(path)
85 if f in ['.clang-tidy', '.clang-format']:
86 print("Skipping file: {}".format(path))
87 return
88
89 with open(path, 'r', encoding='utf-8') as fd:
90 content = fd.read()
91 _, extension = os.path.splitext(f)
92
93 if extension in ['.cpp', '.h', '.hpp', '.inl', '.cl', '.in', '.cs']:
94 if not content.startswith('/*'):
95 add_cpp_copyright(path, content)
96 elif extension == '.py' or f in ['SConstruct', 'SConscript']:
97 if not content.startswith('# Copyright'):
98 add_python_copyright(path, content)
99 elif f == 'CMakeLists.txt':
100 if not content.startswith('# Copyright'):
101 add_python_copyright(path, content)
102 else:
103 raise Exception("Unhandled file: {}".format(path))
104
105if len(sys.argv) > 1:
106 for path in sys.argv[1:]:

Callers 1

add_copyright.pyFile · 0.85

Calls 4

add_cpp_copyrightFunction · 0.85
add_python_copyrightFunction · 0.85
readMethod · 0.80
formatMethod · 0.45

Tested by

no test coverage detected