koxudaxi / ruff-pycharm-plugin

PyCharm plugin for ruff. This plugin provides reformat code using ruff.
MIT License
196 stars 9 forks source link

File specific rule not getting applied #277

Closed fenilgmehta closed 5 months ago

fenilgmehta commented 11 months ago

Hi team, thanks for this awesome plugin 🙏

Describe the bug The plugin is not taking into account [per-file-ignores]

To Reproduce Steps to reproduce the behavior:

  1. Create a ruff file like below (name it ruff.toml
    
    # Enable this list of rules.
    select = [
    "S",  # flake8-bandit
    ]
    ignore = []
    target-version = "py311"

Rules to Ignore for matching files.

[per-file-ignores]

"test files" (i.e. unit tests)

"test_*.py" = [ "S101", # Use of assert detected "S311", # Standard pseudo-random generators are not suitable for cryptographic purposes "SLF001", # Private member accessed: {access} ]

2. Create python file and name it `test_ruff_rule_in_pycharm.py`
```python
def test_something() -> None:
    """Ruff will highlight the below assert in PyCharm."""
    assert True

Expected behavior The assert in test_ruff_rule_in_pycharm.py should NOT be highlighted like the one shown in Screenshots section. CLI works perfectly fine.

Screenshots Screenshot_20231002_164541

Environments

koxudaxi commented 11 months ago

@fenilgmehta Thank you for reporting the issue. Unfortunately, I can't reproduce the problem. Would you happen to have the additional information to find the root cause?

Other users have shared similar problems, but I can't reproduce them in my environment. https://github.com/koxudaxi/ruff-pycharm-plugin/issues/291

image

koxudaxi commented 5 months ago

https://github.com/koxudaxi/ruff-pycharm-plugin/issues/291

This is a duplicate of this one and will be closed.