AnalyzeCSharp Class

Summary

Performs static code analysis on the input documents, outputting a new document for each symbol.
Assembly
Wyam.CodeAnalysis.dll
Namespace
Wyam.CodeAnalysis
Interfaces
Base Types
  • Object
graph BT Type-->Base0["Object"] Type-.->Interface0["IModule"] click Interface0 "/api/Wyam.Common.Modules/IModule" Type["AnalyzeCSharp"] class Type type-node

Syntax

public class AnalyzeCSharp : 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 Value Summary
Execute(IReadOnlyList<IDocument>, IExecutionContext) IEnumerable<IDocument>
This should not be called directly, instead call IExecutionContext.Execute() if you need to execute a module from within another module.
WhereNamespaces(bool, string[]) AnalyzeCSharp
Limits symbols in the initial result set to those in the specified namespaces.
WhereNamespaces(Func<string, bool>) AnalyzeCSharp
Limits symbols in the initial result set to those in the namespaces that satisfy the specified predicate.
WherePublic(bool) AnalyzeCSharp
Limits symbols in the initial result set to those that are public (and optionally protected)
WhereSymbol(Func<ISymbol, bool>) AnalyzeCSharp
Controls which symbols are processed as part of the initial result set.
WithAssemblies(IEnumerable<string>) AnalyzeCSharp
Analyzes the specified assemblies.
WithAssemblies(string) AnalyzeCSharp
Analyzes the specified assemblies.
WithAssemblySymbols(bool) AnalyzeCSharp
Controls whether assembly symbol documents are output.
WithCssClasses(string, string) 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.
WithDocsForImplicitSymbols(bool) 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.
WithImplicitInheritDoc(bool) AnalyzeCSharp
This will assume inheritdoc if a symbol has no other code comments.
WithInputDocuments(bool) AnalyzeCSharp
Controls whether the content of input documents is treated as code and used in the analysis (the default is true).
WithNamedTypes(Func<INamedTypeSymbol, bool>) 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(IEnumerable<string>) AnalyzeCSharp
Analyzes the specified projects.
WithProjects(string) AnalyzeCSharp
Analyzes the specified projects.
WithSolutions(IEnumerable<string>) AnalyzeCSharp
Analyzes the specified solutions.
WithSolutions(string) AnalyzeCSharp
Analyzes the specified solutions.
WithWritePath(Func<IMetadata, FilePath>) AnalyzeCSharp
This changes the default behavior for the generated WritePath metadata value, which is to place files in a path with the same name as their containing namespace. Namespace documents will be named "index.html" 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. Note that the default scheme makes the assumption that members will not have their own files, if that's not the case a new WritePath function will have to be supplied using this method.
WithWritePathPrefix(DirectoryPath) AnalyzeCSharp
This lets you add a prefix to the default WritePath behavior (such as nesting symbol documents inside a folder like "api/"). Whatever you supply will be combined with the WritePath. This method has no effect if you've supplied a custom WritePath behavior.
GitHub