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

Disabling formatting with environment / system variable #74

Open
AlexITC opened this issue Sep 20, 2018 · 4 comments
Open

Disabling formatting with environment / system variable #74

AlexITC opened this issue Sep 20, 2018 · 4 comments

Comments

@AlexITC
Copy link

AlexITC commented Sep 20, 2018

I wonder if there is a way to disable the formatting when a value is passed as a environment or system variable.

This is useful to not format the code on the continuous integration step to fail if the code isn't formatted.

Thanks.

@gregghz
Copy link
Contributor

gregghz commented Jan 7, 2019

I've wondered about this too. I know at Lucid when I was there, it would format on compile in dev but on jenkins it would simply fail the build if formatting was wrong. I'm not there anymore so I can't check what's going on. Maybe @pauldraper or @jjudd could help out?

@AlexITC
Copy link
Author

AlexITC commented Jan 9, 2019

@gregghz the work around that I ended up using is to format the sources using a git hook and add the scalafmt --test step to our CI server.

@mwz
Copy link

mwz commented Jan 9, 2019

How about this?

scalafmtOnCompile in ThisBuild := !sys.env.contains("DISABLE_SCALAFMT")

@AlexITC
Copy link
Author

AlexITC commented Jan 9, 2019

I remember that I already tried that but for some reason, it didn't worked for my case, I'll try it out in a project soon.

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

No branches or pull requests

3 participants