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

Ignore specific comments when formatting #16401

Open
toewen opened this issue Feb 26, 2025 · 1 comment
Open

Ignore specific comments when formatting #16401

toewen opened this issue Feb 26, 2025 · 1 comment
Labels
formatter Related to the formatter

Comments

@toewen
Copy link

toewen commented Feb 26, 2025

Summary

I have python scripts I execute on a slurm cluster.

To give some configurations to the cluster the script starts with comments in a specific style. For example

#!/bin/python
#SBATCH -n 5
#SBATCH -N 1

When formatting this file the Shebang is left as is but the other comments get treated as regular comments and a space is inserted between # and SBATCH. Unfortunately this space prevents the slurm cluster from recognizing the comments.

My current solution is

#!/bin/python
# fmt: off
#SBATCH -n 5
#SBATCH -N 1
# fmt: on

I would like an option to ignore these comments when formatting a file.

@MichaReiser MichaReiser added the formatter Related to the formatter label Feb 26, 2025
@MichaReiser
Copy link
Member

There was a similar issue in the past but I can't find it right now :(

I could see an option to specify comment patterns that should never be formatted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
formatter Related to the formatter
Projects
None yet
Development

No branches or pull requests

2 participants