-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[DESIGN] support different code formatters, allow to skip formatting #304
Comments
I don't know if you're interested in a random person's input on this (and wouldn't blame you if you didn't) but I thought I'd share my 2c anyway. Having an ability to run just linters with That being said, I'd put that functionality into a separate tool and make The other thing is that I also think there could be more demand for a tool that runs formatters/linters/younameits for the changed parts of code than there are for So I would go with the separate package for it. Then at some point |
I certainly am!
Note that after #393,
So effectively extracting linter support from
Thanks for raising that point. I've been pondering the "two separate packages" option, too, but so far ended up only considering a single code base for ease of maintenance. One detail to consider is that after splitting
In addition to linting without running What about then moving everything from What do you think?
That's another interesting idea which I have considered before. For that, it would be good to generalize the design a bit. Currently the order of running different tools and the way (and whether) e.g. AST verification is done is custom coded for the set of tools supported. So ultimately there could be a I'd love to iron out the long-term plan in collaboration with you and/or whoever is interested in the topic. I've also hosted video call meetings about |
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
Glad to hear it :)
Ok, that makes perfect sense.
Yeah, although I think in the long run
I honestly don't know. With option a) changes in the helper parts wouldn't require updating three different packages (
Yes it would.
Sounds like a plan to me :)
That would be super cool and something I think is worth pursuing. But for the time being I think the focus should be in the Python tooling and just keep it in mind and trying not to hard code language specific stuff.
Sounds good to me! Telcos sound like a good idea, so does IRL meeting should we ever happen to be located in near(ish) proximity :) I'll address the naming stuff in another comment, this one's getting long as it is. |
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
Hey, thinking about possible logos led me to a feature idea! We could think of Well, why couldn't As for the
|
This comment was marked as resolved.
This comment was marked as resolved.
@okuuva FYI the first step for reformatting and linting separation has now been done! Darker 2.0.0 now depends on Darkgraylib for common code between reformatting and linting, and on Graylint for the code for linting. Graylint has a command line interface for linting, but for now Darker's |
See also: many-formatters sub-project
Currently there's no way to run Darker and have it just do, say,
isort
andflynt
but not reformat code using Black.Also, there are open requests for replacing Black with another formatter or expanding the choices of formatters/linters:
blue
as a formatter #251 / Add Blue as an alternative reformatter #309flynt
to convert old string literal formatting to f-strings #266ruff format
as a formatter #521We could expand Darker's behavior in stages:
--black
/--no-black
; see--black
/--no-black
options #449--format=black
/--format=blue
/--format=ruff
/--format=none
blue
,Ruff
and other formatters; seeruff format
as a formatter #521--format=none
(what would be a good name for that?)darker
to--format=none
in version 2.0.0For the option name, I've considered
--format
,--formatter
,--reformat
and--reformatter
:--reformat
and--reformatter
(also for needless verbosity)--lint
, not--linter
, so for consistency, I'd prefer--format
over--formatter
At some point after making
--format=none
the default,black
should be removed as a hard dependency. I can see two alternatives:pip install 'darker[black]'
anddarker --black
for the current behaviordarker
to a new package (package name to be decided) whichblack
black
by default (so has--format=none
as the default)darker
depend on the new package andblack
darker
, wrap and command line parser of the new package and override--format
by setting--format=black
as defaultFor the
--black
/--no-black
/--blue
/--no-blue
design choice, some pros and cons are:--black
: can enable multiple formatters (although what about the running order?)--black
: consistent with--isort
and--flynt
--black
: shorter to typeand for
--format={black|blue|none}
:--format=
: consistent with--lint=
--format=
inconsistent with--lint=
since--format=black
or--format=blue
don't really specify a command line--format=
: more verboseThe text was updated successfully, but these errors were encountered: