1212# TODO distutils will be removed in python3.12
1313import shlex
1414import subprocess
15- import json
1615from pathlib import Path
1716import sys
1817from typing import List , Optional
@@ -105,14 +104,12 @@ def get_analyzer_checkers(cls):
105104 """
106105 Return the list of the supported checkers.
107106 """
107+ context = analyzer_context .get_context ()
108+
108109 command = [cls .analyzer_binary (), "help" , "--list-issue-types" ]
109- desc = json .load (
110- open (Path (__file__ ).parent / "descriptions.json" ,
111- "r" , encoding = "utf-8" ))
112110 checker_list = []
113111 try :
114- env = analyzer_context .get_context ().get_env_for_bin (
115- cls .analyzer_binary ())
112+ env = context .get_env_for_bin (cls .analyzer_binary ())
116113 env .update (TZ = 'UTC' )
117114 output = subprocess .check_output (command ,
118115 stderr = subprocess .DEVNULL ,
@@ -122,16 +119,18 @@ def get_analyzer_checkers(cls):
122119 if len (data ) < 7 :
123120 continue
124121
125- entry_id = data [0 ].lower ()
126- if entry_id in desc :
127- description = desc [entry_id ]
128- else :
129- checker = data [6 ] if len (data ) == 7 else data [5 ]
130- description = f"used by '{ checker } ' checker"
122+ checker = f'infer-{ data [0 ].lower ().replace ("_" , "-" )} '
123+
124+ description = context .checker_labels .label_of_checker (
125+ checker ,
126+ 'description' ,
127+ cls .ANALYZER_NAME )
128+
129+ if not description :
130+ user = data [6 ] if len (data ) == 7 else data [5 ]
131+ description = f"used by '{ user } ' checker"
131132
132- entry_id = entry_id .replace ("_" , "-" )
133- checker_list .append ((f"infer-{ entry_id } " ,
134- description ))
133+ checker_list .append ((checker , description ))
135134 return checker_list
136135 except (subprocess .CalledProcessError ) as e :
137136 LOG .error (e .stderr )
0 commit comments