Skip to content

Commit 7eed9a0

Browse files
Fix remaining violations: IDE1006/IDE0060/IDE0090/CA1859/IDE0130
- IDE1006 naming: renamed 89 private/internal static fields to s_ prefix and instance fields to _ prefix; suppressed public API constants that can't be renamed without breaking changes (iOSBroker*, Prompt.*, XmlNamespace.*) - IDE1006: renamed private Base64* constants, IosBroker* internal members - IDE0060: added #pragma suppress for 4 unused params reserved for future use - IDE0090: fixed new() in 8 more files (HashSet, StringBuilder, Dictionary) - CA1859: changed IDictionary/ISet/IRegionManager to concrete types in 5 files - IDE0130: suppressed globally - intentional flat namespace Microsoft.Identity.Client - editorconfig: scoped static_fields naming rule to private+internal (not public) to avoid false positives on public static fields Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent f28ddc3 commit 7eed9a0

66 files changed

Lines changed: 326 additions & 304 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.editorconfig

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ dotnet_naming_rule.static_fields_should_have_prefix.style = static_prefix_style
7575

7676
dotnet_naming_symbols.static_fields.applicable_kinds = field
7777
dotnet_naming_symbols.static_fields.required_modifiers = static
78+
dotnet_naming_symbols.static_fields.applicable_accessibilities = private, internal, private_protected
7879

7980
dotnet_naming_style.static_prefix_style.required_prefix = s_
8081
dotnet_naming_style.static_prefix_style.capitalization = camel_case
@@ -884,6 +885,11 @@ dotnet_diagnostic.IDE0039.severity = none
884885
dotnet_diagnostic.IDE0051.severity = none
885886
dotnet_diagnostic.IDE0052.severity = none
886887

888+
# Namespace does not match folder structure (IDE0130)
889+
# Disabled: intentional flat namespace design - all public types use Microsoft.Identity.Client
890+
# regardless of subfolder, to maintain a clean public API surface
891+
dotnet_diagnostic.IDE0130.severity = none
892+
887893
# Use range subscript operator (x[^1]) - requires .NET 5+ (System.Index not available in net462/netstandard2.0)
888894
dotnet_diagnostic.IDE0056.severity = none
889895

src/client/Microsoft.Identity.Client/ApiConfig/AcquireTokenInteractiveParameterBuilder.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -251,14 +251,14 @@ private AcquireTokenInteractiveParameterBuilder WithParentObject(object parent)
251251
}
252252

253253
#if NET_CORE
254-
private static readonly Type WinUIWindowType = Type.GetType("Microsoft.UI.Xaml.Window, Microsoft.WinUI");
254+
private static readonly Type s_winUIWindowType = Type.GetType("Microsoft.UI.Xaml.Window, Microsoft.WinUI");
255255

256256
/// <summary>
257257
/// Checks if an object is a WinUI3 Window or derives from one
258258
/// </summary>
259259
private static bool IsWinUI3Window(object obj)
260260
{
261-
return obj != null && WinUIWindowType?.IsAssignableFrom(obj.GetType()) == true;
261+
return obj != null && s_winUIWindowType?.IsAssignableFrom(obj.GetType()) == true;
262262
}
263263
#endif
264264

src/client/Microsoft.Identity.Client/ApiConfig/Parameters/AcquireTokenInteractiveParameters.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ namespace Microsoft.Identity.Client.ApiConfig.Parameters
1414

1515
internal class AcquireTokenInteractiveParameters : IAcquireTokenParameters
1616
{
17-
public Prompt Prompt { get; set; } = Prompt.NotSpecified;
17+
public Prompt Prompt { get; set; } = Prompt.s_notSpecified;
1818
public CoreUIParent UiParent { get; } = new CoreUIParent();
1919

2020
/// <summary>

src/client/Microsoft.Identity.Client/AppConfig/AuthorityInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ internal bool IsDefaultAuthority
304304
}
305305
}
306306

307-
internal static readonly char[] separator =
307+
internal static readonly char[] s_separator =
308308
[
309309
'/'
310310
];
@@ -437,7 +437,7 @@ private static bool IsCiamAuthority(Uri authorityUri)
437437
private static string[] GetPathSegments(string absolutePath)
438438
{
439439
string[] pathSegments = absolutePath.Split(
440-
separator,
440+
s_separator,
441441
StringSplitOptions.RemoveEmptyEntries);
442442

443443
return pathSegments;

src/client/Microsoft.Identity.Client/AuthenticationHeaderParser.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ namespace Microsoft.Identity.Client
1919
/// </summary>
2020
public class AuthenticationHeaderParser
2121
{
22-
private static readonly Lazy<IMsalHttpClientFactory> _httpClientFactory = new(
22+
private static readonly Lazy<IMsalHttpClientFactory> s_httpClientFactory = new(
2323
() => PlatformProxyFactory.CreatePlatformProxy(null).CreateDefaultHttpClientFactory());
2424

2525
/// <summary>
@@ -116,7 +116,7 @@ public static AuthenticationHeaderParser ParseAuthenticationHeaders(HttpResponse
116116
/// </summary>
117117
internal static HttpClient GetHttpClient()
118118
{
119-
return _httpClientFactory.Value.GetHttpClient();
119+
return s_httpClientFactory.Value.GetHttpClient();
120120
}
121121

122122
/// <summary>

src/client/Microsoft.Identity.Client/AuthenticationInfoParameters.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public static AuthenticationInfoParameters CreateFromResponseHeaders(HttpRespons
6161
{
6262
var authInfoValue = authInfoValueList.FirstOrDefault();
6363
var AuthValuesSplit = authInfoValue.Split([' '], 2);
64-
IDictionary<string, string> paramValues;
64+
Dictionary<string, string> paramValues;
6565

6666
if (AuthValuesSplit.Length != 2)
6767
{

src/client/Microsoft.Identity.Client/Cache/Items/CacheSerializationContract.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ namespace Microsoft.Identity.Client.Cache.Items
1919
internal class CacheSerializationContract(IDictionary<string, JToken> unknownNodes)
2020
{
2121
#if SUPPORTS_SYSTEM_TEXT_JSON
22-
private static readonly JsonSerializerOptions NeverIgnoreJsonOptions = new()
22+
private static readonly JsonSerializerOptions s_neverIgnoreJsonOptions = new()
2323
{
2424
DefaultIgnoreCondition = System.Text.Json.Serialization.JsonIgnoreCondition.Never
2525
};
@@ -150,7 +150,7 @@ static IEnumerable<JObject> GetElement(JObject root, string key)
150150
#endif
151151
}
152152

153-
private static IDictionary<string, JToken> ExtractUnknownNodes(JObject root)
153+
private static Dictionary<string, JToken> ExtractUnknownNodes(JObject root)
154154
{
155155
#if SUPPORTS_SYSTEM_TEXT_JSON
156156
return root
@@ -220,7 +220,7 @@ internal string ToJsonString()
220220
#endif
221221
}
222222
#if SUPPORTS_SYSTEM_TEXT_JSON
223-
return root.ToJsonString(NeverIgnoreJsonOptions);
223+
return root.ToJsonString(s_neverIgnoreJsonOptions);
224224
#else
225225
return JsonConvert.SerializeObject(
226226
root,

src/client/Microsoft.Identity.Client/Cache/Items/MsalAccessTokenCacheItem.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ internal void InitCacheKey()
232232
ScopeString,
233233
_extraKeyParts);
234234

235-
iOSCacheKeyLazy = new Lazy<IiOSKey>(InitiOSKey);
235+
_iOSCacheKeyLazy = new Lazy<IiOSKey>(InitiOSKey);
236236
}
237237

238238
internal string ToLogString(bool piiEnabled = false)
@@ -307,8 +307,8 @@ internal string TenantId
307307
/// </summary>
308308
internal IDictionary<string, string> PersistedCacheParameters { get; private set; }
309309

310-
private Lazy<IiOSKey> iOSCacheKeyLazy;
311-
public IiOSKey iOSCacheKey => iOSCacheKeyLazy.Value;
310+
private Lazy<IiOSKey> _iOSCacheKeyLazy;
311+
public IiOSKey iOSCacheKey => _iOSCacheKeyLazy.Value;
312312

313313
internal static MsalAccessTokenCacheItem FromJsonString(string json)
314314
{

src/client/Microsoft.Identity.Client/Cache/Items/MsalAccountCacheItem.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,8 @@ internal MsalAccountCacheItem(
132132
internal IDictionary<string, string> WamAccountIds { get; set; }
133133
public string CacheKey { get; private set; }
134134

135-
private Lazy<IiOSKey> iOSCacheKeyLazy;
136-
public IiOSKey iOSCacheKey => iOSCacheKeyLazy.Value;
135+
private Lazy<IiOSKey> _iOSCacheKeyLazy;
136+
public IiOSKey iOSCacheKey => _iOSCacheKeyLazy.Value;
137137

138138
private void Init(
139139
string environment,
@@ -167,7 +167,7 @@ internal void InitCacheKey()
167167
{
168168
CacheKey = $"{HomeAccountId}{MsalCacheKeys.CacheKeyDelimiter}{Environment}{MsalCacheKeys.CacheKeyDelimiter}{TenantId}";
169169

170-
iOSCacheKeyLazy = new Lazy<IiOSKey>(InitiOSKey);
170+
_iOSCacheKeyLazy = new Lazy<IiOSKey>(InitiOSKey);
171171
}
172172

173173
#region iOS
@@ -183,7 +183,7 @@ private IiOSKey InitiOSKey()
183183
// This is a known issue.
184184
// Normally AuthorityType should be passed here but since while building the MsalAccountCacheItem it is defaulted to "MSSTS",
185185
// keeping the default value here.
186-
int iOSType = MsalCacheKeys.iOSAuthorityTypeToAttrType[CacheAuthorityType.MSSTS.ToString()];
186+
int iOSType = MsalCacheKeys.s_iOSAuthorityTypeToAttrType[CacheAuthorityType.MSSTS.ToString()];
187187

188188
return new IosKey(iOSAccount, iOSService, iOSGeneric, iOSType);
189189
}

src/client/Microsoft.Identity.Client/Cache/Items/MsalAppMetadataCacheItem.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ private void InitCacheKey()
3636
CacheKey = ($"{StorageJsonKeys.AppMetadata}{MsalCacheKeys.CacheKeyDelimiter}" +
3737
$"{Environment}{MsalCacheKeys.CacheKeyDelimiter}{ClientId}").ToLowerInvariant();
3838

39-
iOSCacheKeyLazy = new Lazy<IiOSKey>(InitiOSKey);
39+
_iOSCacheKeyLazy = new Lazy<IiOSKey>(InitiOSKey);
4040
}
4141

4242
#region iOS
@@ -70,8 +70,8 @@ private IiOSKey InitiOSKey()
7070
public string FamilyId { get; }
7171
public string CacheKey { get; private set; }
7272

73-
private Lazy<IiOSKey> iOSCacheKeyLazy;
74-
public IiOSKey iOSCacheKey => iOSCacheKeyLazy.Value;
73+
private Lazy<IiOSKey> _iOSCacheKeyLazy;
74+
public IiOSKey iOSCacheKey => _iOSCacheKeyLazy.Value;
7575

7676
internal static MsalAppMetadataCacheItem FromJsonString(string json)
7777
{

0 commit comments

Comments
 (0)