Performs static code analysis on the input documents, outputting a new document for each symbol.
- Namespace
- Statiq
.CodeAnalysis - Interfaces
- Base Types
-
- object
- Module
graph BT
Type-->Base0["Module"]
click Base0 "/api/Statiq.Common/Module"
Base0-->Base1["object"]
Type-.->Interface0["IModule"]
click Interface0 "/api/Statiq.Common/IModule"
Type["AnalyzeCSharp"]
class Type type-node
Syntax
public class AnalyzeCSharp : Module, IModule
Remarks
This module acts as the basis for code analysis scenarios such as generating source code documentation.
All input documents are assumed to contain C# source in their content and are used to create a Roslyn
compilation. All symbols (namespaces, types, members, etc.) in the compilation are then recursively
processed and output from this module as documents, one per symbol. The output documents have empty content
and all information about the symbol is contained in the metadata. This lets you pass the output documents
for each symbol on to a template engine like Razor and generate pages for each symbol by having the
template use the document metadata.
Methods
Name | Return Value | Summary |
---|---|---|
AfterExecution |
void |
Called after each module execution.
Inherited from Module
|
AfterExecutionAsync |
Task |
Called after each module execution.
Inherited from Module
|
BeforeExecution |
void |
Called before each module execution.
Inherited from Module
|
BeforeExecutionAsync |
Task |
Called before each module execution.
Inherited from Module
|
ExecuteAsync |
Task |
This should not be called directly, instead call
IExecutionContext.Execute() if you need to execute a module from within another module.
Inherited from Module
|
ExecuteContextAsync |
Task |
Executes the module once for all input documents.
|
ExecuteInputAsync |
Task |
Executes the module.
Inherited from Module
|
Finally |
void |
Called after each module execution, even if an exception is thrown during execution.
Inherited from Module
|
FinallyAsync |
Task |
Called after each module execution, even if an exception is thrown during execution.
Inherited from Module
|
Include |
AnalyzeCSharp |
Controls whether symbol documents for empty namespaces (those that contain
only other namespaces but no other symbols recursively) are output. By default
only namespaces that contain other nested symbols are output.
|
WhereNamespaces |
AnalyzeCSharp |
Limits symbols in the initial result set to those in the specified namespaces.
|
WhereNamespaces |
AnalyzeCSharp |
Limits symbols in the initial result set to those in the namespaces that satisfy the specified predicate.
|
WherePublic |
AnalyzeCSharp |
Limits symbols in the initial result set to those that are public (and optionally protected).
|
WhereSymbol |
AnalyzeCSharp |
Controls which symbols are processed as part of the initial result set.
|
WhereSymbol |
AnalyzeCSharp |
Controls which symbols are processed as part of the initial result set.
|
WithAssemblies |
AnalyzeCSharp |
Analyzes the specified assemblies.
|
WithAssemblies |
AnalyzeCSharp |
Analyzes the specified assemblies.
|
WithAssemblySymbols |
AnalyzeCSharp |
Controls whether assembly symbol documents are output.
|
With |
AnalyzeCSharp |
Allows you to change the name of the assembly created by the compilation this module produces. This can be
useful for uniquely identifying multiple instances of the module, for example. By default
System.IO.Path.GetRandomFileName is used to derive the compilation assembly name.
|
WithCssClasses |
AnalyzeCSharp |
While converting XML documentation to HTML, any tags with the specified name will get the specified CSS class(s).
This is helpful to style your XML documentation comment rendering to support the stylesheet of your site.
|
WithDestination |
AnalyzeCSharp |
This changes the default behavior for the generated destination paths, which is to place files in a path
with the same name as their containing namespace. Namespace documents will have the
IndexFileName while other type documents
will get a name equal to their SymbolId. Member documents will get the same name as their containing type plus an
anchor to their SymbolId.
|
WithDestination |
AnalyzeCSharp |
This changes the default behavior for the generated destination paths, which is to place files in a path
with the same name as their containing namespace. Namespace documents will have the
IndexFileName while other type documents
will get a name equal to their SymbolId. Member documents will get the same name as their containing type plus an
anchor to their SymbolId.
|
With |
AnalyzeCSharp |
This lets you add a prefix to the default destination behavior (such as nesting symbol documents inside
a folder like "api/"). Whatever you supply will be combined with the destination. This method has no
effect if you've supplied a custom destination behavior.
|
With |
AnalyzeCSharp |
By default, XML documentation comments are not parsed and rendered for documents that are not part
of the initial result set. This can control that behavior and be used to generate documentation
metadata for all documents, regardless if they were part of the initial result set.
|
With |
AnalyzeCSharp |
This will assume
inheritdoc if a symbol has no other code comments.
|
WithInputDocuments |
AnalyzeCSharp |
Controls whether the content of input documents is treated as code and used in the analysis (the default is
true ).
|
WithNamedTypes |
AnalyzeCSharp |
Restricts the initial result set to named type symbols (I.e., classes, interfaces, etc.). Also allows supplying
an additional predicate on the named type.
|
WithProjects |
AnalyzeCSharp |
Analyzes the specified projects.
|
WithProjects |
AnalyzeCSharp |
Analyzes the specified projects.
|
WithSolutions |
AnalyzeCSharp |
Analyzes the specified solutions.
|
WithSolutions |
AnalyzeCSharp |
Analyzes the specified solutions.
|