C#: Fix compiler warnings related to errors in XML comments.

This commit is contained in:
Michael Nebel
2024-11-19 16:30:48 +01:00
parent 358098230c
commit 0fc46f5855
21 changed files with 52 additions and 64 deletions

View File

@@ -49,11 +49,9 @@ namespace Semmle.Autobuild.CSharp
tryCleanExtractorArgsLogs &
BuildScript.DeleteFile(Extractor.GetCSharpLogPath());
/// <summary>
/// Execute script `s` and check that the C# extractor has been executed.
/// If either fails, attempt to cleanup any artifacts produced by the extractor,
/// and exit with code 1, in order to proceed to the next attempt.
/// </summary>
// Execute script `s` and check that the C# extractor has been executed.
// If either fails, attempt to cleanup any artifacts produced by the extractor,
// and exit with code 1, in order to proceed to the next attempt.
BuildScript IntermediateAttempt(BuildScript s) =>
(s & this.autobuilder.CheckExtractorRun(false)) |
(attemptExtractorCleanup & BuildScript.Failure);

View File

@@ -195,7 +195,7 @@ namespace Semmle.Autobuild.Shared
}
/// <summary>
/// Retrieves the value of an environment variable named <paramref name="name"> or throws
/// Retrieves the value of an environment variable named <paramref name="name"/> or throws
/// an exception if no such environment variable has been set.
/// </summary>
/// <param name="name">The name of the environment variable.</param>
@@ -228,7 +228,7 @@ namespace Semmle.Autobuild.Shared
private readonly IDiagnosticsWriter diagnostics;
/// <summary>
/// Makes <see cref="path" /> relative to the root source directory.
/// Makes <paramref name="path"/> relative to the root source directory.
/// </summary>
/// <param name="path">The path which to make relative.</param>
/// <returns>The relative path.</returns>

View File

@@ -22,7 +22,7 @@ namespace Semmle.Autobuild.Shared
public static string ToMarkdownLink(this string link, string title) => $"[{title}]({link})";
/// <summary>
/// Renders <see cref="projects" /> as a markdown list of the project paths.
/// Renders <paramref name="projects"/> as a markdown list of the project paths.
/// </summary>
/// <param name="projects">
/// The list of projects whose paths should be rendered as a markdown list.
@@ -35,7 +35,7 @@ namespace Semmle.Autobuild.Shared
}
/// <summary>
/// Renders <see cref="items" /> as a markdown list.
/// Renders <paramref name="items" /> as a markdown list.
/// </summary>
/// <typeparam name="T">The item type.</typeparam>
/// <param name="items">The list that should be formatted as a markdown list.</param>

View File

@@ -127,21 +127,21 @@ namespace Semmle.Extraction.CSharp.DependencyFetching
///
/// Example:
/// "project": {
// "version": "1.0.0",
// "frameworks": {
// "net7.0": {
// "frameworkReferences": {
// "Microsoft.AspNetCore.App": {
// "privateAssets": "none"
// },
// "Microsoft.NETCore.App": {
// "privateAssets": "all"
// }
// }
// }
// }
// }
//
/// "version": "1.0.0",
/// "frameworks": {
/// "net7.0": {
/// "frameworkReferences": {
/// "Microsoft.AspNetCore.App": {
/// "privateAssets": "none"
/// },
/// "Microsoft.NETCore.App": {
/// "privateAssets": "all"
/// }
/// }
/// }
/// }
/// }
///
/// Adds the following dependencies
/// Paths: {
/// "microsoft.aspnetcore.app.ref",

View File

@@ -27,7 +27,7 @@ namespace Semmle.Extraction.CSharp.DependencyFetching
* This is the same as FullPath, except that we assume that the
* reference assemblies are in a directory called "packs" and
* the reference assemblies themselves are in a directory called
* "<Framework>.Ref/ref".
* "[Framework].Ref/ref".
* Example:
* FullPath: /usr/share/dotnet/shared/Microsoft.NETCore.App/7.0.2
* FullPathReferenceAssemblies: /usr/share/dotnet/packs/Microsoft.NETCore.App.Ref/7.0.2/ref

View File

@@ -38,8 +38,8 @@ namespace Semmle.Extraction.CSharp.DependencyFetching
/// True if any file in the source directory indicates that ASP.NET Core is used.
/// The following heuristic is used to decide, if ASP.NET Core is used:
/// If any file in the source directory contains something like (this will most like be a .csproj file)
/// <Project Sdk="Microsoft.NET.Sdk.Web">
/// <FrameworkReference Include="Microsoft.AspNetCore.App"/>
/// &lt;Project Sdk="Microsoft.NET.Sdk.Web"&gt;
/// &lt;FrameworkReference Include="Microsoft.AspNetCore.App"/&gt;
/// </summary>
public bool UseAspNetCoreDlls
{

View File

@@ -10,20 +10,20 @@ namespace Semmle.Extraction.CSharp.DependencyFetching
string Exec { get; }
/// <summary>
/// Execute `dotnet <args>` and return true if the command succeeded, otherwise false.
/// Execute `dotnet <paramref name="args"/>` and return true if the command succeeded, otherwise false.
/// If `silent` is true the output of the command is logged as `debug` otherwise as `info`.
/// </summary>
bool RunCommand(string args, bool silent = true);
/// <summary>
/// Execute `dotnet <args>` and return true if the command succeeded, otherwise false.
/// Execute `dotnet <paramref name="args"/>` and return true if the command succeeded, otherwise false.
/// The output of the command is returned in `output`.
/// If `silent` is true the output of the command is logged as `debug` otherwise as `info`.
/// </summary>
bool RunCommand(string args, out IList<string> output, bool silent = true);
/// <summary>
/// Execute `dotnet <args>` in `<workingDirectory>` and return true if the command succeeded, otherwise false.
/// Execute `dotnet <paramref name="args"/>` in `<paramref name="workingDirectory"/>` and return true if the command succeeded, otherwise false.
/// The output of the command is returned in `output`.
/// If `silent` is true the output of the command is logged as `debug` otherwise as `info`.
/// </summary>

View File

@@ -133,9 +133,6 @@ namespace Semmle.Extraction.CSharp
/// <summary>
/// Constructs a unique string for this type symbol.
///
/// The supplied action <paramref name="subTermAction"/> is applied to the
/// syntactic sub terms of this type (if any).
/// </summary>
/// <param name="cx">The extraction context.</param>
/// <param name="trapFile">The trap builder used to store the result.</param>
@@ -495,31 +492,31 @@ namespace Semmle.Extraction.CSharp
/// <summary>
/// Holds if this type is of the form <code>int?</code> or
/// <code>System.Nullable<int></code>.
/// <code>System.Nullable&lt;int&gt;</code>.
/// </summary>
public static bool IsBoundNullable(this ITypeSymbol type) =>
type.SpecialType == SpecialType.None && type.OriginalDefinition.IsUnboundNullable();
/// <summary>
/// Holds if this type is <code>System.Nullable<T></code>.
/// Holds if this type is <code>System.Nullable&lt;T&gt;</code>.
/// </summary>
public static bool IsUnboundNullable(this ITypeSymbol type) =>
type.SpecialType == SpecialType.System_Nullable_T;
/// <summary>
/// Holds if this type is <code>System.Span<T></code>.
/// Holds if this type is <code>System.Span&lt;T&gt;</code>.
/// </summary>
public static bool IsUnboundSpan(this ITypeSymbol type) =>
type.ToString() == "System.Span<T>";
/// <summary>
/// Holds if this type is of the form <code>System.Span<byte></code>.
/// Holds if this type is of the form <code>System.Span&lt;byte&gt;</code>.
/// </summary>
public static bool IsBoundSpan(this ITypeSymbol type) =>
type.SpecialType == SpecialType.None && type.OriginalDefinition.IsUnboundSpan();
/// <summary>
/// Holds if this type is <code>System.ReadOnlySpan<T></code>.
/// Holds if this type is <code>System.ReadOnlySpan&lt;T&gt;</code>.
/// </summary>
public static bool IsUnboundReadOnlySpan(this ITypeSymbol type) =>
type.ToString() == "System.ReadOnlySpan<T>";
@@ -536,7 +533,7 @@ namespace Semmle.Extraction.CSharp
}
/// <summary>
/// Holds if this type is of the form <code>System.ReadOnlySpan<byte></code>.
/// Holds if this type is of the form <code>System.ReadOnlySpan&lt;byte&gt;</code>.
/// </summary>
public static bool IsBoundReadOnlySpan(this ITypeSymbol type) =>
type.SpecialType == SpecialType.None && type.OriginalDefinition.IsUnboundReadOnlySpan();

View File

@@ -7,7 +7,7 @@ namespace Semmle.Extraction.CSharp.Entities
/// <summary>
/// A cached entity.
///
/// The <see cref="Entity.Id"/> property is used as label in caching.
/// The <see cref="Entity.Label"/> property is used as label in caching.
/// </summary>
public abstract class CachedEntity : LabelledEntity
{

View File

@@ -9,12 +9,12 @@ namespace Semmle.Extraction.CSharp
/// Entities are divided into two types: normal entities and cached
/// entities.
///
/// Normal entities implement <see cref="FreshEntity"/> directly, and they
/// Normal entities implement <see cref="Entities.FreshEntity"/> directly, and they
/// (may) emit contents to the trap file during object construction.
///
/// Cached entities implement <see cref="CachedEntity"/>, and they
/// emit contents to the trap file when <see cref="CachedEntity.Populate"/>
/// is called. Caching prevents <see cref="CachedEntity.Populate"/>
/// Cached entities implement <see cref="Entities.CachedEntity"/>, and they
/// emit contents to the trap file when <see cref="Entities.CachedEntity.Populate"/>
/// is called. Caching prevents <see cref="Entities.CachedEntity.Populate"/>
/// from being called on entities that have already been emitted.
/// </summary>
public interface IEntity

View File

@@ -77,7 +77,7 @@ namespace Semmle.Extraction.CSharp.Entities
/// <summary>
/// Gets a string representation of a constant value.
/// </summary>
/// <param name="obj">The value.</param>
/// <param name="value">The value.</param>
/// <returns>The string representation.</returns>
public static string ValueAsString(object? value)
{
@@ -98,7 +98,6 @@ namespace Semmle.Extraction.CSharp.Entities
/// <param name="node">The node to extract.</param>
/// <param name="parent">The parent entity.</param>
/// <param name="child">The child index.</param>
/// <param name="type">A type hint.</param>
/// <returns>The new expression.</returns>
public static Expression Create(Context cx, ExpressionSyntax node, IExpressionParentEntity parent, int child, Boolean isCompilerGenerated = false)
{
@@ -120,7 +119,6 @@ namespace Semmle.Extraction.CSharp.Entities
/// <param name="node">The node to extract.</param>
/// <param name="parent">The parent entity.</param>
/// <param name="child">The child index.</param>
/// <param name="type">A type hint.</param>
public static void CreateDeferred(Context cx, ExpressionSyntax node, IExpressionParentEntity parent, int child)
{
if (ContainsPattern(node))
@@ -244,7 +242,6 @@ namespace Semmle.Extraction.CSharp.Entities
/// to show the target of the call. Also note the dynamic method
/// name if available.
/// </summary>
/// <param name="cx">Context</param>
/// <param name="node">The expression.</param>
public void OperatorCall(TextWriter trapFile, ExpressionSyntax node)
{

View File

@@ -20,7 +20,7 @@ namespace Semmle.Extraction.CSharp.Entities
/// <code>expressions</code> and <code>expr_location</code> are populated by the constructor
/// (should not fail), so even if expression-type specific population fails (e.g., in
/// standalone extraction), the expression created via
/// <see cref="Expression.Create(Context, ExpressionSyntax, IEntity, int, ITypeSymbol)"/> will
/// <see cref="Expression.Create"/> will
/// still be valid.
/// </summary>
protected abstract void PopulateExpression(TextWriter trapFile);

View File

@@ -21,10 +21,9 @@ namespace Semmle.Extraction.CSharp.Entities
NamedTypeFactory.Instance.CreateEntityFromSymbol(cx, type);
/// <summary>
/// Creates a named type entity from a tuple type. Unlike `Create`, this
/// Creates a named type entity from a tuple type. Unlike <see cref="Create"/>, this
/// will create an entity for the underlying `System.ValueTuple` struct.
/// For example, `(int, string)` will result in an entity for
/// `System.ValueTuple<int, string>`.
/// For example, `(int, string)` will result in an entity for `System.ValueTuple&lt;int, string&gt;`.
/// </summary>
public static NamedType CreateNamedTypeFromTupleType(Context cx, INamedTypeSymbol type) =>
UnderlyingTupleTypeFactory.Instance.CreateEntity(cx, (new SymbolEqualityWrapper(type), typeof(TupleType)), type);

View File

@@ -209,8 +209,8 @@ namespace Semmle.Extraction.CSharp.Entities
/// This is so that we can avoid populating nullability in most cases.
/// For example,
/// <code>
/// IEnumerable&lt;string?&gt // false
/// IEnumerable&lt;string?&gt? // true
/// IEnumerable&lt;string?&gt; // false
/// IEnumerable&lt;string?&gt;? // true
/// string? // true
/// string[] // true
/// string?[] // false

View File

@@ -86,7 +86,7 @@ namespace Semmle.Extraction.CSharp.Entities
/// Logs an error if the name is not found.
/// </summary>
/// <param name="cx">Extractor context.</param>
/// <param name="methodName">The method name.</param>
/// <param name="method">The method symbol.</param>
/// <returns>The converted name.</returns>
private static string OperatorSymbol(Context cx, IMethodSymbol method)
{

View File

@@ -152,7 +152,7 @@ namespace Semmle.Extraction.CSharp
/// <summary>
/// Enqueue the given action to be performed later.
/// </summary>
/// <param name="toRun">The action to run.</param>
/// <param name="a">The action to run.</param>
public void PopulateLater(Action a, bool preserveDuplicationKey = true)
{
var key = preserveDuplicationKey ? GetCurrentTagStackKey() : null;
@@ -598,7 +598,6 @@ namespace Semmle.Extraction.CSharp
/// <summary>
/// Register a program entity which can be bound to comments.
/// </summary>
/// <param name="cx">Extractor context.</param>
/// <param name="entity">Program entity.</param>
/// <param name="l">Location of the entity.</param>
public void BindComments(Entity entity, Microsoft.CodeAnalysis.Location? l)

View File

@@ -171,7 +171,7 @@ namespace Semmle.Extraction.CSharp
/// <summary>
/// Close the trap file, and move it to the right place in the trap directory.
/// If the file exists already, rename it to allow the new file (ending .trap.gz)
/// to sit alongside the old file (except if <paramref name="discardDuplicates"/> is true,
/// to sit alongside the old file (except if <see cref="discardDuplicates"/> is true,
/// in which case only the existing file is kept).
/// </summary>
public void Dispose()

View File

@@ -8,7 +8,7 @@ namespace Semmle.Extraction.CSharp
{
/// <summary>
/// A `TextWriter` object that wraps another `TextWriter` object, and which
/// HTML escapes the characters `&`, `{`, `}`, `"`, `@`, and `#`, before
/// HTML escapes the characters &amp;, {, }, &quot;, @, and #, before
/// writing to the underlying object.
/// </summary>
public sealed class EscapingTextWriter : TextWriter

View File

@@ -226,7 +226,7 @@ namespace Semmle.Extraction.CSharp
/// <summary>
/// Builds a trap builder using a separator and an action for each item in the list.
/// </summary>
/// <typeparam name="T">The type of the items.</typeparam>
/// <typeparam name="T2">The type of the items.</typeparam>
/// <param name="trapFile">The trap builder to append to.</param>
/// <param name="separator">The separator string (e.g. ",")</param>
/// <param name="items">The list of items.</param>
@@ -251,7 +251,7 @@ namespace Semmle.Extraction.CSharp
/// <summary>
/// Builds a trap builder using a separator and an action for each item in the list.
/// </summary>
/// <typeparam name="T">The type of the items.</typeparam>
/// <typeparam name="T2">The type of the items.</typeparam>
/// <param name="trapFile">The trap builder to append to.</param>
/// <param name="separator">The separator string (e.g. ",")</param>
/// <param name="items">The list of items.</param>

View File

@@ -208,7 +208,7 @@ namespace Semmle.Util
/// Create cache with a given capacity.
/// </summary>
/// <param name="pathStrategy">The algorithm for determining the canonical path.</param>
/// <param name="capacity">The size of the cache.</param>
/// <param name="maxCapacity">The size of the cache.</param>
public CanonicalPathCache(int maxCapacity, PathStrategy pathStrategy)
{
if (maxCapacity <= 0)
@@ -230,7 +230,6 @@ namespace Semmle.Util
/// </remarks>
///
/// <param name="maxCapacity">Size of the cache.</param>
/// <param name="symlinks">Policy for following symlinks.</param>
/// <returns>A new CanonicalPathCache.</returns>
public static CanonicalPathCache Create(ILogger logger, int maxCapacity)
{

View File

@@ -62,7 +62,6 @@ namespace Semmle.Util
/// </summary>
/// <param name="argument">The argument to append.</param>
/// <param name="force">Whether to always quote the argument.</param>
/// <param name="cmd">Whether to escape for cmd.exe</param>
///
/// <remarks>
/// This implementation is copied from