|
| 1 | +--- |
| 2 | +source: crates/ruff_linter/src/rules/fastapi/mod.rs |
| 3 | +--- |
| 4 | +--- Linter settings --- |
| 5 | +-linter.unresolved_target_version = 3.13 |
| 6 | ++linter.unresolved_target_version = 3.14 |
| 7 | + |
| 8 | +--- Summary --- |
| 9 | +Removed: 10 |
| 10 | +Added: 0 |
| 11 | + |
| 12 | +--- Removed --- |
| 13 | +FAST001 [*] FastAPI route with redundant `response_model` argument |
| 14 | + --> FAST001.py:17:22 |
| 15 | + | |
| 16 | +17 | @app.post("/items/", response_model=Item) |
| 17 | + | ^^^^^^^^^^^^^^^^^^^ |
| 18 | +18 | async def create_item(item: Item) -> Item: |
| 19 | +19 | return item |
| 20 | + | |
| 21 | +help: Remove argument |
| 22 | +14 | # Errors |
| 23 | +15 | |
| 24 | +16 | |
| 25 | + - @app.post("/items/", response_model=Item) |
| 26 | +17 + @app.post("/items/") |
| 27 | +18 | async def create_item(item: Item) -> Item: |
| 28 | +19 | return item |
| 29 | +20 | |
| 30 | +note: This is an unsafe fix and may change runtime behavior |
| 31 | + |
| 32 | + |
| 33 | +FAST001 [*] FastAPI route with redundant `response_model` argument |
| 34 | + --> FAST001.py:22:22 |
| 35 | + | |
| 36 | +22 | @app.post("/items/", response_model=list[Item]) |
| 37 | + | ^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 38 | +23 | async def create_item(item: Item) -> list[Item]: |
| 39 | +24 | return item |
| 40 | + | |
| 41 | +help: Remove argument |
| 42 | +19 | return item |
| 43 | +20 | |
| 44 | +21 | |
| 45 | + - @app.post("/items/", response_model=list[Item]) |
| 46 | +22 + @app.post("/items/") |
| 47 | +23 | async def create_item(item: Item) -> list[Item]: |
| 48 | +24 | return item |
| 49 | +25 | |
| 50 | +note: This is an unsafe fix and may change runtime behavior |
| 51 | + |
| 52 | + |
| 53 | +FAST001 [*] FastAPI route with redundant `response_model` argument |
| 54 | + --> FAST001.py:27:22 |
| 55 | + | |
| 56 | +27 | @app.post("/items/", response_model=List[Item]) |
| 57 | + | ^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 58 | +28 | async def create_item(item: Item) -> List[Item]: |
| 59 | +29 | return item |
| 60 | + | |
| 61 | +help: Remove argument |
| 62 | +24 | return item |
| 63 | +25 | |
| 64 | +26 | |
| 65 | + - @app.post("/items/", response_model=List[Item]) |
| 66 | +27 + @app.post("/items/") |
| 67 | +28 | async def create_item(item: Item) -> List[Item]: |
| 68 | +29 | return item |
| 69 | +30 | |
| 70 | +note: This is an unsafe fix and may change runtime behavior |
| 71 | + |
| 72 | + |
| 73 | +FAST001 [*] FastAPI route with redundant `response_model` argument |
| 74 | + --> FAST001.py:32:22 |
| 75 | + | |
| 76 | +32 | @app.post("/items/", response_model=Dict[str, Item]) |
| 77 | + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 78 | +33 | async def create_item(item: Item) -> Dict[str, Item]: |
| 79 | +34 | return item |
| 80 | + | |
| 81 | +help: Remove argument |
| 82 | +29 | return item |
| 83 | +30 | |
| 84 | +31 | |
| 85 | + - @app.post("/items/", response_model=Dict[str, Item]) |
| 86 | +32 + @app.post("/items/") |
| 87 | +33 | async def create_item(item: Item) -> Dict[str, Item]: |
| 88 | +34 | return item |
| 89 | +35 | |
| 90 | +note: This is an unsafe fix and may change runtime behavior |
| 91 | + |
| 92 | + |
| 93 | +FAST001 [*] FastAPI route with redundant `response_model` argument |
| 94 | + --> FAST001.py:37:22 |
| 95 | + | |
| 96 | +37 | @app.post("/items/", response_model=str) |
| 97 | + | ^^^^^^^^^^^^^^^^^^ |
| 98 | +38 | async def create_item(item: Item) -> str: |
| 99 | +39 | return item |
| 100 | + | |
| 101 | +help: Remove argument |
| 102 | +34 | return item |
| 103 | +35 | |
| 104 | +36 | |
| 105 | + - @app.post("/items/", response_model=str) |
| 106 | +37 + @app.post("/items/") |
| 107 | +38 | async def create_item(item: Item) -> str: |
| 108 | +39 | return item |
| 109 | +40 | |
| 110 | +note: This is an unsafe fix and may change runtime behavior |
| 111 | + |
| 112 | + |
| 113 | +FAST001 [*] FastAPI route with redundant `response_model` argument |
| 114 | + --> FAST001.py:42:21 |
| 115 | + | |
| 116 | +42 | @app.get("/items/", response_model=Item) |
| 117 | + | ^^^^^^^^^^^^^^^^^^^ |
| 118 | +43 | async def create_item(item: Item) -> Item: |
| 119 | +44 | return item |
| 120 | + | |
| 121 | +help: Remove argument |
| 122 | +39 | return item |
| 123 | +40 | |
| 124 | +41 | |
| 125 | + - @app.get("/items/", response_model=Item) |
| 126 | +42 + @app.get("/items/") |
| 127 | +43 | async def create_item(item: Item) -> Item: |
| 128 | +44 | return item |
| 129 | +45 | |
| 130 | +note: This is an unsafe fix and may change runtime behavior |
| 131 | + |
| 132 | + |
| 133 | +FAST001 [*] FastAPI route with redundant `response_model` argument |
| 134 | + --> FAST001.py:47:21 |
| 135 | + | |
| 136 | +47 | @app.get("/items/", response_model=Item) |
| 137 | + | ^^^^^^^^^^^^^^^^^^^ |
| 138 | +48 | @app.post("/items/", response_model=Item) |
| 139 | +49 | async def create_item(item: Item) -> Item: |
| 140 | + | |
| 141 | +help: Remove argument |
| 142 | +44 | return item |
| 143 | +45 | |
| 144 | +46 | |
| 145 | + - @app.get("/items/", response_model=Item) |
| 146 | +47 + @app.get("/items/") |
| 147 | +48 | @app.post("/items/", response_model=Item) |
| 148 | +49 | async def create_item(item: Item) -> Item: |
| 149 | +50 | return item |
| 150 | +note: This is an unsafe fix and may change runtime behavior |
| 151 | + |
| 152 | + |
| 153 | +FAST001 [*] FastAPI route with redundant `response_model` argument |
| 154 | + --> FAST001.py:48:22 |
| 155 | + | |
| 156 | +47 | @app.get("/items/", response_model=Item) |
| 157 | +48 | @app.post("/items/", response_model=Item) |
| 158 | + | ^^^^^^^^^^^^^^^^^^^ |
| 159 | +49 | async def create_item(item: Item) -> Item: |
| 160 | +50 | return item |
| 161 | + | |
| 162 | +help: Remove argument |
| 163 | +45 | |
| 164 | +46 | |
| 165 | +47 | @app.get("/items/", response_model=Item) |
| 166 | + - @app.post("/items/", response_model=Item) |
| 167 | +48 + @app.post("/items/") |
| 168 | +49 | async def create_item(item: Item) -> Item: |
| 169 | +50 | return item |
| 170 | +51 | |
| 171 | +note: This is an unsafe fix and may change runtime behavior |
| 172 | + |
| 173 | + |
| 174 | +FAST001 [*] FastAPI route with redundant `response_model` argument |
| 175 | + --> FAST001.py:53:24 |
| 176 | + | |
| 177 | +53 | @router.get("/items/", response_model=Item) |
| 178 | + | ^^^^^^^^^^^^^^^^^^^ |
| 179 | +54 | async def create_item(item: Item) -> Item: |
| 180 | +55 | return item |
| 181 | + | |
| 182 | +help: Remove argument |
| 183 | +50 | return item |
| 184 | +51 | |
| 185 | +52 | |
| 186 | + - @router.get("/items/", response_model=Item) |
| 187 | +53 + @router.get("/items/") |
| 188 | +54 | async def create_item(item: Item) -> Item: |
| 189 | +55 | return item |
| 190 | +56 | |
| 191 | +note: This is an unsafe fix and may change runtime behavior |
| 192 | + |
| 193 | + |
| 194 | +FAST001 [*] FastAPI route with redundant `response_model` argument |
| 195 | + --> FAST001.py:118:23 |
| 196 | + | |
| 197 | +116 | def setup_app(app_arg: FastAPI, non_app: str) -> None: |
| 198 | +117 | # Error |
| 199 | +118 | @app_arg.get("/", response_model=str) |
| 200 | + | ^^^^^^^^^^^^^^^^^^ |
| 201 | +119 | async def get_root() -> str: |
| 202 | +120 | return "Hello World!" |
| 203 | + | |
| 204 | +help: Remove argument |
| 205 | +115 | |
| 206 | +116 | def setup_app(app_arg: FastAPI, non_app: str) -> None: |
| 207 | +117 | # Error |
| 208 | + - @app_arg.get("/", response_model=str) |
| 209 | +118 + @app_arg.get("/") |
| 210 | +119 | async def get_root() -> str: |
| 211 | +120 | return "Hello World!" |
| 212 | +121 | |
| 213 | +note: This is an unsafe fix and may change runtime behavior |
0 commit comments