扫描分析源码 :param params: :return:
(self, params)
| 51 | ToolDisplay.print_log(self.sensitive, self.sensitive_word_maps, message) |
| 52 | |
| 53 | def analyze(self, params): |
| 54 | """ |
| 55 | 扫描分析源码 |
| 56 | :param params: |
| 57 | :return: |
| 58 | """ |
| 59 | envs = os.environ |
| 60 | work_dir = os.getcwd() |
| 61 | |
| 62 | # 表示Eslint扫描Js以及React框架 |
| 63 | eslint_type = "JAVASCRIPT" |
| 64 | eslint_ext = ".js,.jsx" |
| 65 | if "ESLINT_%s_EXT" % eslint_type in envs: |
| 66 | eslint_ext = envs.get("ESLINT_%s_EXT" % eslint_type) |
| 67 | # 扫描html内嵌js |
| 68 | if envs.get("ESLINT_EXT_HTML"): |
| 69 | eslint_ext = eslint_ext + ",.html" |
| 70 | |
| 71 | error_output = os.path.join(work_dir, "%s_eslint_result.xml" % eslint_type.lower()) |
| 72 | |
| 73 | config_path, rule_filte_flag = self.config(params, eslint_type, True) |
| 74 | |
| 75 | self.scan(params, config_path, error_output, eslint_ext) |
| 76 | |
| 77 | return self.data_handle(params, error_output, rule_filte_flag) |
| 78 | |
| 79 | def config(self, params, eslint_type, use_custom_prority=False): |
| 80 | """ |
nothing calls this directly
no test coverage detected