astral-sh / ruff

An extremely fast Python linter and code formatter, written in Rust.
https://docs.astral.sh/ruff
MIT License
32.37k stars 1.08k forks source link

I001 warning even after running isort #12457

Closed bje- closed 3 months ago

bje- commented 3 months ago

One of my source files produces a warning from ruff:

from nemo import configfile, regions
from nemo.generators import (CCGT, CCGT_CCS, CST, OCGT, Biofuel, Black_Coal,
                             CentralReceiver, Coal_CCS, DemandResponse, Hydro,
                             PumpedHydroPump, PumpedHydroTurbine, PV1Axis,
                             Wind, WindOffshore)
from nemo.polygons import (WILDCARD, cst_limit, offshore_wind_limit, pv_limit,
                           wind_limit)
from nemo.storage import PumpedHydroStorage
from nemo.types import UnreachableError

Running isort over the file does not change these statements in any way, so it seems that ruff and isort are assuming different isort settings. I am not running isort with any options nor am I using a settings file.

charliermarsh commented 3 months ago

Ruff's import sorting rule is designed to be compatible with isort assuming profile = "black", but you're using different isort formatting there. We don't support the variants that wrap like you have it wrapped above. Check out the FAQ. There are a few other minor deviations that are documented in there.

bje- commented 3 months ago

Thanks, and sorry I missed the FAQ entry!

charliermarsh commented 3 months ago

No prob!