sourcery icon indicating copy to clipboard operation
sourcery copied to clipboard

Instant AI code reviews

Results 146 sourcery issues
Sort by recently updated
recently updated
newest added

### Issue description or question The dictionary union operator was [introduced in Python 3.9](https://docs.python.org/3/whatsnew/3.9.html). Sourcery provides a [`use-dictionary-union`](https://docs.sourcery.ai/refactorings/use-dictionary-union/) refactoring to suggest the dictionary union operator. The Sourcery GitHub app is...

enhancement

### Issue description or question ```py def test(): # suggests the following: # Merge duplicate blocks in conditional (merge-duplicate-blocks) # Remove redundant conditional (remove-redundant-if) blah = 3 other = True...

enhancement

### Issue description or question Consider this as a suggestion. The refactoring could go a step further when these two rules are used together. Replace while with for (while-to-for) Replace...

enhancement

### Issue description or question Not sure about your stance on implicit vs explicit declaration in Python, but defining a class via ```python class foo(object): ... ``` is the same...

enhancement

### Issue description or question Code that sourcery would recactor is ignored if defined as a function inside another function ### Sourcery Version 0 .3.0 ### Code editor or IDE...

enhancement

### Issue description or question The VSCode extension only respects `.sourcery.yaml` in the first path defined in the `*.code-workspace` file for a multi-root workspace. It then proceeds to apply this...

bug

### Issue description or question In my case, a Pydantic `@validator` decorator is an implicit `@classmethod`, but Sourcery complains. There are perhaps other custom decorators that imply `@classmethod` besides the...

enhancement

### Issue description or question Feature request for refactoring python code to make it more pythonic. Suggest refactoring `.split("\n")` to `splitlines()`. ### Sourcery Version v0.11.2 ### Code editor or IDE...

enhancement

### Issue description or question In as few words as possible, ```py try: int("123.45") except: pass ``` The above code is first suggested to use `do-not-use-bare-except`, and upon adding `except...

enhancement

Currently, Sourcery suggests refactorings by opening a separate PR, which will be merged into the original PR. All the refactorings are performed in a single commit, so if you want...

enhancement