osmith has submitted this change. ( 
https://gerrit.osmocom.org/c/osmo-ci/+/43444?usp=email )

Change subject: lint/checkpatch/checkpatch_json: format with ruff
......................................................................

lint/checkpatch/checkpatch_json: format with ruff

Change-Id: Ie67fce9de101fd58db0af4e5fe54922a54ce2c9b
---
M .ruff.toml
M lint/checkpatch/checkpatch_json.py
2 files changed, 16 insertions(+), 12 deletions(-)

Approvals:
  fixeria: Looks good to me, but someone else must approve
  Jenkins Builder: Verified
  pespin: Looks good to me, approved




diff --git a/.ruff.toml b/.ruff.toml
index 1cfd21b..14e05db 100644
--- a/.ruff.toml
+++ b/.ruff.toml
@@ -2,7 +2,6 @@

 [format]
 exclude = [
-       "lint/checkpatch/checkpatch_json.py",
        "scripts/jenkins-gerrit/comment_generate.py",
        "scripts/obs/build_binpkg.py",
        "scripts/obs/build_srcpkg.py",
diff --git a/lint/checkpatch/checkpatch_json.py 
b/lint/checkpatch/checkpatch_json.py
index e0c4dcd..c4ea3b0 100755
--- a/lint/checkpatch/checkpatch_json.py
+++ b/lint/checkpatch/checkpatch_json.py
@@ -7,28 +7,31 @@
 INPUT: output of checkpatch.pl.
 OUTPUT: json format output that can be used to post comment in gerrit
 """
+
 import sys
 import json

 data = {}
-data['comments'] = []
+data["comments"] = []
 list_temp = {}

-def update_struct( file_path, msg_output, line_number):
+
+def update_struct(file_path, msg_output, line_number):
     if file_path not in list_temp:
         list_temp[file_path] = []
     error = {
-        "robot_id" : "checkpatch",
-        "robot_run_id" : sys.argv[3],
-        "url" : sys.argv[4],
-        "line" : line_number,
-        "message" : msg_output,
+        "robot_id": "checkpatch",
+        "robot_run_id": sys.argv[3],
+        "url": sys.argv[4],
+        "line": line_number,
+        "message": msg_output,
     }
     if error not in list_temp[file_path]:
         list_temp[file_path].append(error)

+
 def parse_file(input_file):
-    fp = open (input_file, "r")
+    fp = open(input_file, "r")
     for line in fp:
         if line.startswith("ERROR:"):
             msg_output = line.split("ERROR:")[1].strip()
@@ -38,11 +41,12 @@
             temp = line.split("FILE:")
             file_path = temp[1].split(":")[0]
             line_number = temp[1].split(":")[1]
-            update_struct( file_path.strip(), msg_output, str(line_number)  )
+            update_struct(file_path.strip(), msg_output, str(line_number))
         else:
             continue
     fp.close()

+
 def main():
     if (len(sys.argv) < 5) or (sys.argv[1] == "-h"):
         print("HELP:")
@@ -51,11 +55,12 @@

     print(sys.argv[1])
     parse_file(sys.argv[1])
-    data['robot_comments'] = list_temp
+    data["robot_comments"] = list_temp
     print(json.dumps(data))
-    out_file = open( sys.argv[2] , "w")
+    out_file = open(sys.argv[2], "w")
     json.dump(data, out_file, sort_keys=True, indent=4)
     out_file.close()

+
 if __name__ == "__main__":
     main()

--
To view, visit https://gerrit.osmocom.org/c/osmo-ci/+/43444?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings?usp=email

Gerrit-MessageType: merged
Gerrit-Project: osmo-ci
Gerrit-Branch: master
Gerrit-Change-Id: Ie67fce9de101fd58db0af4e5fe54922a54ce2c9b
Gerrit-Change-Number: 43444
Gerrit-PatchSet: 1
Gerrit-Owner: osmith <[email protected]>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <[email protected]>
Gerrit-Reviewer: osmith <[email protected]>
Gerrit-Reviewer: pespin <[email protected]>

Reply via email to