docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class CodeModuleInstructionAnalyzer

    Abstract base class for an Analyzer to be invoked by CodeModule

    Inheritance
    object
    ModuleAnalyzer
    CodeModuleInstructionAnalyzer
    Inherited Members
    ModuleAnalyzer.Initialize(Action<Descriptor>)
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Unity.ProjectAuditor.Editor.Core
    Assembly: Unity.ProjectAuditor.Editor.dll
    Syntax
    public abstract class CodeModuleInstructionAnalyzer : ModuleAnalyzer

    Properties

    opCodes

    A collection of Mono.Cecil OpCodes which are used by this analyzer.

    Declaration
    public abstract IReadOnlyCollection<OpCode> opCodes { get; }
    Property Value
    Type Description
    IReadOnlyCollection<OpCode>
    Remarks

    To speed up the code analysis process, each CodeModuleInstructionAnalyzer must provide a list of the Instruction OpCodes it's interested in. Project Auditor will only invoke an InstructionAnalyzer if the OpCode of the Instruction currently under analysis matches one of the OpCodes in this list. For more details, refer to the Mono.Cecil Github page.

    Methods

    Analyze(InstructionAnalysisContext)

    Implement this method to detect Issues in a code instruction, and construct a ReportItemBuilder object with basic information about a ReportItem object to describe the issue.

    Declaration
    public abstract ReportItemBuilder Analyze(InstructionAnalysisContext context)
    Parameters
    Type Name Description
    InstructionAnalysisContext context

    Context object containing information necessary to perform analysis

    Returns
    Type Description
    ReportItemBuilder

    A ReportItemBuilder containing a partially-constructed ReportItem

    Remarks

    When Instruction Analyzers detect an issue, they should call CreateIssue(IssueCategory, string, params object[]) to begin creating an issue with an IssueCategory, a DescriptorId and any other relevant data. The Code Module will add further information including the DependencyNode, Location and assembly name and add the resulting ReportItem to the report.

    In This Article
    Back to top
    Copyright © 2025 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)