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.
Bulk operations are not a current priority for the team, but they are on our roadmap to be reviewed in 2020. We’ll keep you all updated.
@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!
Joshua Ferguson commented
John Tunnicliffe commented
This would be a perfect addition to the SQL Prompt functionality!
Old code was infrequently schema qualified.
We need a simple "Perform Ctrl+B, Ctrl+Q on all .sql files in this folder tree"
Can you imagine manually doing that for 4500 procedures?
2 years have passed, and sadly no traction, despite ApexSQL Refactor having a command-line capability for free...
Matthias Vill commented
With the new formatting-style options this is even of more interest to us.
Harish Supe commented
Would really useful when you inherit large repository of SQL code from legacy systems/company merger/acquisition.