Skip to content

GeertvanHorrik/WpfAnalyzers

 
 

Repository files navigation

WpfAnalyzers

Join the chat at https://gitter.im/DotNetAnalyzers/WpfAnalyzers License Build status NuGet

Roslyn analyzers for WPF.

WPF0001 Backing field for a DependencyProperty should match registered name.
WPF0002 Backing field for a DependencyPropertyKey should match registered name.
WPF0003 CLR property for a DependencyProperty should match registered name.
WPF0004 CLR method for a DependencyProperty should match registered name.
WPF0005 Name of PropertyChangedCallback should match registered name.
WPF0006 Name of CoerceValueCallback should match registered name.
WPF0007 Name of ValidateValueCallback should match registered name.
WPF0010 Default value type must match registered type.
WPF0011 Containing type should be used as registered owner.
WPF0012 CLR property type should match registered type.
WPF0013 CLR accessor for attached property must match registered type.
WPF0014 SetValue must use registered type.
WPF0015 Registered owner type must inherit DependencyObject.
WPF0016 Default value is shared reference type.
WPF0030 Backing field for a DependencyProperty should be static and readonly.
WPF0031 DependencyPropertyKey field must come before DependencyProperty field.
WPF0032 Use same dependency property in get and set.
WPF0040 A readonly DependencyProperty must be set with DependencyPropertyKey.
WPF0041 Set mutable dependency properties using SetCurrentValue.
WPF0042 Avoid side effects in CLR accessors.
WPF0043 Don't set DataContext using SetCurrentValue.
WPF0050 XmlnsPrefix must map to the same url as XmlnsDefinition.
WPF0051 XmlnsDefinition must map to existing namespace.
WPF1001 Struct must not implement INotifyPropertyChanged
WPF1010 Mutable public property should notify.
WPF1011 Implement INotifyPropertyChanged.
WPF1012 Notify when property changes.

Using WpfAnalyzers

The preferable way to use the analyzers is to add the nuget package WpfAnalyzers to the project(s).

The severity of individual rules may be configured using rule set files in Visual Studio 2015.

Installation

WpfAnalyzers can be installed using Paket or the NuGet command line or the NuGet Package Manager in Visual Studio 2015.

Install using the command line:

Install-Package WpfAnalyzers

Updating

The ruleset editor does not handle changes IDs well, if things get out of sync you can try:

  1. Close visual studio.
  2. Edit the ProjectName.rulset file and remove the WpfAnalyzers element.
  3. Start visual studio and add back the desired configuration.

Above is not ideal, sorry about this. Not sure this is our bug.

Current status

Early alpha, names and IDs may change.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 99.7%
  • PowerShell 0.3%