Skip to content

Commit 24b5962

Browse files
Merge pull request #1759 from PowerShell/andschwa/fix-ide0005
Enable IDE0005 (unneccessary using statements) as error
2 parents 2e30add + bf8a482 commit 24b5962

26 files changed

+54
-55
lines changed

.editorconfig

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,12 @@ dotnet_diagnostic.CS0414.severity = error
3636
dotnet_diagnostic.CS0618.severity = suggestion
3737
# CS0649: Uninitialized private or internal field declaration that is never assigned a value
3838
dotnet_diagnostic.CS0649.severity = error
39+
# CS1570: Parameter has no matching param tag in the XML comment
40+
dotnet_diagnostic.CS1570.severity = silent
41+
# CS1574: XML comment has cref attribute that could not be resolved.
42+
dotnet_diagnostic.CS1574.severity = suggestion
43+
# CS1591: Missing XML comment for publicly visible type or member
44+
dotnet_diagnostic.CS1591.severity = silent
3945
# CS1998: This async method lacks 'await' operators and will run synchronously
4046
dotnet_diagnostic.CS1998.severity = suggestion
4147
# CS4014: Consider applying the await operator to the result of the call

PowerShellEditorServices.Common.props

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
<!-- See: https://docs.microsoft.com/en-us/dotnet/fundamentals/code-analysis/overview -->
1515
<EnableNETAnalyzers>true</EnableNETAnalyzers>
1616
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
17+
<!-- Required to enable IDE0005 as error -->
18+
<GenerateDocumentationFile>true</GenerateDocumentationFile>
1719
<!-- TODO: Enable <AnalysisMode>All</AnalysisMode> -->
1820
<!-- See: https://docs.microsoft.com/en-us/dotnet/core/compatibility/sdk/6.0/implicit-namespaces -->
1921
<DisableImplicitNamespaceImports>true</DisableImplicitNamespaceImports>

src/PowerShellEditorServices.Hosting/Configuration/HostLogger.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ namespace Microsoft.PowerShell.EditorServices.Hosting
1515
/// User-facing log level for editor services configuration.
1616
/// </summary>
1717
/// <remarks>
18-
/// The underlying values of this enum attempt to align to both <see
19-
/// cref="Microsoft.Logging.Extensions.LogLevel"</see> and <see
20-
/// cref="Serilog.Events.LogEventLevel"</see>.
18+
/// The underlying values of this enum attempt to align to both
19+
/// <see cref="Microsoft.Extensions.Logging.LogLevel" /> and
20+
/// <see cref="Serilog.Events.LogEventLevel" />.
2121
/// </remarks>
2222
public enum PsesLogLevel
2323
{

src/PowerShellEditorServices.Hosting/EditorServicesLoader.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
// Licensed under the MIT License.
33

44
using System;
5-
using System.Diagnostics;
65
using System.IO;
76
using System.Reflection;
87
using System.Threading.Tasks;
@@ -13,6 +12,10 @@
1312
using System.Management.Automation;
1413
using System.Management.Automation.Runspaces;
1514

15+
#if DEBUG
16+
using System.Diagnostics;
17+
#endif
18+
1619
#if CoreCLR
1720
using System.Runtime.Loader;
1821
#else
@@ -58,6 +61,7 @@ public static EditorServicesLoader Create(
5861
/// <param name="logger">The host logger to use.</param>
5962
/// <param name="hostConfig">The host configuration to start editor services with.</param>
6063
/// <param name="sessionFileWriter">The session file writer to write the session file with.</param>
64+
/// <param name="loggersToUnsubscribe">The loggers to unsubscribe form writing to the terminal.</param>
6165
/// <returns></returns>
6266
public static EditorServicesLoader Create(
6367
HostLogger logger,

src/PowerShellEditorServices/Extensions/Api/EditorExtensionServiceProvider.cs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,6 @@ internal EditorExtensionServiceProvider(IServiceProvider serviceProvider)
5454
/// </summary>
5555
public ILanguageServerService LanguageServer { get; }
5656

57-
/// <summary>
58-
/// Service providing document symbol provider registration.
59-
/// </summary>
60-
// public IDocumentSymbolService DocumentSymbols { get; }
61-
6257
/// <summary>
6358
/// Service providing extension command registration and functionality.
6459
/// </summary>
@@ -93,7 +88,7 @@ internal EditorExtensionServiceProvider(IServiceProvider serviceProvider)
9388
/// <summary>
9489
/// Get an underlying service object from PSES by type name.
9590
/// </summary>
96-
/// <param name="psesServiceFullTypeName">The full type name of the service to get.</param>
91+
/// <param name="fullTypeName">The full type name of the service to get.</param>
9792
/// <param name="assemblyName">The assembly name from which the service comes.</param>
9893
/// <returns>The service object requested, or null if no service of that type name exists.</returns>
9994
/// <remarks>

src/PowerShellEditorServices/Extensions/EditorObject.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ public class EditorObject
7373
/// <summary>
7474
/// Creates a new instance of the EditorObject class.
7575
/// </summary>
76+
/// <param name="serviceProvider">The service provider?</param>
7677
/// <param name="extensionService">An ExtensionService which handles command registration.</param>
7778
/// <param name="editorOperations">An IEditorOperations implementation which handles operations in the host editor.</param>
7879
internal EditorObject(

src/PowerShellEditorServices/Extensions/FileContext.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ public string GetText(FileRange bufferRange)
122122
/// <summary>
123123
/// Gets the file content in the specified range as an array of strings.
124124
/// </summary>
125-
/// <param name="bufferRange">The buffer range for which content will be extracted.</param>
125+
/// <param name="fileRange">The buffer range for which content will be extracted.</param>
126126
/// <returns>An array of strings, each representing a line in the file within the specified range.</returns>
127127
public string[] GetTextLines(FileRange fileRange) => scriptFile.GetLinesInRange(fileRange.ToBufferRange());
128128

src/PowerShellEditorServices/Hosting/EditorServicesServerFactory.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
// Licensed under the MIT License.
33

44
using System;
5-
using System.Diagnostics;
65
using System.IO;
76
using Microsoft.Extensions.DependencyInjection;
87
using Microsoft.Extensions.Logging;
@@ -14,6 +13,7 @@
1413
using Microsoft.PowerShell.EditorServices.Services.Extension;
1514

1615
#if DEBUG
16+
using System.Diagnostics;
1717
using Serilog.Debugging;
1818
#endif
1919

@@ -36,7 +36,7 @@ internal sealed class EditorServicesServerFactory : IDisposable
3636
/// <remarks>
3737
/// <para>
3838
/// This can only be called once because it sets global state (the logger) and that call is
39-
/// in <see cref="EditorServicesRunner"/>.
39+
/// in <see cref="Hosting.EditorServicesRunner" />.
4040
/// </para>
4141
/// <para>
4242
/// TODO: Why is this a static function wrapping a constructor instead of just a
@@ -45,7 +45,7 @@ internal sealed class EditorServicesServerFactory : IDisposable
4545
/// </remarks>
4646
/// <param name="logPath">The path of the log file to use.</param>
4747
/// <param name="minimumLogLevel">The minimum log level to use.</param>
48-
/// <returns></returns>
48+
/// <param name="hostLogger">The host logger?</param>
4949
public static EditorServicesServerFactory Create(string logPath, int minimumLogLevel, IObservable<(int logLevel, string message)> hostLogger)
5050
{
5151
Log.Logger = new LoggerConfiguration()
@@ -78,7 +78,7 @@ public static EditorServicesServerFactory Create(string logPath, int minimumLogL
7878
/// Create the LSP server.
7979
/// </summary>
8080
/// <remarks>
81-
/// This is only called once and that's in <see cref="EditorServicesRunner"/>.
81+
/// This is only called once and that's in <see cref="Hosting.EditorServicesRunner"/>.
8282
/// </remarks>
8383
/// <param name="inputStream">The protocol transport input stream.</param>
8484
/// <param name="outputStream">The protocol transport output stream.</param>
@@ -94,7 +94,7 @@ public PsesLanguageServer CreateLanguageServer(
9494
/// Create the debug server given a language server instance.
9595
/// </summary>
9696
/// <remarks>
97-
/// This is only called once and that's in <see cref="EditorServicesRunner"/>.
97+
/// This is only called once and that's in <see cref="Hosting.EditorServicesRunner"/>.
9898
/// </remarks>
9999
/// <param name="inputStream">The protocol transport input stream.</param>
100100
/// <param name="outputStream">The protocol transport output stream.</param>
@@ -116,7 +116,7 @@ public PsesDebugServer CreateDebugServerWithLanguageServer(
116116
/// Create a new debug server based on an old one in an ended session.
117117
/// </summary>
118118
/// <remarks>
119-
/// This is only called once and that's in <see cref="EditorServicesRunner"/>.
119+
/// This is only called once and that's in <see cref="Hosting.EditorServicesRunner"/>.
120120
/// </remarks>
121121
/// <param name="inputStream">The protocol transport input stream.</param>
122122
/// <param name="outputStream">The protocol transport output stream.</param>

src/PowerShellEditorServices/Hosting/HostStartupInfo.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ public sealed class HostStartupInfo
101101
/// The minimum log level of log events to be logged.
102102
/// </summary>
103103
/// <remarks>
104-
/// This is cast to all of <see cref="PsesLogLevel"/>, <see
104+
/// This is cast to all of <see cref="Hosting.PsesLogLevel"/>, <see
105105
/// cref="Microsoft.Extensions.Logging.LogLevel"/>, and <see
106106
/// cref="Serilog.Events.LogEventLevel"/>, hence it is an <c>int</c>.
107107
/// </remarks>
@@ -131,8 +131,7 @@ public sealed class HostStartupInfo
131131
/// </param>
132132
/// <param name="version">The host application's version.</param>
133133
/// <param name="psHost">The PowerShell host to use.</param>
134-
/// <param name="allUsersProfilePath">The path to the shared profile.</param>
135-
/// <param name="currentUsersProfilePath">The path to the user specific profile.</param>
134+
/// <param name="profilePaths">The set of profile paths.</param>
136135
/// <param name="featureFlags">Flags of features to enable.</param>
137136
/// <param name="additionalModules">Names or paths of additional modules to import.</param>
138137
/// <param name="initialSessionState">The language mode inherited from the orginal PowerShell process. This will be used when creating runspaces so that we honor the same initialSessionState including allowed modules, cmdlets and language mode.</param>

src/PowerShellEditorServices/Services/Analysis/AnalysisService.cs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -131,10 +131,8 @@ public AnalysisService(
131131
/// Sets up a script analysis run, eventually returning the result.
132132
/// </summary>
133133
/// <param name="filesToAnalyze">The files to run script analysis on.</param>
134-
/// <param name="cancellationToken">A cancellation token to cancel this call with.</param>
135134
/// <returns>A task that finishes when script diagnostics have been published.</returns>
136-
public void StartScriptDiagnostics(
137-
ScriptFile[] filesToAnalyze)
135+
public void StartScriptDiagnostics(ScriptFile[] filesToAnalyze)
138136
{
139137
if (!_configurationService.CurrentSettings.ScriptAnalysis.Enable)
140138
{
@@ -219,7 +217,7 @@ public async Task<string> GetCommentHelpText(string functionText, string helpLoc
219217
/// <summary>
220218
/// Get the most recent corrections computed for a given script file.
221219
/// </summary>
222-
/// <param name="documentUri">The URI string of the file to get code actions for.</param>
220+
/// <param name="uri">The URI string of the file to get code actions for.</param>
223221
/// <returns>A threadsafe readonly dictionary of the code actions of the particular file.</returns>
224222
public async Task<IReadOnlyDictionary<string, IEnumerable<MarkerCorrection>>> GetMostRecentCodeActionsForFileAsync(DocumentUri uri)
225223
{
@@ -245,7 +243,7 @@ public async Task<IReadOnlyDictionary<string, IEnumerable<MarkerCorrection>>> Ge
245243
/// <summary>
246244
/// Event subscription method to be run when PSES configuration has been updated.
247245
/// </summary>
248-
/// <param name="sender">The sender of the configuration update event.</param>
246+
/// <param name="_">The sender of the configuration update event.</param>
249247
/// <param name="settings">The new language server settings.</param>
250248
public void OnConfigurationUpdated(object _, LanguageServerSettings settings)
251249
{

0 commit comments

Comments
 (0)