Open 9999years opened 5 months ago
Hmm that's an interesting one. The rule is working as intended but I can see how it is undesired in this specific case.
I would favor the solution where the rule ignores Python
code blocks, although that would require that the rule supports some form of markdown parsing, which seems a bit much.
It's a bit of a hack, but you can use triple quotes to get around this case https://play.ruff.rs/42481cc7-c07b-4158-9b6b-c65f0be7c09c
Mine is different but matches the title. Maybe the rule is too eager? It worked on ruff 0.2.1, FP on 0.3.7
# case 1: both codes are CREATE
if cond1:
pass
# case 2: one code is a CREATE, the other is an existing
elif cond2:
pass
# case 3: both codes are existing
elif cond3:
pass
removing the colons removes the FP, is that how it is meant to be?
Ruff treats this as commented-out code, despite being an example.
It would be nice if Ruff could recognize "for example" or
```python
-blocks as "example code".