idg jddlZddlmZddlmZmZddlmZmZm Z ddl m Z dZ Gdde Z dS) N)PathGraphingAstVisitor)CouldNotHandleEncoding read_py_file)LocationMessagemake_tool_error_message)ToolBase) McCabeToolc0eZdZfdZdZdZdZxZS)r cVtj|i|d|_d|_dS)N )super__init__ ignore_codesmax_complexity)selfargskwargs __class__s U/opt/cloudlinux/venv/lib/python3.11/site-packages/prospector/tools/mccabe/__init__.pyrzMcCabeTool.__init__ s5$)&))) c|d|_|d}d|vr|d|_dSdS)Nmccabezmax-complexity)get_disabled_messagesr tool_optionsr)rprospector_config_optionss r configurezMcCabeTool.configuresR-CCHMM#00:: w & &")*:";D    ' &rc jg}|jD]} t|}tj||}n#t$r8}|t |ddd|jYd}~gd}~wt$r<}|t |dd|j |j dYd}~d}~wt$r)|t |dddYwxYwt}| |||jD]r}|} | |jkrQt%|d|j|j d } t)dd | |jd | d } || s||S)N)filenamerMC0000z,Could not handle the encoding of this file: )messagez Syntax Error)line characterr$zUnable to parse filer)pathmodulefunctionr%r&MC0001z is too complex ())sourcecodelocationr$)python_modulesrastparserappendrencoding SyntaxErrorlinenooffset TypeErrorrpreordergraphsvalues complexityrrentityrfilter_messages) r found_filesmessages code_filecontentstreeerrvisitorgraphr;r.r$s rrunzMcCabeTool.runs<$30 -0 -I ' 22y&*   +!  ]s| ] ]    +!   Z"%* .        7 8X_u v v vwww -..G   T7 + + + ..00 - -"--//  333'&telQVQ]ij   H&'%!)#(< O O* O O O G OOG,,, -##H---s&%4 C+.A11 C+>2B553C+*C+c fd|DS)Nc0g|]}|jjv|Sr )r-r).0r$rs r z.McCabeTool.filter_messages..Qs(YYYG7rSs ))))))DDDDDDDDIIIIIIIIII****** EZEZEZEZEZEZEZEZEZEZr