From de43b9780a993f544a2264f4cbdbf5a775121ac3 Mon Sep 17 00:00:00 2001 From: Adeel Date: Sun, 22 Dec 2013 16:19:56 +0300 Subject: [PATCH] Analysis: (CA1002) Do not expose generic lists. --- .../BrowserLink/PixelPushing/PixelPushingMode.cs | 2 +- EditorExtensions/BrowserLink/UnusedCss/RawRuleUsage.cs | 2 +- EditorExtensions/BrowserLink/UnusedCss/SessionResult.cs | 2 +- .../BrowserLink/UnusedCss/UnusedCssExtension.cs | 4 ++-- EditorExtensions/Commands/Code/IntellisenseWriter.cs | 7 ++++++- .../Commands/Code/ScriptIntellisenseListener.cs | 7 +++---- 6 files changed, 14 insertions(+), 10 deletions(-) diff --git a/EditorExtensions/BrowserLink/PixelPushing/PixelPushingMode.cs b/EditorExtensions/BrowserLink/PixelPushing/PixelPushingMode.cs index ad12266bb..cc7b22d71 100644 --- a/EditorExtensions/BrowserLink/PixelPushing/PixelPushingMode.cs +++ b/EditorExtensions/BrowserLink/PixelPushing/PixelPushingMode.cs @@ -45,7 +45,7 @@ public static bool IsPixelPushingModeEnabled } } } - public static List IgnoreList + public static IEnumerable IgnoreList { get { diff --git a/EditorExtensions/BrowserLink/UnusedCss/RawRuleUsage.cs b/EditorExtensions/BrowserLink/UnusedCss/RawRuleUsage.cs index 8194f9258..a55c9eb65 100644 --- a/EditorExtensions/BrowserLink/UnusedCss/RawRuleUsage.cs +++ b/EditorExtensions/BrowserLink/UnusedCss/RawRuleUsage.cs @@ -9,7 +9,7 @@ public class RawRuleUsage : IEquatable [JsonProperty] public string Selector { get; set; } [JsonProperty] - public List SourceLocations { get; private set; } + public IEnumerable SourceLocations { get; private set; } public RawRuleUsage() { diff --git a/EditorExtensions/BrowserLink/UnusedCss/SessionResult.cs b/EditorExtensions/BrowserLink/UnusedCss/SessionResult.cs index ae157d601..80bf446a1 100644 --- a/EditorExtensions/BrowserLink/UnusedCss/SessionResult.cs +++ b/EditorExtensions/BrowserLink/UnusedCss/SessionResult.cs @@ -18,7 +18,7 @@ public class SessionResult : IUsageDataSource, IResolutionRequiredDataSource [JsonProperty] public bool Continue { get; set; } [JsonProperty] - public List Sheets { get; private set; } + public IEnumerable Sheets { get; private set; } public IEnumerable AllRules { diff --git a/EditorExtensions/BrowserLink/UnusedCss/UnusedCssExtension.cs b/EditorExtensions/BrowserLink/UnusedCss/UnusedCssExtension.cs index 3a7e1a082..0965cef55 100644 --- a/EditorExtensions/BrowserLink/UnusedCss/UnusedCssExtension.cs +++ b/EditorExtensions/BrowserLink/UnusedCss/UnusedCssExtension.cs @@ -21,13 +21,13 @@ public class UnusedCssExtension : BrowserLinkExtension public static bool IsAnyConnectionAlive { get { return ExtensionByConnection.Count > 0; } } public BrowserLinkConnection Connection { get { return _connection; } } public bool IsRecording { get; private set; } - public static List IgnoreList + public static IEnumerable IgnoreList { get { var ignorePatterns = WESettings.GetString(WESettings.Keys.UnusedCss_IgnorePatterns) ?? ""; - return ignorePatterns.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries).Select(x => x.Trim()).ToList(); + return ignorePatterns.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries).Select(x => x.Trim()); } } private static List IgnorePatternList diff --git a/EditorExtensions/Commands/Code/IntellisenseWriter.cs b/EditorExtensions/Commands/Code/IntellisenseWriter.cs index 3f797f7f4..0d08991c8 100644 --- a/EditorExtensions/Commands/Code/IntellisenseWriter.cs +++ b/EditorExtensions/Commands/Code/IntellisenseWriter.cs @@ -164,12 +164,17 @@ public class IntellisenseObject public string FullName { get; set; } public bool IsEnum { get; set; } public string Summary { get; set; } - public List Properties { get; private set; } + public IList Properties { get; private set; } public IntellisenseObject() { Properties = new List(); } + + public IntellisenseObject(IList properties) + { + Properties = properties; + } } public class IntellisenseProperty diff --git a/EditorExtensions/Commands/Code/ScriptIntellisenseListener.cs b/EditorExtensions/Commands/Code/ScriptIntellisenseListener.cs index 7584fb428..c1e9fd21e 100644 --- a/EditorExtensions/Commands/Code/ScriptIntellisenseListener.cs +++ b/EditorExtensions/Commands/Code/ScriptIntellisenseListener.cs @@ -163,11 +163,11 @@ private static void ProcessEnum(CodeEnum element, List list) private static void ProcessClass(CodeClass cc, List list) { - var props = GetProperties(cc.Members, new HashSet()).ToList(); + var properties = GetProperties(cc.Members, new HashSet()).ToList(); - if (props.Any()) + if (properties.Any()) { - var intellisenseObject = new IntellisenseObject + var intellisenseObject = new IntellisenseObject(properties) { Namespace = GetNamespace(cc), Name = cc.Name, @@ -175,7 +175,6 @@ private static void ProcessClass(CodeClass cc, List list) Summary = GetSummary(cc), }; - intellisenseObject.Properties.AddRange(props); list.Add(intellisenseObject); } }