(location: ScanLocation)
| 131 | analyzers = get_analyzers(names) |
| 132 | |
| 133 | def _run_analyzers(location: ScanLocation): |
| 134 | ast_analysis = False |
| 135 | for x in analyzers: |
| 136 | if isinstance(x, NodeAnalyzerV2): |
| 137 | ast_analysis = True |
| 138 | else: |
| 139 | yield from x(location=location) |
| 140 | |
| 141 | if ast_analysis and location.is_python_source_code: |
| 142 | try: |
| 143 | visitor = Visitor.run_stages(location=location) |
| 144 | yield from visitor() |
| 145 | except exceptions.ASTParseError: |
| 146 | yield Detection( |
| 147 | location=location.location, |
| 148 | detection_type="ASTParseError", |
| 149 | message="Unable to parse the source code", |
| 150 | signature=f"ast_parse_error#{str(location)}", |
| 151 | ) |
| 152 | except exceptions.PythonExecutorError as exc: |
| 153 | yield Detection( |
| 154 | location=location.location, |
| 155 | detection_type="ASTParseError", |
| 156 | message="Unable to parse the source code", |
| 157 | signature=f"ast_parse_error#{str(location)}", |
| 158 | extra={ |
| 159 | "stdout": exc.stdout, |
| 160 | "stderr": exc.stderr |
| 161 | } |
| 162 | ) |
| 163 | |
| 164 | return _run_analyzers |
nothing calls this directly
no test coverage detected