Permalink
Fetching contributors…
Cannot retrieve contributors at this time
31 lines (25 sloc) 1.04 KB
// Copyright (c) Josef Pihrt. 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.Immutable;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Diagnostics;
namespace Roslynator.CSharp.Analysis.MakeMemberReadOnly
{
[DiagnosticAnalyzer(LanguageNames.CSharp)]
public class UseReadOnlyAutoPropertyAnalyzer : BaseDiagnosticAnalyzer
{
public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics
{
get { return ImmutableArray.Create(DiagnosticDescriptors.UseReadOnlyAutoProperty); }
}
public override void Initialize(AnalysisContext context)
{
if (context == null)
throw new ArgumentNullException(nameof(context));
base.Initialize(context);
context.RegisterSymbolAction(
UseReadOnlyAutoPropertyAnalysis.Instance.AnalyzeNamedType,
SymbolKind.NamedType);
}
}
}