* Cleaning up usage of CodeAnalysis.

* Fixing System.Reflection version.
This commit is contained in:
Pranav K 2015-12-07 19:50:10 -08:00
parent 66c9a21848
commit 1e997fec7e
34 changed files with 6 additions and 170 deletions

View File

@ -24,14 +24,14 @@
"frameworks": {
"net451": {
"frameworkAssemblies": {
"System.Runtime": "4.0.0.0"
"System.Runtime": ""
}
},
"dotnet5.4": {
"dependencies": {
"System.Collections.Concurrent": "4.0.11-*",
"System.Linq.Expressions": "4.0.11-*",
"System.Reflection.TypeExtensions": "4.0.1-*"
"System.Reflection.TypeExtensions": "4.1.0-*"
}
}
}

View File

@ -1,7 +1,6 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Diagnostics.CodeAnalysis;
using Microsoft.AspNet.Razor.Parser.SyntaxTree;
namespace Microsoft.AspNet.Razor.Chunks.Generators
@ -10,10 +9,6 @@ namespace Microsoft.AspNet.Razor.Chunks.Generators
{
private static readonly int TypeHashCode = typeof(ParentChunkGenerator).GetHashCode();
[SuppressMessage(
"Microsoft.Security",
"CA2104:DoNotDeclareReadOnlyMutableReferenceTypes",
Justification = "This class has no instance state")]
public static readonly IParentChunkGenerator Null = new NullParentChunkGenerator();
public virtual void GenerateStartParentChunk(Block target, ChunkGeneratorContext context)

View File

@ -1,7 +1,6 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Diagnostics.CodeAnalysis;
using Microsoft.AspNet.Razor.Parser.SyntaxTree;
namespace Microsoft.AspNet.Razor.Chunks.Generators
@ -10,10 +9,6 @@ namespace Microsoft.AspNet.Razor.Chunks.Generators
{
private static readonly int TypeHashCode = typeof(SpanChunkGenerator).GetHashCode();
[SuppressMessage(
"Microsoft.Security",
"CA2104:DoNotDeclareReadOnlyMutableReferenceTypes",
Justification = "This class has no instance state")]
public static readonly ISpanChunkGenerator Null = new NullSpanChunkGenerator();
public virtual void GenerateChunk(Span target, ChunkGeneratorContext context)

View File

@ -3,7 +3,6 @@
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using Microsoft.AspNet.Razor.Editor;
using Microsoft.AspNet.Razor.Text;
using Microsoft.AspNet.Razor.Tokenizer.Symbols;
@ -15,7 +14,6 @@ namespace Microsoft.AspNet.Razor.Parser.SyntaxTree
{
private static readonly int TypeHashCode = typeof(AutoCompleteEditHandler).GetHashCode();
[SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Justification = "Func<T> is the recommended delegate type and requires this level of nesting.")]
public AutoCompleteEditHandler(Func<string, IEnumerable<ISymbol>> tokenizer)
: base(tokenizer)
{
@ -27,7 +25,6 @@ namespace Microsoft.AspNet.Razor.Parser.SyntaxTree
AutoCompleteAtEndOfSpan = autoCompleteAtEndOfSpan;
}
[SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Justification = "Func<T> is the recommended delegate type and requires this level of nesting.")]
public AutoCompleteEditHandler(Func<string, IEnumerable<ISymbol>> tokenizer, AcceptedCharacters accepted)
: base(tokenizer, accepted)
{

View File

@ -4,7 +4,6 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.IO;
using System.Linq;
@ -54,7 +53,6 @@ namespace Microsoft.AspNet.Razor.Editor
_main.QueueChange(change);
}
[SuppressMessage("Microsoft.Usage", "CA2213:DisposableFieldsShouldBeDisposed", MessageId = "_main", Justification = "MainThreadState is disposed when the background thread shuts down")]
public void Dispose()
{
_main.Cancel();
@ -112,7 +110,6 @@ namespace Microsoft.AspNet.Razor.Editor
{
}
[SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic", Justification = "This method is only empty in Release builds. In Debug builds it contains references to instance variables")]
[Conditional("DEBUG")]
protected void SetThreadId(int id)
{
@ -121,7 +118,6 @@ namespace Microsoft.AspNet.Razor.Editor
#endif
}
[SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic", Justification = "This method is only empty in Release builds. In Debug builds it contains references to instance variables")]
[Conditional("DEBUG")]
protected void EnsureOnThread()
{
@ -131,7 +127,6 @@ namespace Microsoft.AspNet.Razor.Editor
#endif
}
[SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic", Justification = "This method is only empty in Release builds. In Debug builds it contains references to instance variables")]
[Conditional("DEBUG")]
protected void EnsureNotOnThread()
{
@ -148,7 +143,6 @@ namespace Microsoft.AspNet.Razor.Editor
private readonly ManualResetEventSlim _hasParcel = new ManualResetEventSlim(false);
private CancellationTokenSource _currentParcelCancelSource;
[SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields", Justification = "Field is used in debug code and may be used later")]
private string _fileName;
private readonly object _stateLock = new object();
private IList<TextChange> _changes = new List<TextChange>();

View File

@ -4,7 +4,6 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.IO;
using System.Linq;
@ -21,7 +20,6 @@ namespace Microsoft.AspNet.Razor.Editor
private readonly ISet<string> _keywords;
private readonly IReadOnlyCollection<string> _readOnlyKeywords;
[SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Justification = "Func<T> is the recommended delegate type and requires this level of nesting.")]
public ImplicitExpressionEditHandler(Func<string, IEnumerable<ISymbol>> tokenizer, ISet<string> keywords, bool acceptTrailingDot)
: base(tokenizer)
{
@ -181,7 +179,6 @@ namespace Microsoft.AspNet.Razor.Editor
// Accepts '.' insertions in the middle of spans. Ex: '@foo.baz.bar' -> '@foo..baz.bar'
// This is meant to allow intellisense when editing a span.
[SuppressMessage("Microsoft.Usage", "CA1801:ReviewUnusedParameters", MessageId = "target", Justification = "The 'target' parameter is used in Debug to validate that the function is called in the correct context.")]
private static bool IsAcceptableInnerInsertion(Span target, TextChange change)
{
Debug.Assert(change.IsInsert);

View File

@ -3,7 +3,6 @@
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using Microsoft.AspNet.Razor.Parser.SyntaxTree;
using Microsoft.AspNet.Razor.Tokenizer.Symbols;
@ -11,13 +10,11 @@ namespace Microsoft.AspNet.Razor.Editor
{
public class SingleLineMarkupEditHandler : SpanEditHandler
{
[SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Justification = "Func<T> is the recommended delegate type and requires this level of nesting.")]
public SingleLineMarkupEditHandler(Func<string, IEnumerable<ISymbol>> tokenizer)
: base(tokenizer)
{
}
[SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Justification = "Func<T> is the recommended delegate type and requires this level of nesting.")]
public SingleLineMarkupEditHandler(Func<string, IEnumerable<ISymbol>> tokenizer, AcceptedCharacters accepted)
: base(tokenizer, accepted)
{

View File

@ -3,7 +3,6 @@
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using Microsoft.AspNet.Razor.Parser.SyntaxTree;
using Microsoft.AspNet.Razor.Text;
@ -16,13 +15,11 @@ namespace Microsoft.AspNet.Razor.Editor
{
private static readonly int TypeHashCode = typeof(SpanEditHandler).GetHashCode();
[SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Justification = "Func<T> is the recommended delegate type and requires this level of nesting.")]
public SpanEditHandler(Func<string, IEnumerable<ISymbol>> tokenizer)
: this(tokenizer, AcceptedCharacters.Any)
{
}
[SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Justification = "Func<T> is the recommended delegate type and requires this level of nesting.")]
public SpanEditHandler(Func<string, IEnumerable<ISymbol>> tokenizer, AcceptedCharacters accepted)
{
AcceptedCharacters = accepted;
@ -36,7 +33,6 @@ namespace Microsoft.AspNet.Razor.Editor
/// </summary>
public EditorHints EditorHints { get; set; }
[SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Justification = "Func<T> is the recommended delegate type and requires this level of nesting.")]
public Func<string, IEnumerable<ISymbol>> Tokenizer { get; set; }
public static SpanEditHandler CreateDefault()
@ -44,7 +40,6 @@ namespace Microsoft.AspNet.Razor.Editor
return CreateDefault(s => Enumerable.Empty<ISymbol>());
}
[SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Justification = "Func<T> is the recommended delegate type and requires this level of nesting.")]
public static SpanEditHandler CreateDefault(Func<string, IEnumerable<ISymbol>> tokenizer)
{
return new SpanEditHandler(tokenizer);
@ -133,7 +128,6 @@ namespace Microsoft.AspNet.Razor.Editor
return change.IsReplace && IsAtEndOfSpan(target, change);
}
[SuppressMessage("Microsoft.Design", "CA1011:ConsiderPassingBaseTypesAsParameters", Justification = "This method should only be used on Spans")]
protected internal static bool IsAtEndOfSpan(Span target, TextChange change)
{
return (change.OldPosition + change.OldLength) == (target.Start.AbsoluteIndex + target.Length);

View File

@ -1,22 +0,0 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
// This file is used by Code Analysis to maintain SuppressMessage
// attributes that are applied to this project.
// Project-level suppressions either have no target or are given
// a specific target and scoped to a namespace, type, member, etc.
//
// To add a suppression to this file, right-click the message in the
// Error List, point to "Suppress Message(s)", and click
// "In Project Suppression File".
// You do not need to add suppressions to this file manually.
using System.Diagnostics.CodeAnalysis;
[assembly: SuppressMessage("Microsoft.Naming", "CA1703:ResourceStringsShouldBeSpelledCorrectly", MessageId = "br", Scope = "resource", Target = "Microsoft.AspNet.Razor.Resources.RazorResources.resources", Justification = "Resource is referencing html tag")]
[assembly: SuppressMessage("Microsoft.Design", "CA1020:AvoidNamespacesWithFewTypes", Scope = "namespace", Target = "Microsoft.AspNet.Razor.Tokenizer.Symbols", Justification = "These namespaces are design to group classes by function. They will be reviewed to ensure they remain relevant.")]
[assembly: SuppressMessage("Microsoft.Design", "CA1020:AvoidNamespacesWithFewTypes", Scope = "namespace", Target = "Microsoft.AspNet.Razor.Tokenizer", Justification = "These namespaces are design to group classes by function. They will be reviewed to ensure they remain relevant.")]
[assembly: SuppressMessage("Microsoft.Design", "CA1020:AvoidNamespacesWithFewTypes", Scope = "namespace", Target = "Microsoft.AspNet.Razor.Text", Justification = "These namespaces are design to group classes by function. They will be reviewed to ensure they remain relevant.")]
[assembly: SuppressMessage("Microsoft.Design", "CA1020:AvoidNamespacesWithFewTypes", Scope = "namespace", Target = "Microsoft.AspNet.Razor.Parser", Justification = "These namespaces are design to group classes by function. They will be reviewed to ensure they remain relevant.")]
[assembly: SuppressMessage("Microsoft.Design", "CA1020:AvoidNamespacesWithFewTypes", Scope = "namespace", Target = "Microsoft.AspNet.Razor.Editor", Justification = "These namespaces are design to group classes by function. They will be reviewed to ensure they remain relevant.")]
[assembly: SuppressMessage("Microsoft.Design", "CA1020:AvoidNamespacesWithFewTypes", Scope = "namespace", Target = "Microsoft.AspNet.Razor", Justification = "These namespaces are design to group classes by function. They will be reviewed to ensure they remain relevant.")]

View File

@ -3,7 +3,6 @@
using System;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using Microsoft.AspNet.Razor.Chunks.Generators;
using Microsoft.AspNet.Razor.Parser.SyntaxTree;
using Microsoft.AspNet.Razor.Tokenizer.Symbols;
@ -214,8 +213,6 @@ namespace Microsoft.AspNet.Razor.Parser
InheritsDirectiveCore();
}
[SuppressMessage("Microsoft.Usage", "CA1801:ReviewUnusedParameters", MessageId = "directive", Justification = "This only occurs in Release builds, where this method is empty by design")]
[SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic", Justification = "This only occurs in Release builds, where this method is empty by design")]
[Conditional("DEBUG")]
protected void AssertDirective(string directive)
{

View File

@ -4,7 +4,6 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using Microsoft.AspNet.Razor.Editor;
using Microsoft.AspNet.Razor.Chunks.Generators;
using Microsoft.AspNet.Razor.Parser.SyntaxTree;
@ -101,7 +100,6 @@ namespace Microsoft.AspNet.Razor.Parser
}
}
[SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic", Justification = "This only occurs in Release builds, where this method is empty by design")]
[Conditional("DEBUG")]
internal void Assert(CSharpKeyword expectedKeyword)
{

View File

@ -1,10 +1,8 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using Microsoft.AspNet.Razor.Text;
using Microsoft.AspNet.Razor.Tokenizer;
using Microsoft.AspNet.Razor.Tokenizer.Symbols;
@ -153,7 +151,6 @@ namespace Microsoft.AspNet.Razor.Parser
}
}
[SuppressMessage("Microsoft.Globalization", "CA1308:NormalizeStringsToUppercase", Justification = "C# Keywords are lower-case")]
public static string GetKeyword(CSharpKeyword keyword)
{
return keyword.ToString().ToLowerInvariant();

View File

@ -3,7 +3,6 @@
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using Microsoft.AspNet.Razor.Text;
using Microsoft.AspNet.Razor.Tokenizer;
@ -11,7 +10,6 @@ using Microsoft.AspNet.Razor.Tokenizer.Symbols;
namespace Microsoft.AspNet.Razor.Parser
{
[SuppressMessage("Microsoft.Design", "CA1005:AvoidExcessiveParametersOnGenericTypes", Justification = "All generic type parameters are required")]
public abstract class LanguageCharacteristics<TTokenizer, TSymbol, TSymbolType>
where TSymbolType : struct
where TTokenizer : Tokenizer<TSymbol, TSymbolType>

View File

@ -4,12 +4,11 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNet.Razor.Parser.SyntaxTree;
using Microsoft.AspNet.Razor.Compilation.TagHelpers;
using Microsoft.AspNet.Razor.Parser.SyntaxTree;
using Microsoft.AspNet.Razor.Text;
using Microsoft.AspNet.Razor.Utils;
@ -279,7 +278,6 @@ namespace Microsoft.AspNet.Razor.Parser
}
[Conditional("DEBUG")]
[SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic", Justification = "The method body is empty in Release builds")]
internal void AssertCurrent(char expected)
{
Debug.Assert(CurrentCharacter == expected);

View File

@ -3,7 +3,6 @@
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.Linq;
@ -27,7 +26,6 @@ namespace Microsoft.AspNet.Razor.Parser
}
// Returns true if the character is Whitespace and NOT a newline
[SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly", MessageId = "Whitespace", Justification = "This would be a breaking change in a shipping API")]
public static bool IsWhitespace(char value)
{
return value == ' ' ||
@ -37,7 +35,6 @@ namespace Microsoft.AspNet.Razor.Parser
CharUnicodeInfo.GetUnicodeCategory(value) == UnicodeCategory.SpaceSeparator;
}
[SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly", MessageId = "Whitespace", Justification = "This would be a breaking change in a shipping API")]
public static bool IsWhitespaceOrNewLine(char value)
{
return IsWhitespace(value) || IsNewLine(value);

View File

@ -3,15 +3,14 @@
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.AspNet.Razor.Compilation.TagHelpers;
using Microsoft.AspNet.Razor.Parser.SyntaxTree;
using Microsoft.AspNet.Razor.Parser.TagHelpers;
using Microsoft.AspNet.Razor.Parser.TagHelpers.Internal;
using Microsoft.AspNet.Razor.Compilation.TagHelpers;
using Microsoft.AspNet.Razor.Text;
namespace Microsoft.AspNet.Razor.Parser
@ -142,7 +141,6 @@ namespace Microsoft.AspNet.Razor.Parser
});
}
[SuppressMessage("Microsoft.Web.FxCop", "MW1200:DoNotConstructTaskInstances", Justification = "This rule is not applicable to this assembly.")]
public virtual Task CreateParseTask(TextReader input,
ParserVisitor consumer)
{

View File

@ -1,8 +1,6 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Diagnostics.CodeAnalysis;
namespace Microsoft.AspNet.Razor.Parser
{
public static class SyntaxConstants
@ -13,8 +11,6 @@ namespace Microsoft.AspNet.Razor.Parser
public static readonly string StartCommentSequence = "@*";
public static readonly string EndCommentSequence = "*@";
[SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Justification = "Class is nested to provide better organization")]
[SuppressMessage("Microsoft.Naming", "CA1724:TypeNamesShouldNotMatchNamespaces", Justification = "This type name should not cause a conflict")]
public static class CSharp
{
public static readonly int UsingKeywordLength = 5;

View File

@ -2,7 +2,6 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.Diagnostics.CodeAnalysis;
namespace Microsoft.AspNet.Razor.Parser.SyntaxTree
{
@ -13,13 +12,11 @@ namespace Microsoft.AspNet.Razor.Parser.SyntaxTree
NewLine = 1,
WhiteSpace = 2,
[SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly", MessageId = "NonWhite", Justification = "This is not a compound word, it is two words")]
NonWhiteSpace = 4,
AllWhiteSpace = NewLine | WhiteSpace,
Any = AllWhiteSpace | NonWhiteSpace,
[SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly", MessageId = "Newline", Justification = "This would be a breaking change to a previous released API")]
AnyExceptNewline = NonWhiteSpace | WhiteSpace
}
}

View File

@ -3,7 +3,6 @@
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.Linq;
using Microsoft.AspNet.Razor.Chunks.Generators;
@ -45,11 +44,6 @@ namespace Microsoft.AspNet.Razor.Parser.SyntaxTree
Children = contents;
}
[SuppressMessage(
"Microsoft.Naming",
"CA1721:PropertyNamesShouldNotMatchGetMethods",
Justification = "Type is the most appropriate name for this property and there is little chance of " +
"confusion with GetType")]
public BlockType Type { get; }
public IEnumerable<SyntaxTreeNode> Children { get; }

View File

@ -2,7 +2,6 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using Microsoft.AspNet.Razor.Chunks.Generators;
namespace Microsoft.AspNet.Razor.Parser.SyntaxTree
@ -21,11 +20,6 @@ namespace Microsoft.AspNet.Razor.Parser.SyntaxTree
ChunkGenerator = original.ChunkGenerator;
}
[SuppressMessage(
"Microsoft.Naming",
"CA1721:PropertyNamesShouldNotMatchGetMethods",
Justification = "Type is the most appropriate name for this property and there is little chance of " +
"confusion with GetType")]
public BlockType? Type { get; set; }
public IList<SyntaxTreeNode> Children { get; private set; }
public IParentChunkGenerator ChunkGenerator { get; set; }

View File

@ -4,10 +4,9 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using Microsoft.AspNet.Razor.Editor;
using Microsoft.AspNet.Razor.Chunks.Generators;
using Microsoft.AspNet.Razor.Editor;
using Microsoft.AspNet.Razor.Parser.SyntaxTree;
using Microsoft.AspNet.Razor.Tokenizer;
using Microsoft.AspNet.Razor.Tokenizer.Symbols;
@ -21,7 +20,6 @@ namespace Microsoft.AspNet.Razor.Parser
where TSymbol : SymbolBase<TSymbolType>
{
// Helpers
[SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic", Justification = "This only occurs in Release builds, where this method is empty by design")]
[Conditional("DEBUG")]
internal void Assert(TSymbolType expectedType)
{
@ -280,7 +278,6 @@ namespace Microsoft.AspNet.Razor.Parser
return PushSpanConfig(newConfig == null ? (Action<SpanBuilder, Action<SpanBuilder>>)null : (span, _) => newConfig(span));
}
[SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Justification = "The Action<T> parameters are preferred over custom delegates")]
protected IDisposable PushSpanConfig(Action<SpanBuilder, Action<SpanBuilder>> newConfig)
{
Action<SpanBuilder> old = SpanConfig;
@ -294,7 +291,6 @@ namespace Microsoft.AspNet.Razor.Parser
Initialize(Span);
}
[SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Justification = "The Action<T> parameters are preferred over custom delegates")]
protected void ConfigureSpan(Action<SpanBuilder, Action<SpanBuilder>> config)
{
Action<SpanBuilder> prev = SpanConfig;
@ -314,7 +310,6 @@ namespace Microsoft.AspNet.Razor.Parser
Expected(Language.GetKnownSymbolType(type));
}
[SuppressMessage("Microsoft.Usage", "CA1801:ReviewUnusedParameters", MessageId = "types", Justification = "It is used in debug builds")]
protected internal void Expected(params TSymbolType[] types)
{
Debug.Assert(!EndOfFile && CurrentSymbol != null && types.Contains(CurrentSymbol.Type));

View File

@ -2,14 +2,12 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.Diagnostics.CodeAnalysis;
using Microsoft.AspNet.Razor.Parser.SyntaxTree;
using Microsoft.AspNet.Razor.Tokenizer;
using Microsoft.AspNet.Razor.Tokenizer.Symbols;
namespace Microsoft.AspNet.Razor.Parser
{
[SuppressMessage("Microsoft.Design", "CA1005:AvoidExcessiveParametersOnGenericTypes", Justification = "All generic type parameters are required")]
public abstract partial class TokenizerBackedParser<TTokenizer, TSymbol, TSymbolType> : ParserBase
where TSymbolType : struct
where TTokenizer : Tokenizer<TSymbol, TSymbolType>

View File

@ -2,7 +2,6 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.Diagnostics.CodeAnalysis;
namespace Microsoft.AspNet.Razor
{
@ -23,7 +22,6 @@ namespace Microsoft.AspNet.Razor
/// Provisional may NOT be set with Rejected and SpanContextChanged may NOT be set with Accepted.
/// </remarks>
[Flags]
[SuppressMessage("Microsoft.Naming", "CA1714:FlagsEnumsShouldHavePluralNames", Justification = "The singular name is more appropriate here")]
public enum PartialParseResult
{
/// <summary>

View File

@ -5,7 +5,6 @@
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.IO;
using System.Text;
@ -100,9 +99,6 @@ namespace Microsoft.AspNet.Razor
}
}
[SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "This is debug only")]
[SuppressMessage("Microsoft.Web.FxCop", "MW1202:DoNotUseProblematicTaskTypes", Justification = "This rule is not applicable to this assembly.")]
[SuppressMessage("Microsoft.Web.FxCop", "MW1201:DoNotCallProblematicMethodsOnTask", Justification = "This rule is not applicable to this assembly.")]
private static void RunTask(Action action)
{
Task.Factory.StartNew(() =>

View File

@ -3,7 +3,6 @@
using System;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.IO;
using Microsoft.AspNet.Razor.Editor;
@ -99,7 +98,6 @@ namespace Microsoft.AspNet.Razor
get { return _currentParseTree; }
}
[SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate", Justification = "Since this method is heavily affected by side-effects, particularly calls to CheckForStructureChanges, it should not be made into a property")]
public virtual string GetAutoCompleteString()
{
if (_lastAutoCompleteSpan != null)
@ -187,8 +185,6 @@ namespace Microsoft.AspNet.Razor
GC.SuppressFinalize(this);
}
[SuppressMessage("Microsoft.Usage", "CA2213:DisposableFieldsShouldBeDisposed", MessageId = "_cancelTokenSource", Justification = "The cancellation token is owned by the worker thread, so it is disposed there")]
[SuppressMessage("Microsoft.Usage", "CA2213:DisposableFieldsShouldBeDisposed", MessageId = "_changeReceived", Justification = "The change received event is owned by the worker thread, so it is disposed there")]
protected virtual void Dispose(bool disposing)
{
if (disposing)
@ -242,7 +238,6 @@ namespace Microsoft.AspNet.Razor
return result;
}
[SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Exceptions are being caught here intentionally")]
private void OnDocumentParseComplete(DocumentParseCompleteEventArgs args)
{
using (_parser.SynchronizeMainThreadState())

View File

@ -3,11 +3,10 @@
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using Microsoft.AspNet.Razor.Chunks.Generators;
using Microsoft.AspNet.Razor.CodeGenerators;
using Microsoft.AspNet.Razor.Parser;
using Microsoft.AspNet.Razor.Compilation.TagHelpers;
using Microsoft.AspNet.Razor.Parser;
namespace Microsoft.AspNet.Razor
{
@ -35,10 +34,6 @@ namespace Microsoft.AspNet.Razor
private int _tabSize = 4;
[SuppressMessage(
"Microsoft.Usage",
"CA2214:DoNotCallOverridableMethodsInConstructors",
Justification = "The code path is safe, it is a property setter and not dependent on other state")]
protected RazorEngineHost()
{
GeneratedClassContext = GeneratedClassContext.Default;
@ -62,7 +57,6 @@ namespace Microsoft.AspNet.Razor
}
}
[SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors", Justification = "The code path is safe, it is a property setter and not dependent on other state")]
public RazorEngineHost(
RazorCodeLanguage codeLanguage,
Func<ParserBase> markupParserFactory)

View File

@ -3,7 +3,6 @@
using System;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Security.Cryptography;
using System.Text;
@ -73,10 +72,6 @@ namespace Microsoft.AspNet.Razor
/// <param name="input">The input text to parse.</param>
/// <param name="cancelToken">A token used to cancel the parser.</param>
/// <returns>The resulting parse tree.</returns>
[SuppressMessage(
"Microsoft.Reliability", "CA2000:Dispose objects before losing scope",
Justification = "Input object would be disposed if we dispose the wrapper. We don't own the input so " +
"we don't want to dispose it")]
public ParserResults ParseTemplate(ITextBuffer input, CancellationToken? cancelToken)
{
if (input == null)
@ -99,11 +94,6 @@ namespace Microsoft.AspNet.Razor
return ParseTemplateCore(new SeekableTextReader(input), sourceFileName, cancelToken: null);
}
[SuppressMessage(
"Microsoft.Reliability",
"CA2000:Dispose objects before losing scope",
Justification = "Input object would be disposed if we dispose the wrapper. We don't own the input so " +
"we don't want to dispose it")]
public ParserResults ParseTemplate(TextReader input, CancellationToken? cancelToken)
{
if (input == null)
@ -202,11 +192,6 @@ namespace Microsoft.AspNet.Razor
/// the Host. The default value (defined in the Host) can be used by providing null for this argument.
/// </param>
/// <returns>The resulting parse tree AND generated code.</returns>
[SuppressMessage(
"Microsoft.Reliability",
"CA2000:Dispose objects before losing scope",
Justification = "Input object would be disposed if we dispose the wrapper. We don't own the input so " +
"we don't want to dispose it")]
public GeneratorResults GenerateCode(
ITextBuffer input,
string className,
@ -344,11 +329,6 @@ namespace Microsoft.AspNet.Razor
}
}
[SuppressMessage(
"Microsoft.Reliability",
"CA2000:Dispose objects before losing scope",
Justification = "Input object would be disposed if we dispose the wrapper. We don't own the input so " +
"we don't want to dispose it")]
public GeneratorResults GenerateCode(
TextReader input,
string className,

View File

@ -1,7 +1,6 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Diagnostics.CodeAnalysis;
using System.Text;
namespace Microsoft.AspNet.Razor.Text
@ -13,7 +12,6 @@ namespace Microsoft.AspNet.Razor.Text
self.Position += characters;
}
[SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope", Justification = "The consumer is expected to dispose this object")]
public static ITextDocument ToDocument(this ITextBuffer self)
{
var ret = self as ITextDocument;

View File

@ -3,7 +3,6 @@
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using Microsoft.Extensions.Internal;
@ -35,7 +34,6 @@ namespace Microsoft.AspNet.Razor.Tokenizer.Symbols
public IEnumerable<RazorError> Errors { get; }
[SuppressMessage("Microsoft.Naming", "CA1721:PropertyNamesShouldNotMatchGetMethods", Justification = "This is the most appropriate name for this property and conflicts are unlikely")]
public TType Type { get; }
public override bool Equals(object obj)

View File

@ -3,7 +3,6 @@
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using Microsoft.AspNet.Razor.Parser.SyntaxTree;
using Microsoft.AspNet.Razor.Text;
@ -17,7 +16,6 @@ namespace Microsoft.AspNet.Razor.Tokenizer.Symbols
return GetContent(span, e => e);
}
[SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Justification = "Func<T> is the recommended type for generic delegates and requires this level of nesting")]
public static LocationTagged<string> GetContent(this SpanBuilder span, Func<IEnumerable<ISymbol>, IEnumerable<ISymbol>> filter)
{
return GetContent(filter(span.Symbols), span.Start);

View File

@ -1,19 +0,0 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Diagnostics.CodeAnalysis;
[assembly: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Foreach", Scope = "member", Target = "Microsoft.AspNet.Razor.Tokenizer.Symbols.CSharpKeyword.#Foreach", Justification = Justifications.SymbolTypeNames)]
[assembly: SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly", MessageId = "Readonly", Scope = "member", Target = "Microsoft.AspNet.Razor.Tokenizer.Symbols.CSharpKeyword.#Readonly", Justification = Justifications.SymbolTypeNames)]
[assembly: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Sbyte", Scope = "member", Target = "Microsoft.AspNet.Razor.Tokenizer.Symbols.CSharpKeyword.#Sbyte", Justification = Justifications.SymbolTypeNames)]
[assembly: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Sizeof", Scope = "member", Target = "Microsoft.AspNet.Razor.Tokenizer.Symbols.CSharpKeyword.#Sizeof", Justification = Justifications.SymbolTypeNames)]
[assembly: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Stackalloc", Scope = "member", Target = "Microsoft.AspNet.Razor.Tokenizer.Symbols.CSharpKeyword.#Stackalloc", Justification = Justifications.SymbolTypeNames)]
[assembly: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Typeof", Scope = "member", Target = "Microsoft.AspNet.Razor.Tokenizer.Symbols.CSharpKeyword.#Typeof", Justification = Justifications.SymbolTypeNames)]
[assembly: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Uint", Scope = "member", Target = "Microsoft.AspNet.Razor.Tokenizer.Symbols.CSharpKeyword.#Uint", Justification = Justifications.SymbolTypeNames)]
[assembly: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Ulong", Scope = "member", Target = "Microsoft.AspNet.Razor.Tokenizer.Symbols.CSharpKeyword.#Ulong", Justification = Justifications.SymbolTypeNames)]
[assembly: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Ushort", Scope = "member", Target = "Microsoft.AspNet.Razor.Tokenizer.Symbols.CSharpKeyword.#Ushort", Justification = Justifications.SymbolTypeNames)]
internal static partial class Justifications
{
internal const string SymbolTypeNames = "Symbol Type Names are spelled according to the language keyword or token they represent";
}

View File

@ -4,7 +4,6 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
#if DEBUG
using System.Globalization;
#endif
@ -19,7 +18,6 @@ namespace Microsoft.AspNet.Razor.Tokenizer
where TSymbolType : struct
where TSymbol : SymbolBase<TSymbolType>
{
[SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope", Justification = "TextDocumentReader does not require disposal")]
protected Tokenizer(ITextDocument source)
{
if (source == null)
@ -277,7 +275,6 @@ namespace Microsoft.AspNet.Razor.Tokenizer
return true;
}
[SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic", Justification = "This only occurs in Release builds, where this method is empty by design")]
[Conditional("DEBUG")]
internal void AssertCurrent(char current)
{

View File

@ -3,13 +3,11 @@
using System;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using Microsoft.AspNet.Razor.Text;
using Microsoft.AspNet.Razor.Tokenizer.Symbols;
namespace Microsoft.AspNet.Razor.Tokenizer
{
[SuppressMessage("Microsoft.Design", "CA1005:AvoidExcessiveParametersOnGenericTypes", Justification = "All generic parameters are required")]
public class TokenizerView<TTokenizer, TSymbol, TSymbolType>
where TSymbolType : struct
where TTokenizer : Tokenizer<TSymbol, TSymbolType>

View File

@ -19,7 +19,6 @@
"net451": {},
"dotnet5.4": {
"dependencies": {
"System.Diagnostics.Tools": "4.0.1-*",
"System.IO.FileSystem": "4.0.1-*",
"System.Linq": "4.0.1-*",
"System.Security.Cryptography.Algorithms": "4.0.0-*",