Skip to content
This repository
Browse code

Github Issue 85 (Pull Request) followup:

 - Removed "df" file, appears to have been a commit comment artifact from some Git client.
 - Added "Contributors" section to all modified files
 - Set option defaults in command-line tool - as an external interface, it needs defaults to be explicitly maintained.
 - Minor null-reference safety issues
 - Commented serialization code a little to avoid future confusion
 - Switched to using Object Initializers instead of many separate statements to set up the Options object; no good reason, just feels cleaner.
  • Loading branch information...
commit 5ff3dab118e8244485a40d4d8333b605f746492d 1 parent 8403209
Tao Klerks authored
4 CHANGELOG.md
Source Rendered
... ... @@ -1,6 +1,10 @@
1 1 
2 2 ## Poor Man's T-SQL Formatter change log
3 3
  4 +### Version 1.5.1
  5 +
  6 +* Github Issue #85: [Enhancement] Merged code cleanup changes by Timothy Klenke
  7 +
4 8 ### Version 1.4.4 (SSMS / Visual Studio Add-In only)
5 9
6 10 * Github Issue #79: [BugFix] Fix SSMS Add-In to work in unexpected languages [thanks Paulo Stradioti for the bug report]
32 PoorMansTSqlFormatterCmdLine/Program.cs
... ... @@ -1,7 +1,10 @@
1 1 /*
2 2 Poor Man's T-SQL Formatter - a small free Transact-SQL formatting
3 3 library for .Net 2.0, written in C#.
4   -Copyright (C) 2011 Tao Klerks
  4 +Copyright (C) 2011-2013 Tao Klerks
  5 +
  6 +Additional Contributors:
  7 + * Timothy Klenke, 2012
5 8
6 9 This program is free software: you can redistribute it and/or modify
7 10 it under the terms of the GNU Affero General Public License as published by
@@ -37,18 +40,35 @@ class Program
37 40
38 41 static int Main(string[] args)
39 42 {
40   - var options = new PoorMansTSqlFormatterLib.Formatters.TSqlStandardFormatterOptions();
41   - options.KeywordStandardization = true;
42   -
  43 + //formatter engine option defaults
  44 + var options = new PoorMansTSqlFormatterLib.Formatters.TSqlStandardFormatterOptions
  45 + {
  46 + KeywordStandardization = true,
  47 + IndentString = "\t",
  48 + SpacesPerTab = 4,
  49 + MaxLineWidth = 999,
  50 + TrailingCommas = false,
  51 + SpaceAfterExpandedComma = false,
  52 + ExpandBetweenConditions = true,
  53 + ExpandBooleanExpressions = true,
  54 + ExpandCaseStatements = true,
  55 + ExpandCommaLists = true,
  56 + BreakJoinOnSections = false,
  57 + UppercaseKeywords = true
  58 + };
  59 +
  60 + //bulk formatter options
43 61 bool allowParsingErrors = false;
44   - bool showUsageFriendly = false;
45   - bool showUsageError = false;
46 62 List<string> extensions = new List<string>();
47 63 bool backups = true;
48 64 bool recursiveSearch = false;
49 65 string outputFileOrFolder = null;
50 66 string uiLangCode = null;
51 67
  68 + //flow/tracking switches
  69 + bool showUsageFriendly = false;
  70 + bool showUsageError = false;
  71 +
52 72 OptionSet p = new OptionSet()
53 73 .Add("is|indentString=", delegate(string v) { options.IndentString = v; })
54 74 .Add("st|spacesPerTab=", delegate(string v) { options.SpacesPerTab = int.Parse(v); })
43 PoorMansTSqlFormatterDemo/MainForm.cs
... ... @@ -1,7 +1,10 @@
1 1 /*
2 2 Poor Man's T-SQL Formatter - a small free Transact-SQL formatting
3 3 library for .Net 2.0, written in C#.
4   -Copyright (C) 2011 Tao Klerks
  4 +Copyright (C) 2011-2013 Tao Klerks
  5 +
  6 +Additional Contributors:
  7 + * Timothy Klenke, 2012
5 8
6 9 This program is free software: you can redistribute it and/or modify
7 10 it under the terms of the GNU Affero General Public License as published by
@@ -160,30 +163,30 @@ private void SetFormatter()
160 163 PoorMansTSqlFormatterLib.Interfaces.ISqlTreeFormatter innerFormatter;
161 164 if (radio_Formatting_Standard.Checked)
162 165 {
163   - var options = new PoorMansTSqlFormatterLib.Formatters.TSqlStandardFormatterOptions();
164   - options.IndentString = txt_Indent.Text;
165   - options.SpacesPerTab = int.Parse(txt_IndentWidth.Text);
166   - options.MaxLineWidth = int.Parse(txt_MaxWidth.Text);
167   - options.ExpandCommaLists = chk_ExpandCommaLists.Checked;
168   - options.TrailingCommas = chk_TrailingCommas.Checked;
169   - options.SpaceAfterExpandedComma = chk_SpaceAfterComma.Checked;
170   - options.ExpandBooleanExpressions = chk_ExpandBooleanExpressions.Checked;
171   - options.ExpandCaseStatements = chk_ExpandCaseStatements.Checked;
172   - options.ExpandBetweenConditions = chk_ExpandBetweenConditions.Checked;
173   - options.BreakJoinOnSections = chk_BreakJoinOnSections.Checked;
174   - options.UppercaseKeywords = chk_UppercaseKeywords.Checked;
175   - options.HTMLColoring = chk_Coloring.Checked;
176   - options.KeywordStandardization = chk_EnableKeywordStandardization.Checked;
177   -
178   - innerFormatter = new PoorMansTSqlFormatterLib.Formatters.TSqlStandardFormatter(options);
  166 + innerFormatter = new PoorMansTSqlFormatterLib.Formatters.TSqlStandardFormatter(new PoorMansTSqlFormatterLib.Formatters.TSqlStandardFormatterOptions
  167 + {
  168 + IndentString = txt_Indent.Text,
  169 + SpacesPerTab = int.Parse(txt_IndentWidth.Text),
  170 + MaxLineWidth = int.Parse(txt_MaxWidth.Text),
  171 + ExpandCommaLists = chk_ExpandCommaLists.Checked,
  172 + TrailingCommas = chk_TrailingCommas.Checked,
  173 + SpaceAfterExpandedComma = chk_SpaceAfterComma.Checked,
  174 + ExpandBooleanExpressions = chk_ExpandBooleanExpressions.Checked,
  175 + ExpandCaseStatements = chk_ExpandCaseStatements.Checked,
  176 + ExpandBetweenConditions = chk_ExpandBetweenConditions.Checked,
  177 + BreakJoinOnSections = chk_BreakJoinOnSections.Checked,
  178 + UppercaseKeywords = chk_UppercaseKeywords.Checked,
  179 + HTMLColoring = chk_Coloring.Checked,
  180 + KeywordStandardization = chk_EnableKeywordStandardization.Checked
  181 + });
179 182 }
180 183 else if (radio_Formatting_Identity.Checked)
181 184 innerFormatter = new PoorMansTSqlFormatterLib.Formatters.TSqlIdentityFormatter(chk_IdentityColoring.Checked);
182 185 else
183 186 innerFormatter = new PoorMansTSqlFormatterLib.Formatters.TSqlObfuscatingFormatter(
184   - chk_RandomizeKeywordCase.Checked,
185   - chk_RandomizeColor.Checked,
186   - chk_RandomizeLineLength.Checked,
  187 + chk_RandomizeKeywordCase.Checked,
  188 + chk_RandomizeColor.Checked,
  189 + chk_RandomizeLineLength.Checked,
187 190 chk_PreserveComments.Checked,
188 191 chk_KeywordSubstitution.Checked
189 192 );
52 PoorMansTSqlFormatterLib/Formatters/TSqlStandardFormatter.cs
... ... @@ -1,8 +1,11 @@
1 1 /*
2 2 Poor Man's T-SQL Formatter - a small free Transact-SQL formatting
3 3 library for .Net 2.0, written in C#.
4   -Copyright (C) 2011 Tao Klerks
  4 +Copyright (C) 2011-2013 Tao Klerks
5 5
  6 +Additional Contributors:
  7 + * Timothy Klenke, 2012
  8 +
6 9 This program is free software: you can redistribute it and/or modify
7 10 it under the terms of the GNU Affero General Public License as published by
8 11 the Free Software Foundation, either version 3 of the License, or
@@ -16,8 +19,8 @@
16 19 You should have received a copy of the GNU Affero General Public License
17 20 along with this program. If not, see <http://www.gnu.org/licenses/>.
18 21
19   -*/
20   -
  22 +*/
  23 +
21 24 using System;
22 25 using System.Collections.Generic;
23 26 using System.Text;
@@ -34,8 +37,12 @@ public class TSqlStandardFormatter : Interfaces.ISqlTreeFormatter
34 37 public TSqlStandardFormatter() : this(new TSqlStandardFormatterOptions()) { }
35 38
36 39 public TSqlStandardFormatter(TSqlStandardFormatterOptions options)
37   - {
  40 + {
  41 + if (options == null)
  42 + throw new ArgumentNullException("options");
  43 +
38 44 Options = options;
  45 +
39 46 if (options.KeywordStandardization)
40 47 KeywordMapping = StandardKeywordRemapping.Instance;
41 48 ErrorOutputPrefix = Interfaces.MessagingConstants.FormatErrorDefaultMessage + Environment.NewLine;
@@ -43,31 +50,30 @@ public TSqlStandardFormatter(TSqlStandardFormatterOptions options)
43 50
44 51 [Obsolete("Use the constructor with the TSqlStandardFormatterOptions parameter")]
45 52 public TSqlStandardFormatter(string indentString, int spacesPerTab, int maxLineWidth, bool expandCommaLists, bool trailingCommas, bool spaceAfterExpandedComma, bool expandBooleanExpressions, bool expandCaseStatements, bool expandBetweenConditions, bool breakJoinOnSections, bool uppercaseKeywords, bool htmlColoring, bool keywordStandardization)
46   - {
47   - var options = new TSqlStandardFormatterOptions();
48   -
49   - options.IndentString = indentString;
50   - options.SpacesPerTab = spacesPerTab;
51   - options.MaxLineWidth = maxLineWidth;
52   - options.ExpandCommaLists = expandCommaLists;
53   - options.TrailingCommas = trailingCommas;
54   - options.SpaceAfterExpandedComma = spaceAfterExpandedComma;
55   - options.ExpandBooleanExpressions = expandBooleanExpressions;
56   - options.ExpandBetweenConditions = expandBetweenConditions;
57   - options.ExpandCaseStatements = expandCaseStatements;
58   - options.UppercaseKeywords = uppercaseKeywords;
59   - options.BreakJoinOnSections = breakJoinOnSections;
60   - options.HTMLColoring = htmlColoring;
61   - options.KeywordStandardization = keywordStandardization;
62   -
63   - Options = options;
  53 + {
  54 + Options = new TSqlStandardFormatterOptions
  55 + {
  56 + IndentString = indentString,
  57 + SpacesPerTab = spacesPerTab,
  58 + MaxLineWidth = maxLineWidth,
  59 + ExpandCommaLists = expandCommaLists,
  60 + TrailingCommas = trailingCommas,
  61 + SpaceAfterExpandedComma = spaceAfterExpandedComma,
  62 + ExpandBooleanExpressions = expandBooleanExpressions,
  63 + ExpandBetweenConditions = expandBetweenConditions,
  64 + ExpandCaseStatements = expandCaseStatements,
  65 + UppercaseKeywords = uppercaseKeywords,
  66 + BreakJoinOnSections = breakJoinOnSections,
  67 + HTMLColoring = htmlColoring,
  68 + KeywordStandardization = keywordStandardization
  69 + };
64 70
65 71 if (keywordStandardization)
66 72 KeywordMapping = StandardKeywordRemapping.Instance;
67 73 ErrorOutputPrefix = Interfaces.MessagingConstants.FormatErrorDefaultMessage + Environment.NewLine;
68 74 }
69 75
70   - public TSqlStandardFormatterOptions Options { get; set; }
  76 + public TSqlStandardFormatterOptions Options { get; private set; }
71 77
72 78 public IDictionary<string, string> KeywordMapping = new Dictionary<string, string>();
73 79
64 PoorMansTSqlFormatterLib/Formatters/TSqlStandardFormatterOptions.cs
@@ -3,6 +3,9 @@
3 3 library for .Net 2.0, written in C#.
4 4 Copyright (C) 2011 Tao Klerks
5 5
  6 +Additional Contributors:
  7 + * Timothy Klenke, 2012
  8 +
6 9 This program is free software: you can redistribute it and/or modify
7 10 it under the terms of the GNU Affero General Public License as published by
8 11 the Free Software Foundation, either version 3 of the License, or
@@ -16,14 +19,10 @@
16 19 You should have received a copy of the GNU Affero General Public License
17 20 along with this program. If not, see <http://www.gnu.org/licenses/>.
18 21
19   -*/
20   -
  22 +*/
  23 +
21 24 using System;
22 25 using System.Collections.Generic;
23   -using System.Text;
24   -using System.Text.RegularExpressions;
25   -using System.Xml;
26   -using PoorMansTSqlFormatterLib.Interfaces;
27 26 using System.Linq;
28 27
29 28 namespace PoorMansTSqlFormatterLib.Formatters
@@ -45,12 +44,18 @@ public TSqlStandardFormatterOptions()
45 44 BreakJoinOnSections = false;
46 45 HTMLColoring = false;
47 46 KeywordStandardization = false;
48   - }
  47 + }
  48 +
  49 + //Doesn't particularly need to be lazy-loaded, and doesn't need to be threadsafe.
  50 + private static readonly TSqlStandardFormatterOptions _defaultOptions = new TSqlStandardFormatterOptions();
49 51
50 52 public TSqlStandardFormatterOptions(string serializedString) : this() {
51 53
52   - if (string.IsNullOrEmpty(serializedString)) return;
53   -
  54 + if (string.IsNullOrEmpty(serializedString))
  55 + return;
  56 +
  57 + //PLEASE NOTE: This is not reusable/general-purpose key-value serialization: it does not handle commas in data.
  58 + // For now, this is used in the Test library only.
54 59 foreach (string kvp in serializedString.Split(','))
55 60 {
56 61 string[] splitPair = kvp.Split('=');
@@ -73,26 +78,27 @@ public TSqlStandardFormatterOptions()
73 78 else throw new ArgumentException("Unknown option: " + key);
74 79 }
75 80
76   - }
77   -
78   - public string ToSerializedString() {
79   - var overrides = new Dictionary<string, string>();
80   -
81   - var defaultOptions = new TSqlStandardFormatterOptions();
82   -
83   - if (IndentString != defaultOptions.IndentString) overrides.Add("IndentString", IndentString);
84   - if (SpacesPerTab != defaultOptions.SpacesPerTab) overrides.Add("SpacesPerTab", SpacesPerTab.ToString());
85   - if (MaxLineWidth != defaultOptions.MaxLineWidth) overrides.Add("MaxLineWidth", MaxLineWidth.ToString());
86   - if (ExpandCommaLists != defaultOptions.ExpandCommaLists) overrides.Add("ExpandCommaLists", ExpandCommaLists.ToString());
87   - if (TrailingCommas != defaultOptions.TrailingCommas) overrides.Add("TrailingCommas", TrailingCommas.ToString());
88   - if (SpaceAfterExpandedComma != defaultOptions.SpaceAfterExpandedComma) overrides.Add("SpaceAfterExpandedComma", SpaceAfterExpandedComma.ToString());
89   - if (ExpandBooleanExpressions != defaultOptions.ExpandBooleanExpressions) overrides.Add("ExpandBooleanExpressions", ExpandBooleanExpressions.ToString());
90   - if (ExpandBetweenConditions != defaultOptions.ExpandBetweenConditions) overrides.Add("ExpandBetweenConditions", ExpandBetweenConditions.ToString());
91   - if (ExpandCaseStatements != defaultOptions.ExpandCaseStatements) overrides.Add("ExpandCaseStatements", ExpandCaseStatements.ToString());
92   - if (UppercaseKeywords != defaultOptions.UppercaseKeywords) overrides.Add("UppercaseKeywords", UppercaseKeywords.ToString());
93   - if (BreakJoinOnSections != defaultOptions.BreakJoinOnSections) overrides.Add("BreakJoinOnSections", BreakJoinOnSections.ToString());
94   - if (HTMLColoring != defaultOptions.HTMLColoring) overrides.Add("HTMLColoring", HTMLColoring.ToString());
95   - if (KeywordStandardization != defaultOptions.KeywordStandardization) overrides.Add("KeywordStandardization", KeywordStandardization.ToString());
  81 + }
  82 +
  83 + //PLEASE NOTE: This is not reusable/general-purpose key-value serialization: it does not handle commas in data.
  84 + // For now, this is used in the Test library only.
  85 + public string ToSerializedString()
  86 + {
  87 + var overrides = new Dictionary<string, string>();
  88 +
  89 + if (IndentString != _defaultOptions.IndentString) overrides.Add("IndentString", IndentString);
  90 + if (SpacesPerTab != _defaultOptions.SpacesPerTab) overrides.Add("SpacesPerTab", SpacesPerTab.ToString());
  91 + if (MaxLineWidth != _defaultOptions.MaxLineWidth) overrides.Add("MaxLineWidth", MaxLineWidth.ToString());
  92 + if (ExpandCommaLists != _defaultOptions.ExpandCommaLists) overrides.Add("ExpandCommaLists", ExpandCommaLists.ToString());
  93 + if (TrailingCommas != _defaultOptions.TrailingCommas) overrides.Add("TrailingCommas", TrailingCommas.ToString());
  94 + if (SpaceAfterExpandedComma != _defaultOptions.SpaceAfterExpandedComma) overrides.Add("SpaceAfterExpandedComma", SpaceAfterExpandedComma.ToString());
  95 + if (ExpandBooleanExpressions != _defaultOptions.ExpandBooleanExpressions) overrides.Add("ExpandBooleanExpressions", ExpandBooleanExpressions.ToString());
  96 + if (ExpandBetweenConditions != _defaultOptions.ExpandBetweenConditions) overrides.Add("ExpandBetweenConditions", ExpandBetweenConditions.ToString());
  97 + if (ExpandCaseStatements != _defaultOptions.ExpandCaseStatements) overrides.Add("ExpandCaseStatements", ExpandCaseStatements.ToString());
  98 + if (UppercaseKeywords != _defaultOptions.UppercaseKeywords) overrides.Add("UppercaseKeywords", UppercaseKeywords.ToString());
  99 + if (BreakJoinOnSections != _defaultOptions.BreakJoinOnSections) overrides.Add("BreakJoinOnSections", BreakJoinOnSections.ToString());
  100 + if (HTMLColoring != _defaultOptions.HTMLColoring) overrides.Add("HTMLColoring", HTMLColoring.ToString());
  101 + if (KeywordStandardization != _defaultOptions.KeywordStandardization) overrides.Add("KeywordStandardization", KeywordStandardization.ToString());
96 102
97 103 if (overrides.Count == 0) return string.Empty;
98 104 return string.Join(",", overrides.Select((kvp) => kvp.Key + "=" + kvp.Value).ToArray());
35 PoorMansTSqlFormatterPluginShared/Utils.cs
... ... @@ -1,7 +1,10 @@
1 1 /*
2 2 Poor Man's T-SQL Formatter - a small free Transact-SQL formatting
3 3 library for .Net 2.0, written in C#.
4   -Copyright (C) 2011 Tao Klerks
  4 +Copyright (C) 2011-2013 Tao Klerks
  5 +
  6 +Additional Contributors:
  7 + * Timothy Klenke, 2012
5 8
6 9 This program is free software: you can redistribute it and/or modify
7 10 it under the terms of the GNU Affero General Public License as published by
@@ -28,22 +31,22 @@ public static class Utils
28 31 {
29 32 public static PoorMansTSqlFormatterLib.SqlFormattingManager GetFormattingManager(ISqlSettings settings)
30 33 {
31   - var options = new PoorMansTSqlFormatterLib.Formatters.TSqlStandardFormatterOptions();
32   - options.IndentString = settings.IndentString;
33   - options.SpacesPerTab = settings.SpacesPerTab;
34   - options.MaxLineWidth = settings.MaxLineWidth;
35   - options.ExpandCommaLists = settings.ExpandCommaLists;
36   - options.TrailingCommas = settings.TrailingCommas;
37   - options.SpaceAfterExpandedComma = settings.SpaceAfterExpandedComma;
38   - options.ExpandBooleanExpressions = settings.ExpandBooleanExpressions;
39   - options.ExpandCaseStatements = settings.ExpandCaseStatements;
40   - options.ExpandBetweenConditions = settings.ExpandBetweenConditions;
41   - options.BreakJoinOnSections = settings.BreakJoinOnSections;
42   - options.UppercaseKeywords = settings.UppercaseKeywords;
43   - options.KeywordStandardization = settings.KeywordStandardization;
  34 + var formatter = new PoorMansTSqlFormatterLib.Formatters.TSqlStandardFormatter(new PoorMansTSqlFormatterLib.Formatters.TSqlStandardFormatterOptions
  35 + {
  36 + IndentString = settings.IndentString,
  37 + SpacesPerTab = settings.SpacesPerTab,
  38 + MaxLineWidth = settings.MaxLineWidth,
  39 + ExpandCommaLists = settings.ExpandCommaLists,
  40 + TrailingCommas = settings.TrailingCommas,
  41 + SpaceAfterExpandedComma = settings.SpaceAfterExpandedComma,
  42 + ExpandBooleanExpressions = settings.ExpandBooleanExpressions,
  43 + ExpandCaseStatements = settings.ExpandCaseStatements,
  44 + ExpandBetweenConditions = settings.ExpandBetweenConditions,
  45 + BreakJoinOnSections = settings.BreakJoinOnSections,
  46 + UppercaseKeywords = settings.UppercaseKeywords,
  47 + KeywordStandardization = settings.KeywordStandardization
  48 + });
44 49
45   - var formatter = new PoorMansTSqlFormatterLib.Formatters.TSqlStandardFormatter(options);
46   -
47 50 ResourceManager _generalResourceManager = new ResourceManager("PoorMansTSqlFormatterPluginShared.GeneralLanguageContent", Assembly.GetExecutingAssembly());
48 51 formatter.ErrorOutputPrefix = _generalResourceManager.GetString("ParseErrorWarningPrefix") + System.Environment.NewLine;
49 52 var formattingManager = new PoorMansTSqlFormatterLib.SqlFormattingManager(formatter);
324 PoorMansTSqlFormatterTest/PoorMansTSqlFormatterTests.csproj
... ... @@ -1,169 +1,169 @@
1   -<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2   - <PropertyGroup>
3   - <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
4   - <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
5   - <ProductVersion>9.0.30729</ProductVersion>
6   - <SchemaVersion>2.0</SchemaVersion>
7   - <ProjectGuid>{FBBF4CE8-C24D-4A43-9D8C-B54B2E7E3FB7}</ProjectGuid>
8   - <OutputType>Exe</OutputType>
9   - <AppDesignerFolder>Properties</AppDesignerFolder>
10   - <RootNamespace>PoorMansTSqlFormatterTests</RootNamespace>
11   - <AssemblyName>PoorMansTSqlFormatterTests</AssemblyName>
12   - <TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
13   - <FileAlignment>512</FileAlignment>
14   - <ProjectTypeGuids>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
15   - <StartupObject>PoorMansTSqlFormatterTests.Program</StartupObject>
16   - </PropertyGroup>
17   - <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
18   - <DebugSymbols>true</DebugSymbols>
19   - <DebugType>full</DebugType>
20   - <Optimize>false</Optimize>
21   - <OutputPath>bin\Debug\</OutputPath>
22   - <DefineConstants>DEBUG;TRACE</DefineConstants>
23   - <ErrorReport>prompt</ErrorReport>
24   - <WarningLevel>4</WarningLevel>
25   - </PropertyGroup>
26   - <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
27   - <DebugType>pdbonly</DebugType>
28   - <Optimize>true</Optimize>
29   - <OutputPath>bin\Release\</OutputPath>
30   - <DefineConstants>TRACE</DefineConstants>
31   - <ErrorReport>prompt</ErrorReport>
32   - <WarningLevel>4</WarningLevel>
33   - </PropertyGroup>
34   - <ItemGroup>
35   - <Reference Include="nunit-gui-runner, Version=2.5.10.11092, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">
36   - <SpecificVersion>False</SpecificVersion>
37   - <HintPath>References\NUnit\nunit-gui-runner.dll</HintPath>
38   - </Reference>
39   - <Reference Include="nunit.core, Version=2.5.10.11092, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">
40   - <SpecificVersion>False</SpecificVersion>
41   - <HintPath>References\NUnit\nunit.core.dll</HintPath>
42   - </Reference>
43   - <Reference Include="nunit.core.interfaces, Version=2.5.10.11092, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">
44   - <SpecificVersion>False</SpecificVersion>
45   - <HintPath>References\NUnit\nunit.core.interfaces.dll</HintPath>
46   - </Reference>
47   - <Reference Include="nunit.framework, Version=2.5.10.11092, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">
48   - <SpecificVersion>False</SpecificVersion>
49   - <HintPath>References\NUnit\nunit.framework.dll</HintPath>
50   - </Reference>
51   - <Reference Include="nunit.uiexception, Version=2.5.10.11092, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">
52   - <SpecificVersion>False</SpecificVersion>
53   - <HintPath>References\NUnit\nunit.uiexception.dll</HintPath>
54   - </Reference>
55   - <Reference Include="nunit.uikit, Version=2.5.10.11092, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">
56   - <SpecificVersion>False</SpecificVersion>
57   - <HintPath>References\NUnit\nunit.uikit.dll</HintPath>
58   - </Reference>
59   - <Reference Include="nunit.util, Version=2.5.10.11092, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">
60   - <SpecificVersion>False</SpecificVersion>
61   - <HintPath>References\NUnit\nunit.util.dll</HintPath>
62   - </Reference>
63   - <Reference Include="System" />
64   - <Reference Include="System.Data" />
65   - <Reference Include="System.XML" />
66   - </ItemGroup>
67   - <ItemGroup>
68   - <Compile Include="ParserTests.cs" />
69   - <Compile Include="Program.cs" />
70   - <Compile Include="Properties\AssemblyInfo.cs" />
71   - <Compile Include="TSqlIdentityFormatterTests.cs" />
72   - <Compile Include="TSqlObfuscatingFormatterTests.cs" />
73   - <Compile Include="TSqlStandardFormatterOptionsTests.cs" />
74   - <Compile Include="TSqlStandardFormatterTests.cs" />
75   - <Compile Include="Utils.cs" />
76   - </ItemGroup>
77   - <ItemGroup>
78   - <Content Include="Data\InputSql\10_SetOperators_Union.txt" />
79   - <Content Include="Data\InputSql\11_MSAccess_Pasted.txt" />
80   - <Content Include="Data\InputSql\12_NestedIfElse.txt" />
81   - <Content Include="Data\InputSql\14_CommentPositioning.txt" />
82   - <Content Include="Data\InputSql\15_NestedComments.txt" />
83   - <Content Include="Data\InputSql\16_CurrencyParsingStrangeness.txt" />
84   - <Content Include="Data\InputSql\17_Cursors.txt" />
85   - <Content Include="Data\InputSql\18_BulkInsert.txt" />
86   - <Content Include="Data\InputSql\01_SimpleTypes_StrangeRules.txt" />
87   - <Content Include="Data\InputSql\20_Joins.txt" />
88   - <Content Include="Data\InputSql\02_Random_INVALID.txt" />
89   - <Content Include="Data\InputSql\03_SimpleSelect_MS.txt" />
90   - <Content Include="Data\InputSql\04_MiscProceduralSample_Unstructured.txt" />
91   - <Content Include="Data\InputSql\05_ComplexDDL.txt" />
92   - <Content Include="Data\InputSql\06_CTE_Sample_MS.txt" />
93   - <Content Include="Data\InputSql\07_ServerTakeoverSample_Brent_Ozar.txt" />
94   - <Content Include="Data\InputSql\08_ComplexBackupDDL_Ola_Hallengren.txt" />
95   - <Content Include="Data\InputSql\09_Xml_Selection_Function.txt" />
96   - <Content Include="Data\InputSql\19_DMLTrigger.txt" />
97   - <Content Include="Data\InputSql\13_NestedBooleanExpressions.txt" />
98   - <Content Include="Data\InputSql\23_ReparsingInconsistency.txt" />
99   - <Content Include="Data\InputSql\21_DDL_Permissions.txt" />
100   - <Content Include="Data\InputSql\22_DDL_WithClauses.txt" />
101   - <Content Include="Data\InputSql\24_InsertsAndOutputs.txt" />
102   - <Content Include="Data\InputSql\25_Merges.txt" />
103   - <Content Include="Data\InputSql\26_DataTypesAndSynonyms.txt" />
104   - <Content Include="Data\InputSql\27_OtherSqlFlavourSupport.txt" />
105   - <Content Include="Data\ParsedSql\01_SimpleTypes_StrangeRules.txt" />
106   - <Content Include="Data\ParsedSql\03_SimpleSelect_MS.txt" />
107   - <Content Include="Data\ParsedSql\04_MiscProceduralSample_Unstructured.txt" />
108   - <Content Include="Data\ParsedSql\05_ComplexDDL.txt" />
109   - <Content Include="Data\ParsedSql\06_CTE_Sample_MS.txt" />
110   - <Content Include="Data\ParsedSql\07_ServerTakeoverSample_Brent_Ozar.txt" />
111   - <Content Include="Data\ParsedSql\08_ComplexBackupDDL_Ola_Hallengren.txt" />
112   - <Content Include="Data\ParsedSql\10_SetOperators_Union.txt" />
113   - <Content Include="Data\ParsedSql\12_NestedIfElse.txt" />
114   - <Content Include="Data\ParsedSql\14_CommentPositioning.txt" />
115   - <Content Include="Data\ParsedSql\15_NestedComments.txt" />
116   - <Content Include="Data\ParsedSql\16_CurrencyParsingStrangeness.txt" />
117   - <Content Include="Data\ParsedSql\17_Cursors.txt" />
118   - <Content Include="Data\ParsedSql\19_DMLTrigger.txt" />
119   - <Content Include="Data\ParsedSql\20_Joins.txt" />
120   - <Content Include="Data\ParsedSql\21_DDL_Permissions.txt" />
121   - <Content Include="Data\ParsedSql\22_DDL_WithClauses.txt" />
122   - <Content Include="Data\ParsedSql\24_InsertsAndOutputs.txt" />
123   - <Content Include="Data\ParsedSql\25_Merges.txt" />
124   - <Content Include="Data\ParsedSql\26_DataTypesAndSynonyms.txt" />
125   - <Content Include="Data\ParsedSql\11_MSAccess_Pasted.txt" />
126   - <Content Include="Data\ParsedSql\27_OtherSqlFlavourSupport.txt" />
127   - <Content Include="Data\StandardFormatSql\01_SimpleTypes_StrangeRules.txt" />
128   - <Content Include="Data\StandardFormatSql\03_SimpleSelect_MS.txt" />
129   - <Content Include="Data\StandardFormatSql\04_MiscProceduralSample_Unstructured.txt" />
130   - <Content Include="Data\StandardFormatSql\05_ComplexDDL.txt" />
131   - <Content Include="Data\StandardFormatSql\06_CTE_Sample_MS.txt" />
132   - <Content Include="Data\StandardFormatSql\07_ServerTakeoverSample_Brent_Ozar.txt" />
133   - <Content Include="Data\StandardFormatSql\08_ComplexBackupDDL_Ola_Hallengren%28TrailingCommas=true,IndentString= ,BreakJoinOnSections=true%29.txt" />
134   - <Content Include="Data\StandardFormatSql\08_ComplexBackupDDL_Ola_Hallengren.txt" />
135   - <Content Include="Data\StandardFormatSql\10_SetOperators_Union.txt" />
136   - <Content Include="Data\StandardFormatSql\11_MSAccess_Pasted.txt" />
137   - <Content Include="Data\StandardFormatSql\12_NestedIfElse.txt" />
138   - <Content Include="Data\StandardFormatSql\14_CommentPositioning.txt" />
139   - <Content Include="Data\StandardFormatSql\15_NestedComments.txt" />
140   - <Content Include="Data\StandardFormatSql\16_CurrencyParsingStrangeness.txt" />
141   - <Content Include="Data\StandardFormatSql\17_Cursors.txt" />
142   - <Content Include="Data\StandardFormatSql\19_DMLTrigger.txt" />
143   - <Content Include="Data\StandardFormatSql\20_Joins.txt" />
144   - <Content Include="Data\StandardFormatSql\21_DDL_Permissions.txt" />
145   - <Content Include="Data\StandardFormatSql\22_DDL_WithClauses.txt" />
146   - <Content Include="Data\StandardFormatSql\24_InsertsAndOutputs.txt" />
147   - <Content Include="Data\StandardFormatSql\25_Merges.txt" />
148   - <Content Include="Data\StandardFormatSql\26_DataTypesAndSynonyms.txt" />
149   - <Content Include="Data\StandardFormatSql\04_MiscProceduralSample_Unstructured%28ExpandCommaLists=false,MaxLineWidth=60,SpacesPerTab=8%29.txt" />
150   - <Content Include="Data\StandardFormatSql\07_ServerTakeoverSample_Brent_Ozar%28SpaceAfterExpandedComma=true,ExpandBooleanExpressions=false,ExpandBetweenConditions=false,ExpandCaseStatements=false%29.txt" />
151   - <Content Include="Data\StandardFormatSql\06_CTE_Sample_MS%28UppercaseKeywords=false%29.txt" />
152   - <Content Include="Data\StandardFormatSql\14_CommentPositioning%28TrailingCommas=True%29.txt" />
153   - <Content Include="Data\StandardFormatSql\27_OtherSqlFlavourSupport.txt" />
154   - </ItemGroup>
155   - <ItemGroup>
156   - <ProjectReference Include="..\PoorMansTSqlFormatterLib\PoorMansTSqlFormatterLib.csproj">
157   - <Project>{ADBDFDCA-CAB6-4569-9151-0BD42E65B400}</Project>
158   - <Name>PoorMansTSqlFormatterLib</Name>
159   - </ProjectReference>
160   - </ItemGroup>
161   - <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
  1 +<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  2 + <PropertyGroup>
  3 + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
  4 + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
  5 + <ProductVersion>9.0.30729</ProductVersion>
  6 + <SchemaVersion>2.0</SchemaVersion>
  7 + <ProjectGuid>{FBBF4CE8-C24D-4A43-9D8C-B54B2E7E3FB7}</ProjectGuid>
  8 + <OutputType>Exe</OutputType>
  9 + <AppDesignerFolder>Properties</AppDesignerFolder>
  10 + <RootNamespace>PoorMansTSqlFormatterTests</RootNamespace>
  11 + <AssemblyName>PoorMansTSqlFormatterTests</AssemblyName>
  12 + <TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
  13 + <FileAlignment>512</FileAlignment>
  14 + <ProjectTypeGuids>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
  15 + <StartupObject>PoorMansTSqlFormatterTests.Program</StartupObject>
  16 + </PropertyGroup>
  17 + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
  18 + <DebugSymbols>true</DebugSymbols>
  19 + <DebugType>full</DebugType>
  20 + <Optimize>false</Optimize>
  21 + <OutputPath>bin\Debug\</OutputPath>
  22 + <DefineConstants>DEBUG;TRACE</DefineConstants>
  23 + <ErrorReport>prompt</ErrorReport>
  24 + <WarningLevel>4</WarningLevel>
  25 + </PropertyGroup>
  26 + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
  27 + <DebugType>pdbonly</DebugType>
  28 + <Optimize>true</Optimize>
  29 + <OutputPath>bin\Release\</OutputPath>
  30 + <DefineConstants>TRACE</DefineConstants>
  31 + <ErrorReport>prompt</ErrorReport>
  32 + <WarningLevel>4</WarningLevel>
  33 + </PropertyGroup>
  34 + <ItemGroup>
  35 + <Reference Include="nunit-gui-runner, Version=2.5.10.11092, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">
  36 + <SpecificVersion>False</SpecificVersion>
  37 + <HintPath>References\NUnit\nunit-gui-runner.dll</HintPath>
  38 + </Reference>
  39 + <Reference Include="nunit.core, Version=2.5.10.11092, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">
  40 + <SpecificVersion>False</SpecificVersion>
  41 + <HintPath>References\NUnit\nunit.core.dll</HintPath>
  42 + </Reference>
  43 + <Reference Include="nunit.core.interfaces, Version=2.5.10.11092, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">
  44 + <SpecificVersion>False</SpecificVersion>
  45 + <HintPath>References\NUnit\nunit.core.interfaces.dll</HintPath>
  46 + </Reference>
  47 + <Reference Include="nunit.framework, Version=2.5.10.11092, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">
  48 + <SpecificVersion>False</SpecificVersion>
  49 + <HintPath>References\NUnit\nunit.framework.dll</HintPath>
  50 + </Reference>
  51 + <Reference Include="nunit.uiexception, Version=2.5.10.11092, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">
  52 + <SpecificVersion>False</SpecificVersion>
  53 + <HintPath>References\NUnit\nunit.uiexception.dll</HintPath>
  54 + </Reference>
  55 + <Reference Include="nunit.uikit, Version=2.5.10.11092, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">
  56 + <SpecificVersion>False</SpecificVersion>
  57 + <HintPath>References\NUnit\nunit.uikit.dll</HintPath>
  58 + </Reference>
  59 + <Reference Include="nunit.util, Version=2.5.10.11092, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">
  60 + <SpecificVersion>False</SpecificVersion>
  61 + <HintPath>References\NUnit\nunit.util.dll</HintPath>
  62 + </Reference>
  63 + <Reference Include="System" />
  64 + <Reference Include="System.Data" />
  65 + <Reference Include="System.XML" />
  66 + </ItemGroup>
  67 + <ItemGroup>
  68 + <Compile Include="ParserTests.cs" />
  69 + <Compile Include="Program.cs" />
  70 + <Compile Include="Properties\AssemblyInfo.cs" />
  71 + <Compile Include="TSqlIdentityFormatterTests.cs" />
  72 + <Compile Include="TSqlObfuscatingFormatterTests.cs" />
  73 + <Compile Include="TSqlStandardFormatterOptionsTests.cs" />
  74 + <Compile Include="TSqlStandardFormatterTests.cs" />
  75 + <Compile Include="Utils.cs" />
  76 + </ItemGroup>
  77 + <ItemGroup>
  78 + <Content Include="Data\InputSql\10_SetOperators_Union.txt" />
  79 + <Content Include="Data\InputSql\11_MSAccess_Pasted.txt" />
  80 + <Content Include="Data\InputSql\12_NestedIfElse.txt" />
  81 + <Content Include="Data\InputSql\14_CommentPositioning.txt" />
  82 + <Content Include="Data\InputSql\15_NestedComments.txt" />
  83 + <Content Include="Data\InputSql\16_CurrencyParsingStrangeness.txt" />
  84 + <Content Include="Data\InputSql\17_Cursors.txt" />
  85 + <Content Include="Data\InputSql\18_BulkInsert.txt" />
  86 + <Content Include="Data\InputSql\01_SimpleTypes_StrangeRules.txt" />
  87 + <Content Include="Data\InputSql\20_Joins.txt" />
  88 + <Content Include="Data\InputSql\02_Random_INVALID.txt" />
  89 + <Content Include="Data\InputSql\03_SimpleSelect_MS.txt" />
  90 + <Content Include="Data\InputSql\04_MiscProceduralSample_Unstructured.txt" />
  91 + <Content Include="Data\InputSql\05_ComplexDDL.txt" />
  92 + <Content Include="Data\InputSql\06_CTE_Sample_MS.txt" />
  93 + <Content Include="Data\InputSql\07_ServerTakeoverSample_Brent_Ozar.txt" />
  94 + <Content Include="Data\InputSql\08_ComplexBackupDDL_Ola_Hallengren.txt" />
  95 + <Content Include="Data\InputSql\09_Xml_Selection_Function.txt" />
  96 + <Content Include="Data\InputSql\19_DMLTrigger.txt" />
  97 + <Content Include="Data\InputSql\13_NestedBooleanExpressions.txt" />
  98 + <Content Include="Data\InputSql\23_ReparsingInconsistency.txt" />
  99 + <Content Include="Data\InputSql\21_DDL_Permissions.txt" />
  100 + <Content Include="Data\InputSql\22_DDL_WithClauses.txt" />
  101 + <Content Include="Data\InputSql\24_InsertsAndOutputs.txt" />
  102 + <Content Include="Data\InputSql\25_Merges.txt" />
  103 + <Content Include="Data\InputSql\26_DataTypesAndSynonyms.txt" />
  104 + <Content Include="Data\InputSql\27_OtherSqlFlavourSupport.txt" />
  105 + <Content Include="Data\ParsedSql\01_SimpleTypes_StrangeRules.txt" />
  106 + <Content Include="Data\ParsedSql\03_SimpleSelect_MS.txt" />
  107 + <Content Include="Data\ParsedSql\04_MiscProceduralSample_Unstructured.txt" />
  108 + <Content Include="Data\ParsedSql\05_ComplexDDL.txt" />
  109 + <Content Include="Data\ParsedSql\06_CTE_Sample_MS.txt" />
  110 + <Content Include="Data\ParsedSql\07_ServerTakeoverSample_Brent_Ozar.txt" />
  111 + <Content Include="Data\ParsedSql\08_ComplexBackupDDL_Ola_Hallengren.txt" />
  112 + <Content Include="Data\ParsedSql\10_SetOperators_Union.txt" />
  113 + <Content Include="Data\ParsedSql\12_NestedIfElse.txt" />
  114 + <Content Include="Data\ParsedSql\14_CommentPositioning.txt" />
  115 + <Content Include="Data\ParsedSql\15_NestedComments.txt" />
  116 + <Content Include="Data\ParsedSql\16_CurrencyParsingStrangeness.txt" />
  117 + <Content Include="Data\ParsedSql\17_Cursors.txt" />
  118 + <Content Include="Data\ParsedSql\19_DMLTrigger.txt" />
  119 + <Content Include="Data\ParsedSql\20_Joins.txt" />
  120 + <Content Include="Data\ParsedSql\21_DDL_Permissions.txt" />
  121 + <Content Include="Data\ParsedSql\22_DDL_WithClauses.txt" />
  122 + <Content Include="Data\ParsedSql\24_InsertsAndOutputs.txt" />
  123 + <Content Include="Data\ParsedSql\25_Merges.txt" />
  124 + <Content Include="Data\ParsedSql\26_DataTypesAndSynonyms.txt" />
  125 + <Content Include="Data\ParsedSql\11_MSAccess_Pasted.txt" />
  126 + <Content Include="Data\ParsedSql\27_OtherSqlFlavourSupport.txt" />
  127 + <Content Include="Data\StandardFormatSql\01_SimpleTypes_StrangeRules.txt" />
  128 + <Content Include="Data\StandardFormatSql\03_SimpleSelect_MS.txt" />
  129 + <Content Include="Data\StandardFormatSql\04_MiscProceduralSample_Unstructured.txt" />
  130 + <Content Include="Data\StandardFormatSql\05_ComplexDDL.txt" />
  131 + <Content Include="Data\StandardFormatSql\06_CTE_Sample_MS.txt" />
  132 + <Content Include="Data\StandardFormatSql\07_ServerTakeoverSample_Brent_Ozar.txt" />
  133 + <Content Include="Data\StandardFormatSql\08_ComplexBackupDDL_Ola_Hallengren%28TrailingCommas=true,IndentString= ,BreakJoinOnSections=true%29.txt" />
  134 + <Content Include="Data\StandardFormatSql\08_ComplexBackupDDL_Ola_Hallengren.txt" />
  135 + <Content Include="Data\StandardFormatSql\10_SetOperators_Union.txt" />
  136 + <Content Include="Data\StandardFormatSql\11_MSAccess_Pasted.txt" />
  137 + <Content Include="Data\StandardFormatSql\12_NestedIfElse.txt" />
  138 + <Content Include="Data\StandardFormatSql\14_CommentPositioning.txt" />
  139 + <Content Include="Data\StandardFormatSql\15_NestedComments.txt" />
  140 + <Content Include="Data\StandardFormatSql\16_CurrencyParsingStrangeness.txt" />
  141 + <Content Include="Data\StandardFormatSql\17_Cursors.txt" />
  142 + <Content Include="Data\StandardFormatSql\19_DMLTrigger.txt" />
  143 + <Content Include="Data\StandardFormatSql\20_Joins.txt" />
  144 + <Content Include="Data\StandardFormatSql\21_DDL_Permissions.txt" />
  145 + <Content Include="Data\StandardFormatSql\22_DDL_WithClauses.txt" />
  146 + <Content Include="Data\StandardFormatSql\24_InsertsAndOutputs.txt" />
  147 + <Content Include="Data\StandardFormatSql\25_Merges.txt" />
  148 + <Content Include="Data\StandardFormatSql\26_DataTypesAndSynonyms.txt" />
  149 + <Content Include="Data\StandardFormatSql\04_MiscProceduralSample_Unstructured%28ExpandCommaLists=false,MaxLineWidth=60,SpacesPerTab=8%29.txt" />
  150 + <Content Include="Data\StandardFormatSql\07_ServerTakeoverSample_Brent_Ozar%28SpaceAfterExpandedComma=true,ExpandBooleanExpressions=false,ExpandBetweenConditions=false,ExpandCaseStatements=false%29.txt" />
  151 + <Content Include="Data\StandardFormatSql\06_CTE_Sample_MS%28UppercaseKeywords=false%29.txt" />
  152 + <Content Include="Data\StandardFormatSql\14_CommentPositioning%28TrailingCommas=True%29.txt" />
  153 + <Content Include="Data\StandardFormatSql\27_OtherSqlFlavourSupport.txt" />
  154 + </ItemGroup>
  155 + <ItemGroup>
  156 + <ProjectReference Include="..\PoorMansTSqlFormatterLib\PoorMansTSqlFormatterLib.csproj">
  157 + <Project>{ADBDFDCA-CAB6-4569-9151-0BD42E65B400}</Project>
  158 + <Name>PoorMansTSqlFormatterLib</Name>
  159 + </ProjectReference>
  160 + </ItemGroup>
  161 + <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
162 162 <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
163 163 Other similar extension points exist, see Microsoft.Common.targets.
164 164 <Target Name="BeforeBuild">
165 165 </Target>
166 166 <Target Name="AfterBuild">
167 167 </Target>
168   - -->
  168 + -->
169 169 </Project>
14 PoorMansTSqlFormatterTest/TSqlObfuscatingFormatterTests.cs
... ... @@ -1,7 +1,10 @@
1 1 /*
2 2 Poor Man's T-SQL Formatter - a small free Transact-SQL formatting
3 3 library for .Net 2.0, written in C#.
4   -Copyright (C) 2011 Tao Klerks
  4 +Copyright (C) 2011-2013 Tao Klerks
  5 +
  6 +Additional Contributors:
  7 + * Timothy Klenke, 2012
5 8
6 9 This program is free software: you can redistribute it and/or modify
7 10 it under the terms of the GNU Affero General Public License as published by
@@ -44,10 +47,11 @@ public TSqlObfuscatingFormatterTests()
44 47 {
45 48 _tokenizer = new TSqlStandardTokenizer();
46 49 _parser = new TSqlStandardParser();
47   - var options = new TSqlStandardFormatterOptions();
48   - options.TrailingCommas = true;
49   - options.KeywordStandardization = true;
50   - _standardFormatter = new TSqlStandardFormatter(options);
  50 + _standardFormatter = new TSqlStandardFormatter(new TSqlStandardFormatterOptions
  51 + {
  52 + TrailingCommas = true,
  53 + KeywordStandardization = true
  54 + });
51 55 _obfuscatingFormatter = new TSqlObfuscatingFormatter();
52 56 }
53 57
57 PoorMansTSqlFormatterTest/TSqlStandardFormatterOptionsTests.cs
... ... @@ -1,4 +1,27 @@
1   -using System;
  1 +/*
  2 +Poor Man's T-SQL Formatter - a small free Transact-SQL formatting
  3 +library for .Net 2.0, written in C#.
  4 +Copyright (C) 2011-2013 Tao Klerks
  5 +
  6 +Additional Contributors:
  7 + * Timothy Klenke, 2012
  8 +
  9 +This program is free software: you can redistribute it and/or modify
  10 +it under the terms of the GNU Affero General Public License as published by
  11 +the Free Software Foundation, either version 3 of the License, or
  12 +(at your option) any later version.
  13 +
  14 +This program is distributed in the hope that it will be useful,
  15 +but WITHOUT ANY WARRANTY; without even the implied warranty of
  16 +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17 +GNU Affero General Public License for more details.
  18 +
  19 +You should have received a copy of the GNU Affero General Public License
  20 +along with this program. If not, see <http://www.gnu.org/licenses/>.
  21 +
  22 +*/
  23 +
  24 +using System;
2 25 using System.Collections.Generic;
3 26 using System.Text;
4 27 using NUnit.Framework;
@@ -75,21 +98,23 @@ public void Options_Deserialize_OverrideAll()
75 98
76 99 [Test]
77 100 public void Options_Deserialize_RoundTrip()
78   - {
79   - var expected = new TSqlStandardFormatterOptions();
80   - expected.IndentString = " ";
81   - expected.SpacesPerTab = 2;
82   - expected.MaxLineWidth = 100;
83   - expected.ExpandCommaLists = false;
84   - expected.TrailingCommas = true;
85   - expected.SpaceAfterExpandedComma = true;
86   - expected.ExpandBooleanExpressions = false;
87   - expected.ExpandCaseStatements = false;
88   - expected.ExpandBetweenConditions = false;
89   - expected.BreakJoinOnSections = true;
90   - expected.UppercaseKeywords = false;
91   - expected.HTMLColoring = true;
92   - expected.KeywordStandardization = true;
  101 + {
  102 + var expected = new TSqlStandardFormatterOptions
  103 + {
  104 + IndentString = " ",
  105 + SpacesPerTab = 2,
  106 + MaxLineWidth = 100,
  107 + ExpandCommaLists = false,
  108 + TrailingCommas = true,
  109 + SpaceAfterExpandedComma = true,
  110 + ExpandBooleanExpressions = false,
  111 + ExpandCaseStatements = false,
  112 + ExpandBetweenConditions = false,
  113 + BreakJoinOnSections = true,
  114 + UppercaseKeywords = false,
  115 + HTMLColoring = true,
  116 + KeywordStandardization = true
  117 + };
93 118
94 119 var serializedString = expected.ToSerializedString();
95 120
7 PoorMansTSqlFormatterTest/TSqlStandardFormatterTests.cs
@@ -2,6 +2,9 @@
2 2 Poor Man's T-SQL Formatter - a small free Transact-SQL formatting
3 3 library for .Net 2.0, written in C#.
4 4 Copyright (C) 2011 Tao Klerks
  5 +
  6 +Additional Contributors:
  7 + * Timothy Klenke, 2012
5 8
6 9 This program is free software: you can redistribute it and/or modify
7 10 it under the terms of the GNU Affero General Public License as published by
@@ -16,8 +19,8 @@
16 19 You should have received a copy of the GNU Affero General Public License
17 20 along with this program. If not, see <http://www.gnu.org/licenses/>.
18 21
19   -*/
20   -
  22 +*/
  23 +
21 24 using System;
22 25 using System.Text;
23 26 using NUnit.Framework;
7 PoorMansTSqlFormatterTest/Utils.cs
@@ -2,6 +2,9 @@
2 2 Poor Man's T-SQL Formatter - a small free Transact-SQL formatting
3 3 library for .Net 2.0, written in C#.
4 4 Copyright (C) 2011 Tao Klerks
  5 +
  6 +Additional Contributors:
  7 + * Timothy Klenke, 2012
5 8
6 9 This program is free software: you can redistribute it and/or modify
7 10 it under the terms of the GNU Affero General Public License as published by
@@ -16,8 +19,8 @@
16 19 You should have received a copy of the GNU Affero General Public License
17 20 along with this program. If not, see <http://www.gnu.org/licenses/>.
18 21
19   -*/
20   -
  22 +*/
  23 +
21 24 using System;
22 25 using System.Collections.Generic;
23 26 using System.IO;
36 PoorMansTSqlFormatterWebDemo/FormatterService.asmx.cs
... ... @@ -1,7 +1,10 @@
1 1 /*
2 2 Poor Man's T-SQL Formatter - a small free Transact-SQL formatting
3 3 library for .Net 2.0, written in C#.
4   -Copyright (C) 2011 Tao Klerks
  4 +Copyright (C) 2011-2013 Tao Klerks
  5 +
  6 +Additional Contributors:
  7 + * Timothy Klenke, 2012
5 8
6 9 This program is free software: you can redistribute it and/or modify
7 10 it under the terms of the GNU Affero General Public License as published by
@@ -91,22 +94,23 @@ bool enableKeywordSubstitution
91 94 PoorMansTSqlFormatterLib.Interfaces.ISqlTreeFormatter formatter = null;
92 95 if (reFormat)
93 96 {
94   - var options = new PoorMansTSqlFormatterLib.Formatters.TSqlStandardFormatterOptions();
95   - options.IndentString = indent;
96   - options.SpacesPerTab = spacesPerTab;
97   - options.MaxLineWidth = maxLineWidth;
98   - options.ExpandCommaLists = expandCommaLists;
99   - options.TrailingCommas = trailingCommas;
100   - options.SpaceAfterExpandedComma = spaceAfterExpandedComma;
101   - options.ExpandBooleanExpressions = expandBooleanExpressions;
102   - options.ExpandCaseStatements = expandCaseStatements;
103   - options.ExpandBetweenConditions = expandBetweenConditions;
104   - options.BreakJoinOnSections = breakJoinOnSections;
105   - options.UppercaseKeywords = uppercaseKeywords;
106   - options.HTMLColoring = coloring;
107   - options.KeywordStandardization = keywordStandardization;
  97 + formatter = new PoorMansTSqlFormatterLib.Formatters.TSqlStandardFormatter(new PoorMansTSqlFormatterLib.Formatters.TSqlStandardFormatterOptions
  98 + {
  99 + IndentString = indent,
  100 + SpacesPerTab = spacesPerTab,
  101 + MaxLineWidth = maxLineWidth,
  102 + ExpandCommaLists = expandCommaLists,
  103 + TrailingCommas = trailingCommas,
  104 + SpaceAfterExpandedComma = spaceAfterExpandedComma,
  105 + ExpandBooleanExpressions = expandBooleanExpressions,
  106 + ExpandCaseStatements = expandCaseStatements,
  107 + ExpandBetweenConditions = expandBetweenConditions,
  108 + BreakJoinOnSections = breakJoinOnSections,
  109 + UppercaseKeywords = uppercaseKeywords,
  110 + HTMLColoring = coloring,
  111 + KeywordStandardization = keywordStandardization
  112 + });
108 113
109   - formatter = new PoorMansTSqlFormatterLib.Formatters.TSqlStandardFormatter(options);
110 114 }
111 115 else if (obfuscate)
112 116 formatter = new PoorMansTSqlFormatterLib.Formatters.TSqlObfuscatingFormatter(
4 README.md
Source Rendered
@@ -79,6 +79,10 @@ This project uses several external libraries:
79 79 available from the [notepad++ plugin development forum](https://sourceforge.net/projects/notepad-plus/forums/forum/482781).
80 80 * ILRepack, by François Valdy, for assembly-merging, available from the [github project page](https://github.com/gluck/il-repack).
81 81
  82 +Special thanks to contributors that have given their time to make this library better:
  83 +
  84 +* Timothy Klenke
  85 +
82 86 Many of the features in this project result from feedback by multiple people, including
83 87 but not limited to:
84 88
975 df
... ... @@ -1,975 +0,0 @@
1   -commit e2d7f756dab5dae76a82c50f4471f5922e606b23
2   -Author: Timothy Klenke <timothy.klenke@gmail.com>
3   -Date: Wed Nov 7 00:14:34 2012 -0700
4   -
5   - Changed option properties to an Options class
6   -
7   - The constructor for TSqlStandardFormatter took a dozen boolean
8   - parameters for all the options. This is difficult to read and not very
9   - extensible (difficult to add or change supported options).
10   -
11   -commit 8dc0b90f96037cff8ab19d4b1719bb1bfd1d1b20
12   -Author: Timothy Klenke <timothy.klenke@gmail.com>
13   -Date: Tue Nov 6 23:24:29 2012 -0700
14   -
15   - Removed debug break statement
16   -
17   -commit 176bd8b7c1255234c45bcd2db73b480f860a4668
18   -Author: Timothy Klenke <timothy.klenke@gmail.com>
19   -Date: Tue Nov 6 23:23:07 2012 -0700
20   -
21   - no changes
22   -
23   - I'm a Get & GitHub noob. No actual changes in this files. GH4W just
24   - marked them as changed as soon I forked from GH. (Maybe a new line
25   - formatting issue ?!?)
26   -
27   -commit 8622a091a573e091e8b8f8db1877b108e56b38de
28   -Author: TaoK <tao@klerks.biz>
29   -Date: Sun Sep 9 13:52:55 2012 -0400
30   -
31   - Github Issue #75: Add parse error highlighting in HTML output
32   -
33   -commit 1f5b45931df6050993e5aac3317a5af2a8a66480
34   -Author: TaoK <tao@klerks.biz>
35   -Date: Sun Sep 9 05:58:15 2012 -0400
36   -
37   - Github Issue #70: Finally removed System.Web dependency, so the library can be used
38   - in Silverlight, .Net 3.5 Client Profile, and .Net 4.0 Client Profile (and probably
39   - other contexts I don't know about)
40   -
41   -commit 95376635be1b33c0c21734de973667de6e958b3e
42   -Author: TaoK <tao@klerks.biz>
43   -Date: Sun Sep 2 16:49:05 2012 -0400
44   -
45   - Insignificant VB6 reference changes
46   -
47   -commit 1c58285196988c147d63775ceb2c30475423c7c7
48   -Author: TaoK <tao@klerks.biz>
49   -Date: Sun Sep 2 15:22:00 2012 -0400
50   -
51   - Publishing instructions update
52   -
53   -commit c04ff6ec68ffe6750600bc367e6f38637f502f70
54   -Author: TaoK <tao@klerks.biz>
55   -Date: Sun Sep 2 14:55:17 2012 -0400
56   -
57   - Updated winmerge plugin packaging instructions
58   -
59   -commit 3339cd0cd5aaeae64fb3270b69220688c2fddfcc
60   -Author: TaoK <tao@klerks.biz>
61   -Date: Sun Sep 2 14:29:06 2012 -0400
62   -
63   - Prepare for version 1.4.1
64   -
65   -commit c87bc88825832655d368f932d9f342f243f883b0
66   -Author: TaoK <tao@klerks.biz>
67   -Date: Sun Sep 2 13:35:03 2012 -0400
68   -
69   - GitHub Issue #55: OUTPUT args to proc declaration without parens
70   -
71   -commit 065dea2e53cb490b33f840d54630a7c359fe07c4
72   -Author: TaoK <tao@klerks.biz>
73   -Date: Sun Sep 2 13:18:06 2012 -0400
74   -
75   - Github Issue #73: Correct parsing & formatting of OPTION clauses
76   -
77   -commit 51135caf7a64f359fd6eebecfef75e991c4980eb
78   -Author: TaoK <tao@klerks.biz>
79   -Date: Sun Sep 2 12:56:03 2012 -0400
80   -
81   - Github Issue #74: parsing context in variable initializers.
82   -
83   - Added 2 new Xml elements, "DDLDeclareBlock" and "EqualsSign".
84   -
85   -commit dc59a9a5e8649947e3a5f1413c25b3d2d7b4e5f1
86   -Author: TaoK <tao@klerks.biz>
87   -Date: Sun Sep 2 10:08:41 2012 -0400
88   -
89   - Another Git EOL conversion issue
90   -
91   -commit 44174dbe4933214c669f78a9dd3534a4b453bc02
92   -Author: TaoK <tao@klerks.biz>
93   -Date: Sun Sep 2 09:33:39 2012 -0400
94   -
95   - Replaced ILMerge with ILRepack, the open-source equivalent.
96   -
97   - Major benefit: building from scratch, on a new machine, just
98   - got that little bit easier.
99   -
100   -commit 49e801e0baaf3eeed01e62eb1d649184c31f6344
101   -Author: TaoK <tao@klerks.biz>
102   -Date: Sun Sep 2 08:00:04 2012 -0400
103   -
104   - Git EOL conversions bit me again somewhere along the line
105   -
106   -commit c331db958f2f58a46d76ca434ea4607a91bd8635
107   -Author: TaoK <tao@klerks.biz>
108   -Date: Sun Sep 2 07:55:58 2012 -0400
109   -
110   - Build Environment fixes
111   -
112   -commit 1d6dea5b44b1956bc030730f5239fef5cc9bc423
113   -Author: TaoK <tao@klerks.biz>
114   -Date: Sun Jul 8 15:43:53 2012 -0400
115   -
116   - Commandline examples fix
117   -
118   -commit d720edc732728f5f7c24ef19b8b13cf35e470803
119   -Author: TaoK <tao@klerks.biz>
120   -Date: Sun Jun 17 10:36:11 2012 -0400
121   -
122   - GitHub Issue 52: space-indent saving issue in plugins
123   -
124   -commit 79e3e3e3de6c88fb197c1465246dd7f23a4149c7
125   -Author: TaoK <tao@klerks.biz>
126   -Date: Sun Jun 17 10:17:26 2012 -0400
127   -
128   - GitHub Issue 48: SSMS 2012 install fix
129   -
130   -commit f1a3379406f34218753828d4e46d442f75e0eb9f
131   -Author: TaoK <tao@klerks.biz>
132   -Date: Sun Jun 17 09:50:37 2012 -0400
133   -
134   - Misc parse error message handling fix (localization)
135   -
136   -commit 1328c866c99d2d3615b33b5100e7fde0cec8e3c7
137   -Author: TaoK <tao@klerks.biz>
138   -Date: Sun Jun 17 09:48:02 2012 -0400
139   -
140   - GitHub Issue 54: Support for double-pipe string concatenation operator
141   -
142   -commit 771b80ddcbcb42fdd59871fc1d3242a8cceda287
143   -Author: Tao Klerks <tao@klerks.biz>
144   -Date: Mon May 7 04:11:59 2012 -0300
145   -
146   - escape asterisks in comment-positioning issue example
147   -
148   -commit d48993d46075a33f7664aa9a1595e35112252e6c
149   -Author: TaoK <tao@klerks.biz>
150   -Date: Mon Mar 12 10:58:49 2012 -0400
151   -
152   - Web service update for obfuscation options
153   -
154   -commit 789192b4cdc31ff5277149576ee6478a91f488c9