(self, node: ast.Call)
| 1090 | self._report_input(line, col, S028_msg.format(source, callee), "shaped") |
| 1091 | |
| 1092 | def visit_Call(self, node: ast.Call) -> None: |
| 1093 | self._s024_visit_call(node) |
| 1094 | if self._input_stack: |
| 1095 | self._record_validator(node) |
| 1096 | self._record_input_call(node) |
| 1097 | if _is_tests_path(self.filename): |
| 1098 | if ( |
| 1099 | isinstance(node.func, ast.Name) |
| 1100 | and node.func.id == "freeze_time" |
| 1101 | and node.args |
| 1102 | and isinstance(node.args[0], ast.Call) |
| 1103 | ): |
| 1104 | y = _wall_clock_year_from_datetime_call(node.args[0]) |
| 1105 | if y is not None and y >= self._s015_year: |
| 1106 | self.errors.append((node.lineno, node.col_offset, self._s015_msg)) |
| 1107 | if ( |
| 1108 | # override_settings(...) |
| 1109 | (isinstance(node.func, ast.Name) and node.func.id == "override_settings") |
| 1110 | or |
| 1111 | # self.settings(...) |
| 1112 | ( |
| 1113 | isinstance(node.func, ast.Attribute) |
| 1114 | and isinstance(node.func.value, ast.Name) |
| 1115 | and node.func.value.id == "self" |
| 1116 | and node.func.attr == "settings" |
| 1117 | ) |
| 1118 | ): |
| 1119 | for keyword in node.keywords: |
| 1120 | if keyword.arg == "SENTRY_OPTIONS": |
| 1121 | self.errors.append((keyword.lineno, keyword.col_offset, S011_msg)) |
| 1122 | |
| 1123 | if isinstance(node.func, ast.Attribute) and node.func.attr in S019_logging_methods: |
| 1124 | for keyword in node.keywords: |
| 1125 | if keyword.arg == "extra" and isinstance(keyword.value, ast.Dict): |
| 1126 | for key in keyword.value.keys: |
| 1127 | if ( |
| 1128 | isinstance(key, ast.Constant) |
| 1129 | and isinstance(key.value, str) |
| 1130 | and key.value in S019_logrecord_attrs |
| 1131 | ): |
| 1132 | self.errors.append( |
| 1133 | (key.lineno, key.col_offset, S019_fmt.format(key.value)) |
| 1134 | ) |
| 1135 | |
| 1136 | # S020: ban raw self.client.get outside client_get in EAP endpoint suites. |
| 1137 | if ( |
| 1138 | _is_eap_events_endpoint_test_path(self.filename) |
| 1139 | and self._class_stack |
| 1140 | and self._class_stack[-1] in self._eap_suite_classes |
| 1141 | and (not self._function_stack or self._function_stack[-1] != "client_get") |
| 1142 | and isinstance(node.func, ast.Attribute) |
| 1143 | and node.func.attr == "get" |
| 1144 | and isinstance(node.func.value, ast.Attribute) |
| 1145 | and node.func.value.attr == "client" |
| 1146 | and isinstance(node.func.value.value, ast.Name) |
| 1147 | and node.func.value.value.id == "self" |
| 1148 | ): |
| 1149 | self.errors.append((node.lineno, node.col_offset, S020_msg)) |
nothing calls this directly
no test coverage detected