Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename - fix casing of IMSBuildElementLocation #10507

Merged
merged 2 commits into from
Aug 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/Build/BuildCheck/API/BuildCheckResult.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ namespace Microsoft.Build.Experimental.BuildCheck;
/// </summary>
public sealed class BuildCheckResult : IBuildCheckResult
{
public static BuildCheckResult Create(CheckRule rule, IMsBuildElementLocation location, params string[] messageArgs)
public static BuildCheckResult Create(CheckRule rule, IMSBuildElementLocation location, params string[] messageArgs)
{
return new BuildCheckResult(rule, location, messageArgs);
}

public BuildCheckResult(CheckRule checkConfig, IMsBuildElementLocation location, string[] messageArgs)
public BuildCheckResult(CheckRule checkConfig, IMSBuildElementLocation location, string[] messageArgs)
{
CheckRule = checkConfig;
Location = location;
Expand All @@ -43,7 +43,7 @@ internal BuildEventArgs ToEventArgs(CheckResultSeverity severity)
/// <summary>
/// Optional location of the finding (in near future we might need to support multiple locations).
/// </summary>
public IMsBuildElementLocation Location { get; }
public IMSBuildElementLocation Location { get; }

public string LocationString => Location.LocationString;

Expand Down
14 changes: 7 additions & 7 deletions src/Build/BuildCheck/Checks/PropertiesUsageCheck.cs
Original file line number Diff line number Diff line change
Expand Up @@ -118,13 +118,13 @@ public override void RegisterInternalActions(IInternalCheckRegistrationContext r
}
}

private Dictionary<string, IMsBuildElementLocation?> _writenProperties = new(MSBuildNameIgnoreCaseComparer.Default);
private Dictionary<string, IMSBuildElementLocation?> _writenProperties = new(MSBuildNameIgnoreCaseComparer.Default);
private HashSet<string> _readProperties = new(MSBuildNameIgnoreCaseComparer.Default);
// For the 'Property Initialized after used' check - we are interested in cases where:
// 1. Property is read anywhere and then initialized in the checked scope.
// 2. Property is read in the checked scope and then initialized anywhere.
private Dictionary<string, IMsBuildElementLocation> _uninitializedReadsInScope = new(MSBuildNameIgnoreCaseComparer.Default);
private Dictionary<string, IMsBuildElementLocation> _uninitializedReadsOutOfScope = new(MSBuildNameIgnoreCaseComparer.Default);
private Dictionary<string, IMSBuildElementLocation> _uninitializedReadsInScope = new(MSBuildNameIgnoreCaseComparer.Default);
private Dictionary<string, IMSBuildElementLocation> _uninitializedReadsOutOfScope = new(MSBuildNameIgnoreCaseComparer.Default);

private void ProcessPropertyWrite(BuildCheckDataContext<PropertyWriteData> context)
{
Expand All @@ -142,7 +142,7 @@ private void ProcessPropertyWrite(BuildCheckDataContext<PropertyWriteData> conte
// For initialized after used check - we can remove the read from dictionary after hitting write - because
// once the property is written it should no more be uninitialized (so shouldn't be added again).

if (_uninitializedReadsInScope.TryGetValue(writeData.PropertyName, out IMsBuildElementLocation? uninitInScopeReadLocation))
if (_uninitializedReadsInScope.TryGetValue(writeData.PropertyName, out IMSBuildElementLocation? uninitInScopeReadLocation))
{
_uninitializedReadsInScope.Remove(writeData.PropertyName);

Expand All @@ -154,7 +154,7 @@ private void ProcessPropertyWrite(BuildCheckDataContext<PropertyWriteData> conte

if (CheckScopeClassifier.IsActionInObservedScope(_initializedAfterUseScope,
writeData.ElementLocation, writeData.ProjectFilePath) &&
_uninitializedReadsOutOfScope.TryGetValue(writeData.PropertyName, out IMsBuildElementLocation? uninitOutScopeReadLocation))
_uninitializedReadsOutOfScope.TryGetValue(writeData.PropertyName, out IMSBuildElementLocation? uninitOutScopeReadLocation))
{
_uninitializedReadsOutOfScope.Remove(writeData.PropertyName);

Expand Down Expand Up @@ -236,7 +236,7 @@ private void DoneWithProject(BuildCheckDataContext<ProjectRequestProcessingDoneD
}

_readProperties = new HashSet<string>(MSBuildNameIgnoreCaseComparer.Default);
_writenProperties = new Dictionary<string, IMsBuildElementLocation?>(MSBuildNameIgnoreCaseComparer.Default);
_uninitializedReadsInScope = new Dictionary<string, IMsBuildElementLocation>(MSBuildNameIgnoreCaseComparer.Default);
_writenProperties = new Dictionary<string, IMSBuildElementLocation?>(MSBuildNameIgnoreCaseComparer.Default);
_uninitializedReadsInScope = new Dictionary<string, IMSBuildElementLocation>(MSBuildNameIgnoreCaseComparer.Default);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ internal static class CheckScopeClassifier
/// <exception cref="ArgumentOutOfRangeException"></exception>
internal static bool IsActionInObservedScope(
EvaluationCheckScope scope,
IMsBuildElementLocation? location,
IMSBuildElementLocation? location,
string projectFileFullPath)
=> IsActionInObservedScope(scope, location?.File, projectFileFullPath);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ internal readonly record struct PropertyReadInfo(
string PropertyName,
int StartIndex,
int EndIndex,
IMsBuildElementLocation ElementLocation,
IMSBuildElementLocation ElementLocation,
bool IsUninitialized,
PropertyReadContext PropertyReadContext);
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ namespace Microsoft.Build.Experimental.BuildCheck.Infrastructure;
internal readonly record struct PropertyWriteInfo(
string PropertyName,
bool IsEmpty,
IMsBuildElementLocation? ElementLocation);
IMSBuildElementLocation? ElementLocation);
4 changes: 2 additions & 2 deletions src/Build/BuildCheck/OM/PropertyReadData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ internal class PropertyReadData(
string projectFilePath,
int? projectConfigurationId,
string propertyName,
IMsBuildElementLocation elementLocation,
IMSBuildElementLocation elementLocation,
bool isUninitialized,
PropertyReadContext propertyReadContext)
: CheckData(projectFilePath, projectConfigurationId)
Expand All @@ -40,7 +40,7 @@ public PropertyReadData(
/// <summary>
/// Location of the property access.
/// </summary>
public IMsBuildElementLocation ElementLocation { get; } = elementLocation;
public IMSBuildElementLocation ElementLocation { get; } = elementLocation;

/// <summary>
/// Indicates whether the property was accessed before being initialized.
Expand Down
4 changes: 2 additions & 2 deletions src/Build/BuildCheck/OM/PropertyWriteData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ internal class PropertyWriteData(
string projectFilePath,
int? projectConfigurationId,
string propertyName,
IMsBuildElementLocation? elementLocation,
IMSBuildElementLocation? elementLocation,
bool isEmpty)
: CheckData(projectFilePath, projectConfigurationId)
{
Expand All @@ -37,7 +37,7 @@ public PropertyWriteData(string projectFilePath, int? projectConfigurationId, Pr
/// If the location is null, it means that the property doesn't come from xml, but rather other sources
/// (environment variable, global property, toolset properties etc.).
/// </summary>
public IMsBuildElementLocation? ElementLocation { get; } = elementLocation;
public IMSBuildElementLocation? ElementLocation { get; } = elementLocation;

/// <summary>
/// Was any value written? (E.g. if we set propA with value propB, while propB is undefined - the isEmpty will be true).
Expand Down
4 changes: 2 additions & 2 deletions src/Shared/IElementLocation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

namespace Microsoft.Build.Shared
{
internal interface IElementLocation : IMsBuildElementLocation, ITranslatable { }
internal interface IElementLocation : IMSBuildElementLocation, ITranslatable { }

/// <summary>
/// Represents the location information for error reporting purposes. This is normally used to
Expand All @@ -20,7 +20,7 @@ internal interface IElementLocation : IMsBuildElementLocation, ITranslatable { }
/// This is currently internal - but it is prepared to be made public once it will be needed by other public BuildCheck OM
/// (e.g. by property read/write OM)
/// </remarks>
public interface IMsBuildElementLocation
public interface IMSBuildElementLocation
{
/// <summary>
/// The file from which this particular element originated. It may
Expand Down