Command Line "Reformat All Files In Folder" and pre-Commit
Opening over 2500 code objects to set a baseline format, required by a large customer, is a daunting manual task.
Many of Red Gate's tools provide command-line functionality.
Please add it to Prompt so we can bulk (re)format SPs, UDFs, Triggers. Integration into the commit-path (we use SVN) would be ideal for standardized check-ins (Commits).
Can't recall whether a style is exportable... (License key awaited at new employer) Should be able to point to UNC location for the style to use.
We’re now testing some features related to the bulk formatting request.
We’d appreciate 5 minutes of your time to complete a quick survey to help us shape this work.
Thanks in advance everybody!
Brian Staton commented
Chiara, thank you for posting an update. In our team's case, we have multiple databases which were developed without SQL coding standards. We would like to be able to export the schema using SQL Compare (create a scripts folder), then run a command line tool to format all the files using a custom SQL Prompt style we've standardized on. Then we will update the databases using those scripts and update source control with the same scripts. That way going forward, all scripts and changes follow a standard and if we diff two files in source control, it's easy to see what's changed. If we format files as we change them, then it's not clear when you diff the files what changes are formatting changes and what changes are functional.
I will ask our sales rep about SQP Prompt For Teams. Please contact me if you have additional questions.
Kristoffer Lindström commented
2020 has now passed, do we have an update for this feature request?
By the looks of it, a lot of people are asking for it so would be nice to have a status update.
Very useful to have it for code review.
Would love to be able to format all files in a format and qualify object names in each one.
Jim Nguyen commented
A feature to update multiple files at once is a definite hole in SQL Prompt. Other tools provide this feature for free. It is one of the biggest wins for competing products when evaluating SQL Prompt.
@SAinCA_Mi9 If developers are running this from local dev machines then the SCA license doesn't apply, so that could be an option.
@David_Atkinson - thanks for the pointers, BUT, "To run code analysis as part of an automated process, such as continuous integration, a SQL Change Automation license is required." Thus, with everything running on SIX Dev databases concurrently, manually performing this is a non-starter, and purchasing another license, likewise.
@Tim - VERY SAD to hear this. I guess that 62 votes isn't enough of a crowd. Especially given that typical Uservoice participation is on the low side for any product, thus, at 62, you probably have a good representative sample for "NEEDED feature". We'll be watching, but breaths won't be held. FOUR YEARS will become FIVE YEARS by the time this even sees a PLAN, it seems... Oh well, disappointment is becoming the norm.
@Stephen - Alhought the SQL Code Guard SSMS add-in has been retired in favour of SQL Prompt, you can still use the SQL Code Guard command line to run SQL Prompt's code analysis rules. https://documentation.red-gate.com/scg/sql-code-analysis-documentation/code-analysis-for-sql-server-command-line
With SQL Code Guard no longer a viable product, and its functionality re rules is now within SQL Prompt, isn't this a compelling argument for BOTH "Format all Files" AND " Run Code Analysis using <this> set of Rules". For compliance, we will have to do this, and we are now, FOUR YEARS ON from my original post, at 6,792 SQL Modules. Utterly untenable as a manual task. Please, BUMP THIS UP THE FEATURE STACK A.S.A.P., with thanks.
<Please do this:D>
With command line and / or API batch formatting it will be possible to integrate a formatting step into GIT check in so all files checked into source control have the same formatting applied automatically, by policy.
</Please do this:D>
Patrick O'Brien commented
This is really a must feature for those of us who review code of others and from many groups and places. Attempting to compare old to new code when it is not formatted using the same options is almost impossible. Now multiply it times hundreds of files in a review. We currently use another product which does some of the job but does not have the all the functionality of SQL Prompt. Do we buy more SQL Prompt or the other product? It would be nice to know if this is a planned feature or not so we can make a decision.
David Penn commented
This is preventing me from pulling the trigger on the purchase. I can't do 2000+ files one at a time. Competitor has free tool that does this.
We need to format the Files in the Folder also.
Chris Tristan commented
We desperately need this feature! Being able to automate SQL formatting would make pull requests so much easier.
Toan Nguyen commented
Please add this feature!
Cody Konior commented
To be serious about source control code should be formatted on commit. This requires a basic command line interface.
Adam Wenger commented
Our team desperately needs this option as well. Could also be a command-line option as well
please please add this
This feature is a must, currently having to powershell through the objects, open then CTRL K+Y, CTRL B+Q which means opening up over 2000 objects 1 at a time.
Colin Harrison commented
I echo the "daunting" sentiment of the original post.
I'm currently working through 1000 files.
Ideally would prefer a command line option so that I could apply a git-hook to this task, but a single GUI operation would also be acceptable.
Actually opening each file before re-formatting then saving is extremely time-consuming.
Alternative products already do this!