[clang] 13c83c0 - [analyzer][NFC] Simplify Analysis/csv2json.py (#161665)
via cfe-commits
cfe-commits at lists.llvm.org
Fri Oct 3 06:14:10 PDT 2025
Author: Balazs Benics
Date: 2025-10-03T15:14:06+02:00
New Revision: 13c83c0a785179d51d673e86dddc86801c16c079
URL: https://github.com/llvm/llvm-project/commit/13c83c0a785179d51d673e86dddc86801c16c079
DIFF: https://github.com/llvm/llvm-project/commit/13c83c0a785179d51d673e86dddc86801c16c079.diff
LOG: [analyzer][NFC] Simplify Analysis/csv2json.py (#161665)
Added:
Modified:
clang/test/Analysis/csv2json.py
Removed:
################################################################################
diff --git a/clang/test/Analysis/csv2json.py b/clang/test/Analysis/csv2json.py
index 3c20d689243e7..6e1aca9a51779 100644
--- a/clang/test/Analysis/csv2json.py
+++ b/clang/test/Analysis/csv2json.py
@@ -44,7 +44,7 @@ def csv_to_json_dict(csv_filepath):
"""
try:
with open(csv_filepath, "r", encoding="utf-8") as csvfile:
- reader = csv.reader(csvfile)
+ reader = csv.reader(csvfile, skipinitialspace=True)
# Read the header row (column names)
try:
@@ -58,12 +58,13 @@ def csv_to_json_dict(csv_filepath):
json.dumps({}, indent=2)
return
- other_column_names = [name.strip() for name in header[1:]]
+ header_length = len(header)
+ other_column_names = header[1:]
data_dict = {}
for row in reader:
- if len(row) != len(header):
+ if len(row) != header_length:
raise csv.Error("Inconsistent CSV file")
exit(1)
More information about the cfe-commits
mailing list