ruff
de2a13fc - [`pandas-vet`] series constant series (#5802)

Commit
2 years ago
[`pandas-vet`] series constant series (#5802) ## Summary Implementation for https://github.com/astral-sh/ruff/issues/5588 Q1: are there any additional semantic helpers that could be used to guard this rule? Which existing rules should be similar in that respect? Can we at least check if `pandas` is imported (any pointers welcome)? Currently, the rule flags: ```python data = {"a": "b"} data.nunique() == 1 ``` Q2: Any pointers on naming of the rule and selection of the code? It was proposed, but not replied to/implemented in the upstream. `pandas` did accept a PR to update their cookbook to reflect this rule though. ## Test Plan TODO: - [X] Checking for ecosystem CI results - [x] Test on selected [real-world cases](https://github.com/search?q=%22nunique%28%29+%3D%3D+1%22+language%3APython+&type=code) - [x] https://github.com/sdv-dev/SDMetrics - [x] https://github.com/google-research/robustness_metrics - [x] https://github.com/soft-matter/trackpy - [x] https://github.com/microsoft/FLAML/ - [ ] Add guarded test cases
Author
Parents
Loading