Skip to content
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

Very long lines not formatted. #373

Open
Sean1708 opened this issue Feb 4, 2023 · 0 comments
Open

Very long lines not formatted. #373

Sean1708 opened this issue Feb 4, 2023 · 0 comments
Labels
component | style Modifications to the formatting rules roadmap | long lines status | it is a good thing We agree it is good to implement this type | feature request New feature or request

Comments

@Sean1708
Copy link

Sean1708 commented Feb 4, 2023

Running alejandra on this file

{python = pkgs.python3.withPackages (ps: [rmt-utilities] ++ (with ps; [bunch codecov coverage docutils flake8 ipython matplotlib numpydoc sphinx-copybutton sphinx_rtd_theme sphinx-autoapi sphinx-argparse sphinx twine versioneer]));}

leaves it unchanged:

$ alejandra flake.nix
Checking style in 1 file using 8 threads.


Congratulations! Your code complies with the Alejandra style.

👏 Special thanks to Daniel Salazar for being a sponsor of Alejandra!

However if you split it anywhere inside the second list, e.g.

{python = pkgs.python3.withPackages (ps: [rmt-utilities] ++ (with ps; [bunch codecov coverage docutils flake8 ipython matplotlib numpydoc sphinx-copybutton sphinx_rtd_theme sphinx-autoapi sphinx-argparse sphinx twine versioneer
]));}

it formats it nicely:

{
  python = pkgs.python3.withPackages (ps:
    [rmt-utilities]
    ++ (with ps; [
      bunch
      codecov
      coverage
      docutils
      flake8
      ipython
      matplotlib
      numpydoc
      sphinx-copybutton
      sphinx_rtd_theme
      sphinx-autoapi
      sphinx-argparse
      sphinx
      twine
      versioneer
    ]));
}

Splitting it in other places though, like

{python = pkgs.python3.withPackages (ps: [rmt-utilities
] ++ (with ps; [bunch codecov coverage docutils flake8 ipython matplotlib numpydoc sphinx-copybutton sphinx_rtd_theme sphinx-autoapi sphinx-argparse sphinx twine versioneer]));}

still leaves it with a particularly long line

{
  python = pkgs.python3.withPackages (ps:
    [
      rmt-utilities
    ]
    ++ (with ps; [bunch codecov coverage docutils flake8 ipython matplotlib numpydoc sphinx-copybutton sphinx_rtd_theme sphinx-autoapi sphinx-argparse sphinx twine versioneer]));
}

While this particular file is just one line, I found this issue when I put that exact line into a larger flake.nix file so it's nothing to do with it just being one line.

$ alejandra --version
Alejandra 3.0.0
@kamadorueda kamadorueda added type | feature request New feature or request component | style Modifications to the formatting rules status | it is a good thing We agree it is good to implement this roadmap | long lines labels Nov 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component | style Modifications to the formatting rules roadmap | long lines status | it is a good thing We agree it is good to implement this type | feature request New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants