-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial version of properties analyzer (#10457)
* Initial version of properties analyzer * Improve the properties analyzers * Fix the property analyzers * Fix suppressions * Fix after merge * Fix test * Reflect PR comments
- Loading branch information
1 parent
df2d59b
commit b7e76d1
Showing
25 changed files
with
586 additions
and
96 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
src/Build/BuildCheck/API/IInternalCheckRegistrationContext.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
using System; | ||
|
||
namespace Microsoft.Build.Experimental.BuildCheck.Checks; | ||
|
||
internal interface IInternalCheckRegistrationContext : IBuildCheckRegistrationContext | ||
{ | ||
void RegisterPropertyReadAction(Action<BuildCheckDataContext<PropertyReadData>> propertyReadAction); | ||
|
||
void RegisterPropertyWriteAction(Action<BuildCheckDataContext<PropertyWriteData>> propertyWriteAction); | ||
|
||
void RegisterProjectRequestProcessingDoneAction(Action<BuildCheckDataContext<ProjectRequestProcessingDoneData>> propertyWriteAction); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
using System; | ||
using Microsoft.Build.Experimental.BuildCheck; | ||
|
||
namespace Microsoft.Build.Experimental.BuildCheck.Checks; | ||
|
||
internal abstract class InternalCheck : Check | ||
{ | ||
/// <summary> | ||
/// Used by the implementors to subscribe to data and events they are interested in. | ||
/// This offers superset of registrations options to <see cref="Check.RegisterActions"/>. | ||
/// </summary> | ||
/// <param name="registrationContext"></param> | ||
public abstract void RegisterInternalActions(IInternalCheckRegistrationContext registrationContext); | ||
|
||
/// <summary> | ||
/// This is intentionally not implemented, as it is extended by <see cref="RegisterInternalActions"/>. | ||
/// </summary> | ||
/// <param name="registrationContext"></param> | ||
public override void RegisterActions(IBuildCheckRegistrationContext registrationContext) | ||
{ | ||
if (registrationContext is not IInternalCheckRegistrationContext internalRegistrationContext) | ||
{ | ||
throw new ArgumentException("The registration context for InternalBuildAnalyzer must be of type IInternalBuildCheckRegistrationContext.", nameof(registrationContext)); | ||
} | ||
|
||
this.RegisterInternalActions(internalRegistrationContext); | ||
} | ||
} |
Oops, something went wrong.