Permalink
Browse files

fixed stylecop failures

  • Loading branch information...
1 parent 8ef28a9 commit 8118b62ee6fd43fadb947704af071906dea8656a @jkowalski jkowalski committed Jul 16, 2011
View
@@ -77,7 +77,7 @@
<MSTest9>$(VS90COMNTOOLS)..\IDE\MSTest.exe</MSTest9>
<MSTest10>$(VS100COMNTOOLS)..\IDE\MSTest.exe</MSTest10>
- <StyleCopTargetsFile>$(MSBuildExtensionsPath)\Microsoft\StyleCop\v4.5\Microsoft.StyleCop.Targets</StyleCopTargetsFile>
+ <StyleCopTargetsFile>$(MSBuildExtensionsPath)\StyleCop\v4.5\StyleCop.Targets</StyleCopTargetsFile>
<StyleCopProperties Condition="'$(DisableStyleCop)' == 'false' and Exists('$(StyleCopTargetsFile)')">StyleCopTargetsFile=$(StyleCopTargetsFile)</StyleCopProperties>
</PropertyGroup>
@@ -52,7 +52,7 @@ public class ComLogger : IComLogger
private static readonly Logger DefaultLogger = LogManager.CreateNullLogger();
private Logger logger = DefaultLogger;
- private string loggerName = String.Empty;
+ private string loggerName = string.Empty;
/// <summary>
/// Gets a value indicating whether the Trace level is enabled.
@@ -35,9 +35,9 @@
namespace NLog.ComInterop
{
- using System.Runtime.InteropServices;
using System.Diagnostics.CodeAnalysis;
-
+ using System.Runtime.InteropServices;
+
/// <summary>
/// NLog COM Interop logger interface.
/// </summary>
@@ -287,7 +287,7 @@ private static void Write(LogLevel level, string message, object[] args)
return;
}
- if (String.IsNullOrEmpty(LogFile) && !LogToConsole && !LogToConsoleError && LogWriter == null)
+ if (string.IsNullOrEmpty(LogFile) && !LogToConsole && !LogToConsoleError && LogWriter == null)
{
return;
}
@@ -74,7 +74,7 @@ public ConditionMethodExpression(string conditionMethodName, MethodInfo methodIn
if (formalParameters.Length != actualParameterCount)
{
- string message = String.Format(
+ string message = string.Format(
CultureInfo.InvariantCulture,
"Condition method '{0}' expects {1} parameters, but passed {2}.",
conditionMethodName,
@@ -167,10 +167,10 @@ private ConditionExpression ParseLiteralExpression()
this.tokenizer.GetNextToken();
if (numberString.IndexOf('.') >= 0)
{
- return new ConditionLiteralExpression(-Double.Parse(numberString, CultureInfo.InvariantCulture));
+ return new ConditionLiteralExpression(-double.Parse(numberString, CultureInfo.InvariantCulture));
}
- return new ConditionLiteralExpression(-Int32.Parse(numberString, CultureInfo.InvariantCulture));
+ return new ConditionLiteralExpression(-int.Parse(numberString, CultureInfo.InvariantCulture));
}
if (this.tokenizer.IsNumber())
@@ -179,10 +179,10 @@ private ConditionExpression ParseLiteralExpression()
this.tokenizer.GetNextToken();
if (numberString.IndexOf('.') >= 0)
{
- return new ConditionLiteralExpression(Double.Parse(numberString, CultureInfo.InvariantCulture));
+ return new ConditionLiteralExpression(double.Parse(numberString, CultureInfo.InvariantCulture));
}
- return new ConditionLiteralExpression(Int32.Parse(numberString, CultureInfo.InvariantCulture));
+ return new ConditionLiteralExpression(int.Parse(numberString, CultureInfo.InvariantCulture));
}
if (this.tokenizer.TokenType == ConditionTokenType.String)
@@ -196,38 +196,38 @@ private ConditionExpression ParseLiteralExpression()
{
string keyword = this.tokenizer.EatKeyword();
- if (0 == String.Compare(keyword, "level", StringComparison.OrdinalIgnoreCase))
+ if (0 == string.Compare(keyword, "level", StringComparison.OrdinalIgnoreCase))
{
return new ConditionLevelExpression();
}
- if (0 == String.Compare(keyword, "logger", StringComparison.OrdinalIgnoreCase))
+ if (0 == string.Compare(keyword, "logger", StringComparison.OrdinalIgnoreCase))
{
return new ConditionLoggerNameExpression();
}
- if (0 == String.Compare(keyword, "message", StringComparison.OrdinalIgnoreCase))
+ if (0 == string.Compare(keyword, "message", StringComparison.OrdinalIgnoreCase))
{
return new ConditionMessageExpression();
}
- if (0 == String.Compare(keyword, "loglevel", StringComparison.OrdinalIgnoreCase))
+ if (0 == string.Compare(keyword, "loglevel", StringComparison.OrdinalIgnoreCase))
{
this.tokenizer.Expect(ConditionTokenType.Dot);
return new ConditionLiteralExpression(LogLevel.FromString(this.tokenizer.EatKeyword()));
}
- if (0 == String.Compare(keyword, "true", StringComparison.OrdinalIgnoreCase))
+ if (0 == string.Compare(keyword, "true", StringComparison.OrdinalIgnoreCase))
{
return new ConditionLiteralExpression(true);
}
- if (0 == String.Compare(keyword, "false", StringComparison.OrdinalIgnoreCase))
+ if (0 == string.Compare(keyword, "false", StringComparison.OrdinalIgnoreCase))
{
return new ConditionLiteralExpression(false);
}
- if (0 == String.Compare(keyword, "null", StringComparison.OrdinalIgnoreCase))
+ if (0 == string.Compare(keyword, "null", StringComparison.OrdinalIgnoreCase))
{
return new ConditionLiteralExpression(null);
}
@@ -203,7 +203,7 @@ public void GetNextToken()
char ch = (char)i;
- if (Char.IsDigit(ch))
+ if (char.IsDigit(ch))
{
this.ParseNumber(ch);
return;
@@ -215,7 +215,7 @@ public void GetNextToken()
return;
}
- if (ch == '_' || Char.IsLetter(ch))
+ if (ch == '_' || char.IsLetter(ch))
{
this.ParseKeyword(ch);
return;
@@ -437,7 +437,7 @@ private void ParseKeyword(char ch)
while ((i = this.PeekChar()) != -1)
{
- if ((char)i == '_' || (char)i == '-' || Char.IsLetterOrDigit((char)i))
+ if ((char)i == '_' || (char)i == '-' || char.IsLetterOrDigit((char)i))
{
sb.Append((char)this.ReadChar());
}
@@ -463,7 +463,7 @@ private void ParseNumber(char ch)
{
ch = (char)i;
- if (Char.IsDigit(ch) || (ch == '.'))
+ if (char.IsDigit(ch) || (ch == '.'))
{
sb.Append((char)this.ReadChar());
}
@@ -482,7 +482,7 @@ private void SkipWhitespace()
while ((ch = this.PeekChar()) != -1)
{
- if (!Char.IsWhiteSpace((char)ch))
+ if (!char.IsWhiteSpace((char)ch))
{
break;
}
@@ -185,7 +185,7 @@ public string LoggerNamePattern
}
this.loggerNameMatchMode = MatchMode.None;
- this.loggerNameMatchArgument = String.Empty;
+ this.loggerNameMatchArgument = string.Empty;
}
}
View
@@ -55,7 +55,7 @@ public static void Set(string item, string value)
/// Gets the Global Diagnostics Context named item.
/// </summary>
/// <param name="item">Item name.</param>
- /// <returns>The item value of String.Empty if the value is not present.</returns>
+ /// <returns>The item value of string.Empty if the value is not present.</returns>
public static string Get(string item)
{
return GlobalDiagnosticsContext.Get(item);
@@ -60,7 +60,7 @@ public static void Set(string item, string value)
/// Gets the Global Diagnostics Context named item.
/// </summary>
/// <param name="item">Item name.</param>
- /// <returns>The item value of String.Empty if the value is not present.</returns>
+ /// <returns>The item value of string.Empty if the value is not present.</returns>
public static string Get(string item)
{
lock (dict)
@@ -69,7 +69,7 @@ public static string Get(string item)
if (!dict.TryGetValue(item, out s))
{
- s = String.Empty;
+ s = string.Empty;
}
return s;
@@ -7,4 +7,3 @@
// Error List, point to "Suppress Message(s)", and click
// "In Project Suppression File".
// You do not need to add suppressions to this file manually.
-
@@ -33,13 +33,12 @@
#if !NET_CF && !SILVERLIGHT
-using System;
-using System.Reflection;
-using System.Runtime.InteropServices;
-
namespace NLog.Internal
{
+ using System;
using System.Globalization;
+ using System.Reflection;
+ using System.Runtime.InteropServices;
/// <summary>
/// Various helper methods for accessing state of ASP application.
@@ -140,7 +140,7 @@ public ICollection Keys
/// Gets or sets the <see cref="System.Object"/> with the specified key.
/// </summary>
/// <param name="key">Dictionary key.</param>
- /// <value>Value corresponding to key or null if not found</value>
+ /// <returns>Value corresponding to key or null if not found</returns>
public object this[object key]
{
get
@@ -122,16 +122,19 @@ public static T GetDataForSlot<T>(object slot)
{
oldThreadData = threadData;
wtr.Next = oldThreadData;
- } while (Interlocked.CompareExchange(ref threadData, wtr, oldThreadData) != oldThreadData);
+ }
+ while (Interlocked.CompareExchange(ref threadData, wtr, oldThreadData) != oldThreadData);
return data;
}
- class WeakThreadReferenceWithData
+ internal class WeakThreadReferenceWithData
{
- public WeakReference ThreadReference;
- public IDictionary<int, object> Data;
- public WeakThreadReferenceWithData Next;
+ internal WeakReference ThreadReference { get; set; }
+
+ internal IDictionary<int, object> Data { get; set; }
+
+ internal WeakThreadReferenceWithData Next { get; set; }
}
#endif
}
@@ -68,5 +68,4 @@ protected override void Append(StringBuilder builder, LogEventInfo logEvent)
builder.Append(Guid.NewGuid().ToString(this.Format));
}
}
-}
-
+}
@@ -69,7 +69,7 @@ public Log4JXmlEventLayoutRenderer()
#elif SILVERLIGHT
this.AppInfo = "Silverlight Application";
#else
- this.AppInfo = String.Format(
+ this.AppInfo = string.Format(
CultureInfo.InvariantCulture,
"{0}({1})",
AppDomain.CurrentDomain.FriendlyName,
@@ -99,7 +99,7 @@ protected override void Append(StringBuilder builder, LogEventInfo logEvent)
separatorLength = this.Separator.Length;
}
- string separator = String.Empty;
+ string separator = string.Empty;
StringBuilder sb = new StringBuilder();
for (int i = endPos - 1; i >= startPos; --i)
@@ -82,5 +82,4 @@ protected override void Append(StringBuilder builder, LogEventInfo logEvent)
}
}
}
-}
-
+}
@@ -123,6 +123,7 @@ private static string DoJsonEscape(string text)
{
sb.Append(text[i]);
}
+
break;
}
}
@@ -132,7 +133,7 @@ private static string DoJsonEscape(string text)
private static bool NeedsEscaping(char ch)
{
- return (ch < 32 || ch > 127);
+ return ch < 32 || ch > 127;
}
}
}
@@ -87,7 +87,7 @@ public PaddingLayoutRendererWrapper()
/// <returns>Transformed text.</returns>
protected override string Transform(string text)
{
- string s = text ?? String.Empty;
+ string s = text ?? string.Empty;
if (this.Padding != 0)
{
View
@@ -55,7 +55,7 @@ public static void Set(string item, string value)
/// Gets the current thread MDC named item.
/// </summary>
/// <param name="item">Item name.</param>
- /// <returns>The item value of String.Empty if the value is not present.</returns>
+ /// <returns>The item value of string.Empty if the value is not present.</returns>
public static string Get(string item)
{
return MappedDiagnosticsContext.Get(item);
@@ -66,14 +66,14 @@ public static void Set(string item, string value)
/// Gets the current thread MDC named item.
/// </summary>
/// <param name="item">Item name.</param>
- /// <returns>The item value of String.Empty if the value is not present.</returns>
+ /// <returns>The item value of string.Empty if the value is not present.</returns>
public static string Get(string item)
{
string s;
if (!ThreadDictionary.TryGetValue(item, out s))
{
- s = String.Empty;
+ s = string.Empty;
}
return s;
@@ -18,6 +18,7 @@
<TargetFrameworkProfile>Client</TargetFrameworkProfile>
<StyleCopTargetsFile>$(MSBuildExtensionsPath)\Microsoft\StyleCop\v4.4\Microsoft.StyleCop.Targets</StyleCopTargetsFile>
<RunCodeAnalysis Condition=" '$(BuildingInsideVisualStudio)' != 'true' ">true</RunCodeAnalysis>
+ <StyleCopTreatErrorsAsWarnings>false</StyleCopTreatErrorsAsWarnings>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
@@ -62,7 +62,7 @@ public static string TopMessage
}
else
{
- return String.Empty;
+ return string.Empty;
}
}
}
@@ -98,7 +98,7 @@ public static string Pop()
}
else
{
- return String.Empty;
+ return string.Empty;
}
}
@@ -65,7 +65,7 @@ public sealed class DebugTarget : TargetWithLayout
/// </remarks>
public DebugTarget()
{
- this.LastMessage = String.Empty;
+ this.LastMessage = string.Empty;
this.Counter = 0;
}
@@ -53,5 +53,4 @@ public enum NetworkTargetOverflowAction
/// </summary>
Discard
}
-}
-
+}
View
@@ -37,11 +37,6 @@
<BooleanProperty Name="Enabled">True</BooleanProperty>
</RuleSettings>
</Rule>
- <Rule Name="DocumentationTextMustEndWithAPeriod">
- <RuleSettings>
- <BooleanProperty Name="Enabled">True</BooleanProperty>
- </RuleSettings>
- </Rule>
</Rules>
<AnalyzerSettings>
<BooleanProperty Name="IgnorePrivates">True</BooleanProperty>
Oops, something went wrong.

0 comments on commit 8118b62

Please sign in to comment.