Skip to content

Commit

Permalink
- code linting: enables implicit usings for console application
Browse files Browse the repository at this point in the history
Signed-off-by: Vincent Biret <[email protected]>
  • Loading branch information
baywet committed Mar 19, 2024
1 parent 972c8f8 commit d651fad
Show file tree
Hide file tree
Showing 33 changed files with 52 additions and 174 deletions.
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Net.Http.Headers;
using System.Net.Http.Json;
using System.Text.Json.Serialization;
using System.Threading;
using System.Threading.Tasks;
using Kiota.Builder.SearchProviders.GitHub.Authentication;
using Microsoft.Kiota.Abstractions.Authentication;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@

using System;
using System.Collections.Generic;
using System.Net.Http;
using Kiota.Builder.SearchProviders.GitHub.Authentication;
using Kiota.Builder.SearchProviders.GitHub.Authentication;
using Microsoft.Extensions.Logging;
using Microsoft.Kiota.Abstractions.Authentication;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System;
using System.Text.Json.Serialization;
using System.Text.Json.Serialization;

namespace kiota.Authentication.GitHub.DeviceCode;

Expand Down
31 changes: 15 additions & 16 deletions src/kiota/Extension/ILoggerExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,23 +1,22 @@
using System;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging;

namespace kiota;

internal static class ILoggerExtensions
{
/// <summary>
/// Appends internal logging information to the logger
/// </summary>
/// <param name="logger">The logger to append to</param>
public static void AppendInternalTracing(this ILogger logger)
{
// This is a special message for Kiota's birthday
// If you're reading this, move along, nothing to see here and keep quiet about it
// Otherwise, you'll be cursed with a lifetime of bad luck
if (logger == null) return;
var currentDateTime = DateTime.UtcNow;
if (currentDateTime.Month != 3 || currentDateTime.Day != 9 || currentDateTime.Year < 2024) return;
logger.LogWarning(
/// <summary>
/// Appends internal logging information to the logger
/// </summary>
/// <param name="logger">The logger to append to</param>
public static void AppendInternalTracing(this ILogger logger)
{
// This is a special message for Kiota's birthday
// If you're reading this, move along, nothing to see here and keep quiet about it
// Otherwise, you'll be cursed with a lifetime of bad luck
if (logger == null) return;
var currentDateTime = DateTime.UtcNow;
if (currentDateTime.Month != 3 || currentDateTime.Day != 9 || currentDateTime.Year < 2024) return;
logger.LogWarning(
@" ▒▒░░▒▒ ░░ ▒▒░░▒▒
▒▒ ██████ ▒▒
██████ ██▒▒██ ██████
Expand Down Expand Up @@ -106,5 +105,5 @@ public static void AppendInternalTracing(this ILogger logger)
| Waldek Mastykarz |
| |
|--------------------------------------------------------------| ");
}
}
}
9 changes: 1 addition & 8 deletions src/kiota/Handlers/BaseKiotaCommandHandler.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
using System;
using System.Collections.Generic;
using System.CommandLine;
using System.CommandLine;
using System.CommandLine.Invocation;
using System.IO;
using System.Linq;
using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;
using kiota.Authentication.GitHub.DeviceCode;
using Kiota.Builder;
using Kiota.Builder.Configuration;
Expand Down
8 changes: 1 addition & 7 deletions src/kiota/Handlers/Client/AddHandler.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
using System;
using System.Collections.Generic;
using System.CommandLine;
using System.CommandLine;
using System.CommandLine.Invocation;
using System.IO;
using System.Linq;
using System.Text.Json;
using System.Threading;
using System.Threading.Tasks;
using Kiota.Builder;
using Kiota.Builder.Configuration;
using Kiota.Builder.Extensions;
Expand Down
8 changes: 1 addition & 7 deletions src/kiota/Handlers/Client/EditHandler.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
using System;
using System.Collections.Generic;
using System.CommandLine;
using System.CommandLine;
using System.CommandLine.Invocation;
using System.IO;
using System.Linq;
using System.Text.Json;
using System.Threading;
using System.Threading.Tasks;
using Kiota.Builder;
using Kiota.Builder.Configuration;
using Kiota.Builder.Extensions;
Expand Down
7 changes: 1 addition & 6 deletions src/kiota/Handlers/Client/GenerateHandler.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
using System;
using System.CommandLine;
using System.CommandLine;
using System.CommandLine.Invocation;
using System.IO;
using System.Linq;
using System.Text.Json;
using System.Threading;
using System.Threading.Tasks;
using Kiota.Builder;
using Kiota.Builder.Configuration;
using Kiota.Builder.WorkspaceManagement;
Expand Down
5 changes: 1 addition & 4 deletions src/kiota/Handlers/Client/RemoveHandler.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
using System;
using System.CommandLine;
using System.CommandLine;
using System.CommandLine.Invocation;
using System.Threading;
using System.Threading.Tasks;
using Kiota.Builder;
using Kiota.Builder.WorkspaceManagement;
using Microsoft.Extensions.Logging;
Expand Down
8 changes: 1 addition & 7 deletions src/kiota/Handlers/KiotaDownloadCommandHandler.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
using System;
using System.Collections.Generic;
using System.CommandLine;
using System.CommandLine;
using System.CommandLine.Invocation;
using System.IO;
using System.Linq;
using System.Text.Json;
using System.Threading;
using System.Threading.Tasks;
using Kiota.Builder;
using Kiota.Builder.Caching;
using Kiota.Builder.Configuration;
Expand Down
7 changes: 1 addition & 6 deletions src/kiota/Handlers/KiotaGenerateCommandHandler.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
using System;
using System.Collections.Generic;
using System.CommandLine;
using System.CommandLine;
using System.CommandLine.Invocation;
using System.Linq;
using System.Text.Json;
using System.Threading;
using System.Threading.Tasks;

using Kiota.Builder;
using Kiota.Builder.Extensions;
Expand Down
7 changes: 1 addition & 6 deletions src/kiota/Handlers/KiotaGitHubDeviceLoginCommandHanlder.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
using System;
using System.Collections.Generic;
using System.CommandLine.Invocation;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using System.CommandLine.Invocation;
using kiota.Authentication.GitHub.DeviceCode;
using Kiota.Builder.SearchProviders.GitHub.GitHubClient;
using Microsoft.Extensions.Logging;
Expand Down
5 changes: 1 addition & 4 deletions src/kiota/Handlers/KiotaGitHubLogoutCommandhandler.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
using System;
using System.CommandLine.Invocation;
using System.Threading;
using System.Threading.Tasks;
using System.CommandLine.Invocation;
using Kiota.Builder.SearchProviders.GitHub.Authentication;
using Microsoft.Extensions.Logging;

Expand Down
5 changes: 1 addition & 4 deletions src/kiota/Handlers/KiotaGitHubPatLoginCommandHandler.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
using System;
using System.CommandLine;
using System.CommandLine;
using System.CommandLine.Invocation;
using System.Threading;
using System.Threading.Tasks;
using Kiota.Builder.SearchProviders.GitHub.Authentication;
using Microsoft.Extensions.Logging;

Expand Down
8 changes: 1 addition & 7 deletions src/kiota/Handlers/KiotaInfoCommandHandler.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
using System;
using System.Collections.Generic;
using System.CommandLine;
using System.CommandLine;
using System.CommandLine.Invocation;
using System.CommandLine.IO;
using System.CommandLine.Rendering;
using System.CommandLine.Rendering.Views;
using System.IO;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Kiota.Builder;
using Kiota.Builder.Configuration;
using Microsoft.Extensions.Logging;
Expand Down
6 changes: 1 addition & 5 deletions src/kiota/Handlers/KiotaRpcCommandHandler.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
using System;
using System.CommandLine;
using System.CommandLine;
using System.CommandLine.Invocation;
using System.IO;
using System.IO.Pipes;
using System.Threading;
using System.Threading.Tasks;
using kiota.Rpc;
using Nerdbank.Streams;
using StreamJsonRpc;
Expand Down
5 changes: 1 addition & 4 deletions src/kiota/Handlers/KiotaSeachBasedCommandHandler.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging;

namespace kiota.Handlers;

Expand Down
7 changes: 1 addition & 6 deletions src/kiota/Handlers/KiotaSearchCommandHandler.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
using System;
using System.Collections.Generic;
using System.CommandLine;
using System.CommandLine;
using System.CommandLine.Invocation;
using System.CommandLine.IO;
using System.CommandLine.Rendering;
using System.CommandLine.Rendering.Views;
using System.Linq;
using System.Text.Json;
using System.Threading;
using System.Threading.Tasks;
using Kiota.Builder;
using Kiota.Builder.SearchProviders;
using Microsoft.Extensions.Logging;
Expand Down
7 changes: 1 addition & 6 deletions src/kiota/Handlers/KiotaShowCommandHandler.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
using System;
using System.Collections.Generic;
using System.CommandLine;
using System.CommandLine;
using System.CommandLine.Invocation;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Kiota.Builder;
using Kiota.Builder.Extensions;
using Microsoft.Extensions.Logging;
Expand Down
6 changes: 1 addition & 5 deletions src/kiota/Handlers/KiotaUpdateCommandHandler.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
using System;
using System.CommandLine;
using System.CommandLine;
using System.CommandLine.Invocation;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Kiota.Builder;
using Kiota.Builder.Configuration;
using Kiota.Builder.Lock;
Expand Down
6 changes: 1 addition & 5 deletions src/kiota/Handlers/Workspace/InitHandler.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
using System;
using System.CommandLine.Invocation;
using System.IO;
using System.Threading;
using System.Threading.Tasks;
using System.CommandLine.Invocation;
using Kiota.Builder.WorkspaceManagement;
using Microsoft.Extensions.Logging;

Expand Down
7 changes: 1 addition & 6 deletions src/kiota/Handlers/Workspace/MigrateHandler.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
using System;
using System.CommandLine;
using System.CommandLine;
using System.CommandLine.Invocation;
using System.IO;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Kiota.Builder.WorkspaceManagement;
using Microsoft.Extensions.Logging;

Expand Down
5 changes: 1 addition & 4 deletions src/kiota/KiotaConfigurationExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Kiota.Builder;
using Kiota.Builder;
using Kiota.Builder.Configuration;
using Microsoft.Extensions.Configuration;

Expand Down
5 changes: 1 addition & 4 deletions src/kiota/KiotaHost.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
using System;
using System.Collections.Generic;
using System.CommandLine;
using System.CommandLine;
using System.CommandLine.Parsing;
using System.Linq;
using System.Text.RegularExpressions;
using kiota.Handlers;
using kiota.Rpc;
Expand Down
5 changes: 1 addition & 4 deletions src/kiota/Program.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
using System;
using System.CommandLine;
using System.Linq;
using System.Threading.Tasks;
using System.CommandLine;

namespace kiota;
static class Program
Expand Down
4 changes: 1 addition & 3 deletions src/kiota/Rpc/ForwardedLogger.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using System;
using System.Collections.Generic;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging;

namespace kiota.Rpc;
public class ForwardedLogger<T> : ILogger<T>
Expand Down
5 changes: 1 addition & 4 deletions src/kiota/Rpc/IServer.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using Kiota.Builder;
using Kiota.Builder;
using Kiota.Builder.Configuration;

namespace kiota.Rpc;
Expand Down
4 changes: 1 addition & 3 deletions src/kiota/Rpc/ManifestResult.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
using System.Collections.Generic;

namespace kiota.Rpc;
namespace kiota.Rpc;
public record ManifestResult(List<LogEntry> logs, string? apiDescriptionPath, string[]? selectedPaths);
4 changes: 1 addition & 3 deletions src/kiota/Rpc/NoopLogger.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@

using System;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging;

namespace kiota.Rpc;
public class NoopLogger<T> : ILogger<T>
Expand Down
3 changes: 1 addition & 2 deletions src/kiota/Rpc/SearchResult.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System.Collections.Generic;
using Kiota.Builder.SearchProviders;
using Kiota.Builder.SearchProviders;

namespace kiota.Rpc;

Expand Down
9 changes: 1 addition & 8 deletions src/kiota/Rpc/Server.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net.Http;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
using System.Text.RegularExpressions;
using Kiota.Builder;
using Kiota.Builder.Configuration;
using Kiota.Builder.Extensions;
Expand Down
5 changes: 1 addition & 4 deletions src/kiota/Rpc/ShowResult.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
using System;
using System.Collections.Generic;

namespace kiota.Rpc;
namespace kiota.Rpc;

public record PathItem(string path, string segment, PathItem[] children, bool selected, bool isOperation = false, Uri? documentationUrl = null);

Expand Down
Loading

0 comments on commit d651fad

Please sign in to comment.