From 254eaac9faec6f6f5ea464159b65d2530de08aac Mon Sep 17 00:00:00 2001 From: Steven Kirk Date: Wed, 10 Jun 2015 22:36:33 +0200 Subject: [PATCH] Stylecop fixes. --- Perspex.Base/Collections/PerspexList.cs | 2 +- Perspex.Base/GlobalSuppressions.cs | 14 +++++++++ Perspex.Base/Perspex.Base.csproj | 1 + Perspex.Base/PerspexObject.cs | 1 - Perspex.Base/PerspexProperty.cs | 2 +- .../Platform/IPlatformThreadingInterface.cs | 7 +++-- Perspex.Base/PriorityLevel.cs | 29 ++++++++++--------- Perspex.Base/Utilities/TypeUtilities.cs | 3 +- .../ListBoxTests.cs | 2 +- 9 files changed, 39 insertions(+), 22 deletions(-) create mode 100644 Perspex.Base/GlobalSuppressions.cs diff --git a/Perspex.Base/Collections/PerspexList.cs b/Perspex.Base/Collections/PerspexList.cs index aff10b13e6..5d4b6ef4e8 100644 --- a/Perspex.Base/Collections/PerspexList.cs +++ b/Perspex.Base/Collections/PerspexList.cs @@ -20,7 +20,7 @@ namespace Perspex.Collections /// /// PerspexList is similar to /// except that when the method is called, it notifies with a - /// action, passing the items that were + /// action, passing the items that were /// removed. /// public class PerspexList : IPerspexList, INotifyCollectionChanged, INotifyPropertyChanged diff --git a/Perspex.Base/GlobalSuppressions.cs b/Perspex.Base/GlobalSuppressions.cs new file mode 100644 index 0000000000..3d080850f1 --- /dev/null +++ b/Perspex.Base/GlobalSuppressions.cs @@ -0,0 +1,14 @@ +// ----------------------------------------------------------------------- +// +// Copyright 2015 MIT Licence. See licence.md for more information. +// +// ----------------------------------------------------------------------- + +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage( + "StyleCop.CSharp.MaintainabilityRules", + "SA1401:Fields must be private", + Justification = "PerspexProperty fields should not be private.")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage( + "StyleCop.CSharp.DocumentationRules", + "SA1609:Property documentation must have value", + Justification = "This rule is fscking pointless")] \ No newline at end of file diff --git a/Perspex.Base/Perspex.Base.csproj b/Perspex.Base/Perspex.Base.csproj index 7a79bd16f2..56b4bb0a48 100644 --- a/Perspex.Base/Perspex.Base.csproj +++ b/Perspex.Base/Perspex.Base.csproj @@ -38,6 +38,7 @@ + diff --git a/Perspex.Base/PerspexObject.cs b/Perspex.Base/PerspexObject.cs index edc050e59b..7ec12f13e2 100644 --- a/Perspex.Base/PerspexObject.cs +++ b/Perspex.Base/PerspexObject.cs @@ -18,7 +18,6 @@ namespace Perspex using Serilog.Core.Enrichers; using Perspex.Utilities; - /// /// The priority of a binding. /// diff --git a/Perspex.Base/PerspexProperty.cs b/Perspex.Base/PerspexProperty.cs index d0f9d15037..7cfec4387d 100644 --- a/Perspex.Base/PerspexProperty.cs +++ b/Perspex.Base/PerspexProperty.cs @@ -6,11 +6,11 @@ namespace Perspex { - using Perspex.Utilities; using System; using System.Collections.Generic; using System.Reactive.Subjects; using System.Reflection; + using Perspex.Utilities; /// /// A perspex property. diff --git a/Perspex.Base/Platform/IPlatformThreadingInterface.cs b/Perspex.Base/Platform/IPlatformThreadingInterface.cs index d594abeb49..8b7e8b97ff 100644 --- a/Perspex.Base/Platform/IPlatformThreadingInterface.cs +++ b/Perspex.Base/Platform/IPlatformThreadingInterface.cs @@ -7,15 +7,16 @@ namespace Perspex.Platform { using System; - using System.Threading; - using System.Threading.Tasks; - using Perspex.Threading; /// /// Provides platform-specific services relating to threading. /// public interface IPlatformThreadingInterface { + /// + /// Checks whether there are messages waiting to be processed. + /// + /// True if there are messages waiting, otherwise false. bool HasMessages(); /// diff --git a/Perspex.Base/PriorityLevel.cs b/Perspex.Base/PriorityLevel.cs index f11dd07347..dfa8d37c51 100644 --- a/Perspex.Base/PriorityLevel.cs +++ b/Perspex.Base/PriorityLevel.cs @@ -31,21 +31,21 @@ namespace Perspex /// /// /// - /// Each priority level in a has a current , - /// a list of and a . When there are no + /// Each priority level in a has a current , + /// a list of and a . When there are no /// bindings present, or all bindings return then - /// Value will equal DirectValue. + /// Value will equal DirectValue. /// /// - /// When there are bindings present, then the latest added binding that doesn't return - /// UnsetValue will take precedence. The active binding is returned by the - /// property (which refers to the active binding's - /// property rather than the index in + /// When there are bindings present, then the latest added binding that doesn't return + /// UnsetValue will take precedence. The active binding is returned by the + /// property (which refers to the active binding's + /// property rather than the index in /// Bindings). /// /// /// If DirectValue is set while a binding is active, then it will replace the - /// current value until the active binding fires again/ + /// current value until the active binding fires again. /// /// internal class PriorityLevel @@ -71,9 +71,10 @@ namespace Perspex /// Initializes a new instance of the class. /// /// The priority. + /// The precedence mode. /// A method to be called when the current value changes. public PriorityLevel( - int priority, + int priority, LevelPrecedenceMode mode, Action changed) { @@ -115,7 +116,7 @@ namespace Perspex public object Value { get; private set; } /// - /// Gets the value of the active binding, or -1 + /// Gets the value of the active binding, or -1 /// if no binding is active. /// public int ActiveBindingIndex { get; private set; } @@ -150,13 +151,13 @@ namespace Perspex }); } - /// + /// /// Invoked when an entry in changes value. /// /// The entry that changed. private void Changed(PriorityBindingEntry entry) { - if (mode == LevelPrecedenceMode.Latest || entry.Index >= this.ActiveBindingIndex) + if (this.mode == LevelPrecedenceMode.Latest || entry.Index >= this.ActiveBindingIndex) { if (entry.Value != PerspexProperty.UnsetValue) { @@ -171,7 +172,7 @@ namespace Perspex } } - /// + /// /// Invoked when an entry in completes. /// /// The entry that completed. @@ -185,7 +186,7 @@ namespace Perspex } } - /// + /// /// Activates the first binding that has a value. /// private void ActivateFirstBinding() diff --git a/Perspex.Base/Utilities/TypeUtilities.cs b/Perspex.Base/Utilities/TypeUtilities.cs index 6ef08616ae..d2e7872216 100644 --- a/Perspex.Base/Utilities/TypeUtilities.cs +++ b/Perspex.Base/Utilities/TypeUtilities.cs @@ -16,7 +16,8 @@ namespace Perspex.Utilities /// internal static class TypeUtilities { - private static readonly Dictionary> Conversions = new Dictionary>() { + private static readonly Dictionary> Conversions = new Dictionary>() + { { typeof(decimal), new List { typeof(sbyte), typeof(byte), typeof(short), typeof(ushort), typeof(int), typeof(uint), typeof(long), typeof(ulong), typeof(char) } }, { typeof(double), new List { typeof(sbyte), typeof(byte), typeof(short), typeof(ushort), typeof(int), typeof(uint), typeof(long), typeof(ulong), typeof(char), typeof(float) } }, { typeof(float), new List { typeof(sbyte), typeof(byte), typeof(short), typeof(ushort), typeof(int), typeof(uint), typeof(long), typeof(ulong), typeof(char), typeof(float) } }, diff --git a/Tests/Perspex.Controls.UnitTests/ListBoxTests.cs b/Tests/Perspex.Controls.UnitTests/ListBoxTests.cs index 114adf0fef..7c71c01c87 100644 --- a/Tests/Perspex.Controls.UnitTests/ListBoxTests.cs +++ b/Tests/Perspex.Controls.UnitTests/ListBoxTests.cs @@ -1,5 +1,5 @@ // ----------------------------------------------------------------------- -// +// // Copyright 2014 MIT Licence. See licence.md for more information. // // -----------------------------------------------------------------------