Skip to content

Commit

Permalink
C#: Fix compiler warnings related to errors in XML comments.
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelnebel committed Nov 19, 2024
1 parent 3580982 commit 0fc46f5
Show file tree
Hide file tree
Showing 21 changed files with 52 additions and 64 deletions.
8 changes: 3 additions & 5 deletions csharp/autobuilder/Semmle.Autobuild.CSharp/AutoBuildRule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,9 @@ public BuildScript Analyse(IAutobuilder<CSharpAutobuildOptions> builder, bool au
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);
Expand Down
4 changes: 2 additions & 2 deletions csharp/autobuilder/Semmle.Autobuild.Shared/Autobuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ protected Autobuilder(IBuildActions actions, TAutobuildOptions options, Diagnost
}

/// <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>
Expand Down Expand Up @@ -228,7 +228,7 @@ protected string RequireEnvironmentVariable(string name)
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>
Expand Down
4 changes: 2 additions & 2 deletions csharp/autobuilder/Semmle.Autobuild.Shared/MarkdownUtil.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public static class MarkdownUtil
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.
Expand All @@ -35,7 +35,7 @@ public static string ToMarkdownList(this IEnumerable<IProjectOrSolution> project
}

/// <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>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,21 +127,21 @@ private void AddPackageDependencies(JObject json, string jsonPath)
///
/// 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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ private string FullVersion
* 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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ public HashSet<PackageReference> AllPackages
/// 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
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,20 @@ internal interface IDotNetCliInvoker
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>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,6 @@ bool IdDependsOnImpl(ITypeSymbol? type)

/// <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>
Expand Down Expand Up @@ -495,31 +492,31 @@ public static bool IsReallyUnbound(this INamedTypeSymbol type) =>

/// <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>";
Expand All @@ -536,7 +533,7 @@ attribute.AttributeClass is INamedTypeSymbol nt &&
}

/// <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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ internal void SetType(ITypeSymbol? type)
/// <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)
{
Expand All @@ -98,7 +98,6 @@ public static string ValueAsString(object? value)
/// <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)
{
Expand All @@ -120,7 +119,6 @@ public static Expression Create(Context cx, ExpressionSyntax node, IExpressionPa
/// <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))
Expand Down Expand Up @@ -244,7 +242,6 @@ public static ExprKind UnaryOperatorKind(Context cx, ExprKind originalKind, Expr
/// 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)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ protected Expression(ExpressionNodeInfo info)
/// <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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,9 @@ public static NamedType Create(Context cx, INamedTypeSymbol type) =>
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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,8 +209,8 @@ public static IEnumerable<AnnotatedTypeSymbol> GetAnnotatedTypeArguments(this An
/// 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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ private bool IsImplicitOperator(out ITypeSymbol containingType)
/// 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)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ internal void AddFreshLabel(Entity entity)
/// <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;
Expand Down Expand Up @@ -598,7 +598,6 @@ public Entities.Location CreateLocation(Microsoft.CodeAnalysis.Location? locatio
/// <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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ private static bool TryMove(string sourceFile, string destFile)
/// <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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ public static TextWriter AppendList<T>(this EscapingTextWriter trapFile, string
/// <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>
Expand All @@ -251,7 +251,7 @@ public static T1 BuildList<T1, T2>(this T1 trapFile, string separator, IEnumerab
/// <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>
Expand Down
3 changes: 1 addition & 2 deletions csharp/extractor/Semmle.Util/CanonicalPathCache.cs
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ public enum Symlinks
/// 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)
Expand All @@ -230,7 +230,6 @@ public CanonicalPathCache(int maxCapacity, PathStrategy pathStrategy)
/// </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)
{
Expand Down
1 change: 0 additions & 1 deletion csharp/extractor/Semmle.Util/CommandBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ public CommandBuilder CallBatFile(string batFile, string? argumentsOpt = null)
/// </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
Expand Down

0 comments on commit 0fc46f5

Please sign in to comment.