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

Blacklist files or code blocks #420

Closed
isaacabraham opened this issue Feb 18, 2019 · 6 comments · Fixed by #1060
Closed

Blacklist files or code blocks #420

isaacabraham opened this issue Feb 18, 2019 · 6 comments · Fixed by #1060

Comments

@isaacabraham
Copy link

If one reaches a file that Fantomas can't handle for whatever reason, currently you're just "stuck" (unless you maintain a specific list of "good" files). Is there a way to provide a list of files that fantomas should ignore?

Alternatively, is there perhaps a way that one could have fantomas ignore specific blocks of code in a file?

@prosconi
Copy link

prosconi commented Mar 2, 2019

Are you thinking of something like a .gitignore ... .fantomasignore?

@jindraivanek
Copy link
Contributor

I think something like

//#FANTOMAS OFF

code block that will be ignored by fantomas

//#FANTOMAS ON

will be good addition.

@nojaf
Copy link
Contributor

nojaf commented Mar 4, 2019

I would prefer that the comment marks the entire file as not to be formatted.
Having a mixed model of some blocks formatted and other blocks not will lead to a headache for sure.

@nojaf
Copy link
Contributor

nojaf commented Jun 28, 2019

Hi @isaacabraham, we are thinking about introducing a new directive that we always add when we format the code. That way we can ignore the block that negates this directive.

For example:

#if !FANTOMAS
let foo = 42 // Never going to be formatted
#endif

Would such a thing work for you? Then I theory you could have pieces of a file that is not being formatted.

@ErikSchierboom
Copy link
Contributor

I would love to have a .fantomasignore file. It is similar to e.g. how git and prettier work.

@nojaf
Copy link
Contributor

nojaf commented Sep 1, 2020

I published a first version with the new .fantomasignore file support: https://www.nuget.org/packages/fantomas-tool/4.1.0-alpha-001
Please give this a spin and let me know if this is workable.
You can find some docs here.

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

Successfully merging a pull request may close this issue.

5 participants