Fixed: Use Append(Char) for single character Stringbuilder additions

pull/5142/head
Qstick 4 years ago
parent 1740ad337c
commit 088ffc34df

@ -195,7 +195,6 @@ dotnet_diagnostic.CA1826.severity = suggestion
dotnet_diagnostic.CA1827.severity = suggestion dotnet_diagnostic.CA1827.severity = suggestion
dotnet_diagnostic.CA1828.severity = suggestion dotnet_diagnostic.CA1828.severity = suggestion
dotnet_diagnostic.CA1829.severity = suggestion dotnet_diagnostic.CA1829.severity = suggestion
dotnet_diagnostic.CA1834.severity = suggestion
dotnet_diagnostic.CA2000.severity = suggestion dotnet_diagnostic.CA2000.severity = suggestion
dotnet_diagnostic.CA2002.severity = suggestion dotnet_diagnostic.CA2002.severity = suggestion
dotnet_diagnostic.CA2007.severity = suggestion dotnet_diagnostic.CA2007.severity = suggestion

@ -27,7 +27,7 @@ namespace NzbDrone.Common.Http
if (scheme.IsNotNullOrWhiteSpace()) if (scheme.IsNotNullOrWhiteSpace())
{ {
builder.Append(scheme); builder.Append(scheme);
builder.Append(":"); builder.Append(':');
} }
if (host.IsNotNullOrWhiteSpace()) if (host.IsNotNullOrWhiteSpace())
@ -36,7 +36,7 @@ namespace NzbDrone.Common.Http
builder.Append(host); builder.Append(host);
if (port.HasValue) if (port.HasValue)
{ {
builder.Append(":"); builder.Append(':');
builder.Append(port); builder.Append(port);
} }
} }
@ -200,11 +200,11 @@ namespace NzbDrone.Common.Http
{ {
if (builder.Length != 0) if (builder.Length != 0)
{ {
builder.Append("&"); builder.Append('&');
} }
builder.Append(Uri.EscapeDataString(pair.Key)); builder.Append(Uri.EscapeDataString(pair.Key));
builder.Append("="); builder.Append('=');
builder.Append(Uri.EscapeDataString(pair.Value)); builder.Append(Uri.EscapeDataString(pair.Value));
} }

@ -1,4 +1,4 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Data; using System.Data;
using System.Linq; using System.Linq;
@ -46,7 +46,7 @@ namespace NzbDrone.Core.Datastore
protected override Expression VisitBinary(BinaryExpression expression) protected override Expression VisitBinary(BinaryExpression expression)
{ {
_sb.Append("("); _sb.Append('(');
Visit(expression.Left); Visit(expression.Left);
@ -54,7 +54,7 @@ namespace NzbDrone.Core.Datastore
Visit(expression.Right); Visit(expression.Right);
_sb.Append(")"); _sb.Append(')');
return expression; return expression;
} }
@ -309,7 +309,7 @@ namespace NzbDrone.Core.Datastore
item = body.Arguments[1]; item = body.Arguments[1];
} }
_sb.Append("("); _sb.Append('(');
Visit(item); Visit(item);
@ -319,9 +319,9 @@ namespace NzbDrone.Core.Datastore
if (item.Type == typeof(int) && TryGetRightValue(list, out var value)) if (item.Type == typeof(int) && TryGetRightValue(list, out var value))
{ {
var items = (IEnumerable<int>)value; var items = (IEnumerable<int>)value;
_sb.Append("("); _sb.Append('(');
_sb.Append(string.Join(", ", items)); _sb.Append(string.Join(", ", items));
_sb.Append(")"); _sb.Append(')');
_gotConcreteValue = true; _gotConcreteValue = true;
} }
@ -330,12 +330,12 @@ namespace NzbDrone.Core.Datastore
Visit(list); Visit(list);
} }
_sb.Append(")"); _sb.Append(')');
} }
private void ParseStringContains(MethodCallExpression body) private void ParseStringContains(MethodCallExpression body)
{ {
_sb.Append("("); _sb.Append('(');
Visit(body.Object); Visit(body.Object);
@ -348,7 +348,7 @@ namespace NzbDrone.Core.Datastore
private void ParseStartsWith(MethodCallExpression body) private void ParseStartsWith(MethodCallExpression body)
{ {
_sb.Append("("); _sb.Append('(');
Visit(body.Object); Visit(body.Object);
@ -361,7 +361,7 @@ namespace NzbDrone.Core.Datastore
private void ParseEndsWith(MethodCallExpression body) private void ParseEndsWith(MethodCallExpression body)
{ {
_sb.Append("("); _sb.Append('(');
Visit(body.Object); Visit(body.Object);
@ -369,7 +369,7 @@ namespace NzbDrone.Core.Datastore
Visit(body.Arguments[0]); Visit(body.Arguments[0]);
_sb.Append(")"); _sb.Append(')');
} }
public override string ToString() public override string ToString()

@ -115,13 +115,13 @@ namespace NzbDrone.Core.Extras.Subtitles
if (multipleCopies) if (multipleCopies)
{ {
suffixBuilder.Append("."); suffixBuilder.Append('.');
suffixBuilder.Append(copy); suffixBuilder.Append(copy);
} }
if (language != Language.Unknown) if (language != Language.Unknown)
{ {
suffixBuilder.Append("."); suffixBuilder.Append('.');
suffixBuilder.Append(IsoLanguages.Get(language).TwoLetterCode); suffixBuilder.Append(IsoLanguages.Get(language).TwoLetterCode);
} }

@ -1,4 +1,4 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
@ -162,8 +162,8 @@ namespace TinyTwitter
private string GenerateSignature(IEnumerable<KeyValuePair<string, string>> parameters) private string GenerateSignature(IEnumerable<KeyValuePair<string, string>> parameters)
{ {
var dataToSign = new StringBuilder() var dataToSign = new StringBuilder()
.Append(_method).Append("&") .Append(_method).Append('&')
.Append(_url.EncodeRFC3986()).Append("&") .Append(_url.EncodeRFC3986()).Append('&')
.Append(parameters .Append(parameters
.OrderBy(x => x.Key) .OrderBy(x => x.Key)
.Select(x => string.Format("{0}={1}", x.Key, x.Value)) .Select(x => string.Format("{0}={1}", x.Key, x.Value))

Loading…
Cancel
Save