Skip to content

Commit 082b649

Browse files
committed
style: lint and minor code cleanup
1 parent 675feae commit 082b649

3 files changed

Lines changed: 18 additions & 23 deletions

File tree

SQL.Formatter.Test/FormatConfigTest.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ namespace SQL.Formatter.Test
66
{
77
public class FormatConfigTest
88
{
9-
private static readonly SqlFormatter.Formatter Formatter = SqlFormatter.Of(Dialect.StandardSql);
9+
private static readonly SqlFormatter.Formatter s_formatter = SqlFormatter.Of(Dialect.StandardSql);
1010

1111
[Fact]
1212
public void Upper_FormatsKeywordsInUppercase()
1313
{
1414
var cfg = FormatConfig.Builder().Case(CaseTypes.UPPER).Build();
15-
var result = Formatter.Format("select id from users where id = 1", cfg);
15+
var result = s_formatter.Format("select id from users where id = 1", cfg);
1616

1717
Assert.Equal(
1818
"SELECT\n"
@@ -30,7 +30,7 @@ public void Uppercase_FormatsKeywordsInUppercase()
3030
#pragma warning disable CS0618
3131
var cfg = FormatConfig.Builder().Uppercase(true).Build();
3232
#pragma warning restore CS0618
33-
var result = Formatter.Format("select id from users where id = 1", cfg);
33+
var result = s_formatter.Format("select id from users where id = 1", cfg);
3434

3535
Assert.Equal(
3636
"SELECT\n"
@@ -48,7 +48,7 @@ public void Uppercase_False_PreservesKeywordCase()
4848
#pragma warning disable CS0618
4949
var cfg = FormatConfig.Builder().Uppercase(false).Build();
5050
#pragma warning restore CS0618
51-
var result = Formatter.Format("select id FROM users", cfg);
51+
var result = s_formatter.Format("select id FROM users", cfg);
5252

5353
Assert.Equal(
5454
"select\n"
@@ -62,7 +62,7 @@ public void Uppercase_False_PreservesKeywordCase()
6262
public void Lower_FormatsKeywordsInLowercase()
6363
{
6464
var cfg = FormatConfig.Builder().Case(CaseTypes.LOWER).Build();
65-
var result = Formatter.Format("SELECT id FROM Users WHERE id = 1", cfg);
65+
var result = s_formatter.Format("SELECT id FROM Users WHERE id = 1", cfg);
6666

6767
Assert.Equal(
6868
"select\n"
@@ -104,7 +104,7 @@ public void Upper_ClearsLower_FormatsUppercase()
104104
.Case(CaseTypes.UPPER)
105105
.Build();
106106

107-
var result = Formatter.Format("select id from users", cfg);
107+
var result = s_formatter.Format("select id from users", cfg);
108108

109109
Assert.Equal(
110110
"SELECT\n"
@@ -122,7 +122,7 @@ public void Lower_ClearsUpper_FormatsLowercase()
122122
.Case(CaseTypes.LOWER)
123123
.Build();
124124

125-
var result = Formatter.Format("SELECT id FROM users", cfg);
125+
var result = s_formatter.Format("SELECT id FROM users", cfg);
126126

127127
Assert.Equal(
128128
"select\n"
@@ -136,7 +136,7 @@ public void Lower_ClearsUpper_FormatsLowercase()
136136
public void NeitherUppercaseNorLowercase_PreservesKeywordCase()
137137
{
138138
var cfg = FormatConfig.Builder().Build();
139-
var result = Formatter.Format("SeLeCt id FrOm users", cfg);
139+
var result = s_formatter.Format("SeLeCt id FrOm users", cfg);
140140

141141
Assert.Equal(
142142
"SeLeCt\n"
@@ -150,7 +150,7 @@ public void NeitherUppercaseNorLowercase_PreservesKeywordCase()
150150
public void None_PreservesKeywordCase()
151151
{
152152
var cfg = FormatConfig.Builder().Case(CaseTypes.NONE).Build();
153-
var result = Formatter.Format("SeLeCt id FrOm users", cfg);
153+
var result = s_formatter.Format("SeLeCt id FrOm users", cfg);
154154

155155
Assert.Equal(
156156
"SeLeCt\n"

SQL.Formatter/Core/CaseTypes.cs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using System.Text;
4-
5-
namespace SQL.Formatter.Core
1+
namespace SQL.Formatter.Core
62
{
73
public enum CaseTypes
84
{

SQL.Formatter/Core/FormatConfig.cs

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,16 @@ public FormatConfig(
2424
Params parameters,
2525
bool uppercase,
2626
int linesBetweenQueries,
27-
bool skipWhitespaceNearBlockParentheses)
28-
27+
bool skipWhitespaceNearBlockParentheses)
28+
2929
: this(
30-
indent,
31-
maxColumnLength,
32-
parameters,
33-
uppercase ? CaseTypes.UPPER : CaseTypes.NONE,
34-
linesBetweenQueries,
30+
indent,
31+
maxColumnLength,
32+
parameters,
33+
uppercase ? CaseTypes.UPPER : CaseTypes.NONE,
34+
linesBetweenQueries,
3535
skipWhitespaceNearBlockParentheses)
36-
{
36+
{
3737
}
3838

3939
public FormatConfig(
@@ -55,7 +55,6 @@ public FormatConfig(
5555
SkipWhitespaceNearBlockParentheses = skipWhitespaceNearBlockParentheses;
5656
}
5757

58-
5958
public static FormatConfigBuilder Builder()
6059
{
6160
return new FormatConfigBuilder();

0 commit comments

Comments
 (0)