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

Add vertical-blank SQL formatter? #459

Closed
colindean opened this issue Sep 24, 2019 · 7 comments
Closed

Add vertical-blank SQL formatter? #459

colindean opened this issue Sep 24, 2019 · 7 comments

Comments

@colindean
Copy link

colindean commented Sep 24, 2019

I'm setting up SQL formatting for the benefit of some data scientists on my team. They're not a fan of how DBeaver formats SQL but they do like how vertical-blank's sql-formatter formats SQL.

Would it be permissible to add an additional SQL formatter that uses this other library?

I figure if DBeaver is configured like so:

spotless {
  sql {
    // default value for target files
    target '**/*.sql'
    dbeaver().configFile('sql_formatter_settings.properties')
  }
}

then I could configure sql-formatter like so:

spotless {
  sql {
    // default value for target files
    target '**/*.sql'
    verticalBlank().configFile('sql_formatter_settings.properties')
  }
}

I'm willing to do the work but want to run it past the maintainers before committing any time to it.

@colindean colindean changed the title Additional SQL formatter? Add vertical-blank SQL formatter? Sep 24, 2019
@nedtwigg
Copy link
Member

That would be great! We have multiple formatters available for many file types (e.g. eclipse vs google-java-format for java, tsfmt vs prettier for typescript, prettier vs WTP for web resources, etc.). Spotless is opinionated that you should use automatic code formatting, it is explicitly agnostic about which style you should use.

https://github.com/diffplug/spotless/blob/master/CONTRIBUTING.md#how-to-add-a-new-formatterstep

@nedtwigg
Copy link
Member

Perhaps some useful background: #156

@colindean
Copy link
Author

Cool. We're evaluating a few different formatters to find one we like. When we choose, I'll head in that direction. vertical-blank is winning right now.

@jbduncan
Copy link
Member

jbduncan commented Sep 24, 2019

@colindean To add to @nedtwigg's comments, I did a search just now and I see that vertical-blank's sql-formatter is a Java port of zeroturnaround's sql-formatter for JavaScript, and that vertical-blank's formatter hasn't been updated in a few months.

Thus if you felt inclined to submit a PR (no pressure, though!), I'd suggest you look into how Spotless integrates the JavaScript formatter prettier, and then use the same technique to integrate zeroturnaround's sql-formatter.

If you need any help with this, I'd be more than happy to guide you in any way I can. :)

@jbduncan
Copy link
Member

That being said, I'm equally happy to help out with integrating vertical-blank's formatter if you'd prefer that. :)

@jbduncan
Copy link
Member

...and I've just seen your earlier comment about you still deciding which formatter to go for. Sorry about that!

In any case, I'm happy to help in any way I can!

@nedtwigg
Copy link
Member

Just an update, it is now possible to use any formatter from the NodeJS world, and especially any plugin for prettier, such as prettier-plugin-pg and others.

We're still happy to take a PR for vertical-blank, or any other SQL formatter. But since this has sat dormant for almost a year, I'm going to close it for now. Happy to reopen if there is renewed interest.

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

No branches or pull requests

3 participants