8000 GitHub · Where software is built
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
[DESIGN] support different code formatters, allow to skip formatting #304
Closed
@akaihola

Description

@akaihola

See also: many-formatters sub-project

Currently there's no way to run Darker and have it just do, say, isort and flynt but not reformat code using Black.

Also, there are open requests for replacing Black with another formatter or expanding the choices of formatters/linters:

We could expand Darker's behavior in stages:

For the option name, I've considered --format, --formatter, --reformat and --reformatter:

  • Black calls itself a "formatter", so I discarded --reformat and --reformatter (also for needless verbosity)
  • Linters are chosen with --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]' and darker --black for the current behavior
  • split into two Python packages:
    • move all code from darker to a new package (package name to be decided) which
      • doesn't require black
      • doesn't run black by default (so has --format=none as the default)
    • make darker depend on the new package and black
    • in darker, wrap and command line parser of the new package and override --format by setting --format=black as default

For 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 type

and 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 verbose

Metadata

Metadata

Assignees

Labels

enhancementNew feature or requestmany-formattersSupport for multiple code formatters and skipping formatting

Projects

Status

Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    0