34 url = SONAR_URL + url
35 response = None
36 if log:
37 print(f"\n'{url}' response:", flush=True) 38 response = requests.get(url, timeout=60, auth=HTTPBasicAuth(SONAR_LOGIN, SONAR_PASSWORD))
39 response.raise_for_status()
40 if not response.text:
252 print("### NEW RULES WHICH MUST BE ADDED\n")
253 for key in sorted(only_in_new):
254 print("*", key)
255 print("") 256 print("```XML")
257 for key in sorted(only_in_new):
258 rule_tag = new_keys_mapping[key]
191 description_tag = rule_tag.find('description')
192 if len(name_tag) > 200:
193 print("### ERR: <name> too long (max 200)")
194 has_len_errors = True 195 description_dump_path = "/tmp/" + key + ".ruledump"
196 with open(description_dump_path, "w") as f:
197 html = """<!DOCTYPE html>
106 keys = []
107 keys_to_ruleelement = {}
108 try :
109 tree = et.parse(path) 110 except et.ParseError as e:
111 sys.stderr.write("[ERROR] {}: {}\n".format(path, e))
112 return keys, keys_to_ruleelement
104def parse_rules_xml(path):
105 sys.stderr.write("[INFO] parse .xml file {}\n".format(path))
106 keys = []
107 keys_to_ruleelement = {} 108 try :
109 tree = et.parse(path)
110 except et.ParseError as e:
There should be no whitespace after the final character in a line.