Skip to content

Commit

Permalink
use azure-sdk-for-net ruleset (microsoft#3608)
Browse files Browse the repository at this point in the history
  • Loading branch information
m-nash authored Jun 18, 2024
1 parent 62397e4 commit bb0bfb8
Show file tree
Hide file tree
Showing 10 changed files with 405 additions and 226 deletions.
617 changes: 402 additions & 215 deletions packages/http-client-csharp/eng/CodeAnalysis.ruleset

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ protected override MethodProvider[] BuildConstructors()
ctorWithNoParamsExist = true;
}


if (!serializationCtorParamsMatch)
{
// Check if the model constructor parameters match the serialization constructor parameters
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.


using System;
using System.ComponentModel;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,6 @@ private static string ReadRequiredStringOption(JsonElement root, string option)
return ReadStringOption(root, option) ?? throw new InvalidOperationException($"Unable to parse required option {option} from configuration.");
}


private static string? ReadStringOption(JsonElement root, string option)
{
if (root.TryGetProperty(option, out JsonElement value))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ public FormattableStringExpression(string format, IReadOnlyList<ValueExpression>
Args = args;
}


private string Format { get; init; }
private IReadOnlyList<ValueExpression> Args { get; init; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ protected override MethodProvider[] BuildMethods()
];
}


private MethodProvider BuildAssertNull()
{
var valueParam = new ParameterProvider("value", $"The value.", _t);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ public static string ToCleanName(this string name, bool isCamelCase = true)
[return: NotNullIfNotNull(nameof(name))]
public static string ToVariableName(this string name) => ToCleanName(name, isCamelCase: false);


public static GetPathPartsEnumerator GetPathParts(string? path) => new GetPathPartsEnumerator(path);

public ref struct GetPathPartsEnumerator
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ namespace Microsoft.Generator.CSharp.Snippets
{
public static partial class Snippet
{

public static class JsonSerializer
{
public static InvokeStaticMethodExpression Serialize(ValueExpression writer, ValueExpression value, ValueExpression? options = null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ internal override void Write(CodeWriter writer)
}
}

public readonly static MethodBodyStatement EmptyStatement = new();
public readonly static MethodBodyStatement EmptyLineStatement = new PrivateEmptyLineStatement();
public static readonly MethodBodyStatement EmptyStatement = new();
public static readonly MethodBodyStatement EmptyLineStatement = new PrivateEmptyLineStatement();

public static ExtensibleSnippets Extensible => CodeModelPlugin.Instance.ExtensibleSnippets;
public static MethodBodyStatement AsStatement(this IEnumerable<MethodBodyStatement> statements) => statements.ToArray();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,6 @@ private bool TryGetName(ISymbol symbol, [NotNullWhen(true)] out string? name)

private async Task<Compilation?> LoadBaselineContract()
{

string fullPath;
string projectFilePath = Path.GetFullPath(Path.Combine(CodeModelPlugin.Instance.Configuration.ProjectDirectory, $"{CodeModelPlugin.Instance.Configuration.Namespace}.csproj"));
if (!File.Exists(projectFilePath))
Expand Down

0 comments on commit bb0bfb8

Please sign in to comment.