MCPcopy Create free account
hub / github.com/coreboot/coreboot / parse_file

Function parse_file

util/lint/checkpatch_json.py:30–49  ·  view source on GitHub ↗
(input_file)

Source from the content-addressed store, hash-verified

28 })
29
30def parse_file(input_file):
31 fp = open (input_file, "r")
32 for line in fp:
33 if line.startswith("ERROR:"):
34 msg_output = line.split("ERROR:")[1].strip()
35 elif line.startswith("WARNING:"):
36 msg_output = line.split("WARNING:")[1].strip()
37 elif ": FILE:" in line:
38 temp = line.split("FILE:")
39 file_path = temp[1].split(":")[0]
40 line_number = temp[1].split(":")[1]
41 update_struct( file_path.strip(), msg_output, str(line_number) )
42 elif re.search(r"^\d+:\Z",line) != "None" and line.startswith("#"):
43 file_path="/COMMIT_MSG"
44 line = line.replace('#', '')
45 line_number = int(line.split(":")[0]) + 2
46 update_struct( file_path.strip(), msg_output, str(line_number) )
47 else:
48 continue
49 fp.close()
50
51def main():
52 if (len(sys.argv) < 5) or (sys.argv[1] == "-h"):

Callers 1

mainFunction · 0.85

Calls 2

update_structFunction · 0.85
searchMethod · 0.45

Tested by

no test coverage detected