Class AnalysisContext
Base class for a context object passed by a Module to an Analyzer's Analyze() method.
Inherited Members
Namespace: Unity.ProjectAuditor .Editor.Core
Assembly: Unity.ProjectAuditor.Editor.dll
Syntax
public class AnalysisContext
Remarks
AnalysisContext provides information to the Analyze() method which is used to decide which issues to report. It also provides helper methods to build Issues or Insights.
Fields
Params
The AnalysisParams object that was passed to (or created by) the ProjectAuditor's Audit() method.
Declaration
public AnalysisParams Params
Field Value
Type | Description |
---|---|
Analysis |
Remarks
This contains information that can be useful during analysis: for example, the analysis target platform, or information to determine whether a particular Descriptor is applicable in the current analysis.
Methods
CreateInsight(IssueCategory, string)
Create a ReportItemBuilder for an Insight: A ReportItem collected for informational purposes.
Declaration
public ReportItemBuilder CreateInsight(IssueCategory category, string description)
Parameters
Type | Name | Description |
---|---|---|
Issue |
category | Issue category |
string | description | User-friendly description |
Returns
Type | Description |
---|---|
Report |
The ReportItemBuilder, constructed with the specified category and description string |
CreateIssue(IssueCategory, string, params object[])
Create a ReportItemBuilder for an Issue: a potential problem in the project, with an actionable recommendation to resolve it.
Declaration
public ReportItemBuilder CreateIssue(IssueCategory category, string id, params object[] messageArgs)
Parameters
Type | Name | Description |
---|---|---|
Issue |
category | Issue category |
string | id | Descriptor ID |
object[] | messageArgs | Arguments to be used in the message formatting |
Returns
Type | Description |
---|---|
Report |
The ReportItemBuilder, constructed with the specified category, descriptor ID and message arguments |
IsDescriptorEnabled(Descriptor)
Checks whether a given Descriptor is enabled for the current analysis.
Declaration
public bool IsDescriptorEnabled(Descriptor descriptor)
Parameters
Type | Name | Description |
---|---|---|
Descriptor | descriptor | The descriptor to check |
Returns
Type | Description |
---|---|
bool | True if the Descriptor is applicable to the current target platform and Unity version, and if it's either enabled by default or by a Rule specified in Params. Otherwise, returns false. |
Remarks
The analysis for some Issues can take a long time to run, particularly in a large project. The Descriptors
for such issues may declare Is