Skip to content

Commit

Permalink
#35568 Fixing warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
svick committed Nov 22, 2024
1 parent f46bf53 commit a291209
Show file tree
Hide file tree
Showing 61 changed files with 80 additions and 233 deletions.
12 changes: 0 additions & 12 deletions .config/dotnet-tools.json

This file was deleted.

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,5 @@ eng/tools
packages/
source-dependencies/
.tools/
.config/dotnet-tools.json
*/.obsidian/*

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 0 additions & 6 deletions code/DebugDemo/Entities.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
// Copyright (c) SharpCrafters s.r.o. See the LICENSE.md file in the root directory of this repository root for details.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DebugDemo
{
public class Student
Expand Down
6 changes: 0 additions & 6 deletions code/DebugDemo/Fabric.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,13 @@
using Metalama.Documentation.QuickStart;
using Metalama.Framework.Code;
using Metalama.Framework.Fabrics;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DebugDemo
{
public class Fabric : ProjectFabric
{
public override void AmendProject( IProjectAmender amender )
{

var allPublicMethods = amender
.SelectTypes() // Get all types
.SelectMany( t => t.Methods ) // Get all methods
Expand Down
2 changes: 1 addition & 1 deletion code/DebugDemo/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace DebugDemo
{
public class Demo
public static class Demo
{
public static void Main()
{
Expand Down
1 change: 0 additions & 1 deletion code/DebugDemo2/Fabric2.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Copyright (c) SharpCrafters s.r.o. See the LICENSE.md file in the root directory of this repository root for details.

using Metalama.Documentation.QuickStart;
using Metalama.Framework.Code;
using Metalama.Framework.Fabrics;

namespace DebugDemo2
Expand Down
10 changes: 2 additions & 8 deletions code/Metalama.Documentation.Helpers/ConsoleApp/ConsoleApp.cs
Original file line number Diff line number Diff line change
@@ -1,18 +1,12 @@
// This is public domain Metalama sample code.

using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;

namespace Metalama.Documentation.Helpers.ConsoleApp;

public class ConsoleApp : IDisposable, IAsyncDisposable
public class ConsoleApp( ServiceProvider serviceProvider ) : IDisposable, IAsyncDisposable
{
public ServiceProvider Services { get; }

public ConsoleApp( ServiceProvider serviceProvider )
{
this.Services = serviceProvider;
}
public ServiceProvider Services { get; } = serviceProvider;

public static ConsoleAppBuilder CreateBuilder() => new();

Expand Down
6 changes: 0 additions & 6 deletions code/Metalama.Documentation.QuickStart.Fabrics.2/BaseClass.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
// Copyright (c) SharpCrafters s.r.o. See the LICENSE.md file in the root directory of this repository root for details.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Metalama.Documentation.QuickStart.Fabrics
{
public class BaseClass { }
Expand Down
6 changes: 0 additions & 6 deletions code/Metalama.Documentation.QuickStart.Fabrics.2/Demo.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
// Copyright (c) SharpCrafters s.r.o. See the LICENSE.md file in the root directory of this repository root for details.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Metalama.Documentation.QuickStart.Fabrics
{
internal class Demo { }
Expand Down
6 changes: 0 additions & 6 deletions code/Metalama.Documentation.QuickStart.Fabrics/Demo.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
// Copyright (c) SharpCrafters s.r.o. See the LICENSE.md file in the root directory of this repository root for details.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Metalama.Documentation.QuickStart.Fabrics
{
public class Demo
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

using Metalama.Framework.Code;
using Metalama.Framework.Fabrics;
using Metalama.Documentation.QuickStart;

namespace Metalama.Documentation.QuickStart.Fabrics
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Doc.AddEditorBrowsableAttribute_Introduced_Programmatic;

[AddEditorHiddenFieldAttribute]
[AddEditorHiddenField]
public class C
{
public int NormalField;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System.ComponentModel;
namespace Doc.AddEditorBrowsableAttribute_Introduced_Programmatic;
[AddEditorHiddenFieldAttribute]
[AddEditorHiddenField]
public class C
{
public int NormalField;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,6 @@ protected override void AroundCaching( TemplateInvocation templateInvocation )
catch ( Exception ex ) when ( i < 10 )
{
Console.WriteLine( ex.ToString() );

continue;
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ public int Rmove(int a, int b)
catch (Exception ex)when (i < 10)
{
Console.WriteLine(ex.ToString());
continue;
}
}
return default;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@

using Metalama.Framework.Advising;
using System;
using System.Linq;
using Metalama.Framework.Aspects;
using Metalama.Framework.Code;
using Metalama.Framework.Fabrics;

namespace Doc.Decoupled;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

namespace Doc.Decoupled;

[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property)]
[AttributeUsage( AttributeTargets.Method | AttributeTargets.Property )]
[RunTimeOrCompileTime]
public class LogAttribute : Attribute, ICompileTimeSerializable
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using Metalama.Framework.Advising;
using System;
using System.Linq;
using System.Linq;
using Metalama.Framework.Aspects;
using Metalama.Framework.Code;
using Metalama.Framework.Fabrics;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
// This is public domain Metalama sample code.

using EmptyFiles;

namespace Doc.Decoupled;

public class C
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System;
using EmptyFiles;
namespace Doc.Decoupled;
public class C
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@

using Metalama.Framework.Advising;
using System;
using System.Linq;
using Metalama.Framework.Aspects;
using Metalama.Framework.Code;
using Metalama.Framework.Fabrics;

namespace Doc.Decoupled_Ref;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Doc.Decoupled_Ref;

[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property)]
[AttributeUsage( AttributeTargets.Method | AttributeTargets.Property )]
public class LogAttribute : Attribute
{
public string Category { get; set; } = "default";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public class Fabric : ProjectFabric
{
public override void AmendProject( IProjectAmender amender )
{
var declarations = amender.SelectDeclarationsWithAttribute( typeof(LogAttribute));
var declarations = amender.SelectDeclarationsWithAttribute( typeof(LogAttribute) );

declarations
.OfType<IMethod>()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public override void AmendNamespace( INamespaceAmender amender )
private void ValidateReference( ReferenceValidationContext context )
{
if (
context.Origin.Namespace != context.Destination.Declaration &&
!Equals( context.Origin.Namespace, context.Destination.Declaration ) &&
!context.Origin.Namespace.FullName.EndsWith(
".Tests",
StringComparison.Ordinal ) )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public override void BuildAspect( IAspectBuilder<INamedType> builder )
{
builder.IntroduceMethod(
nameof(this.Reset),
args: new { field = field, T = field.Type },
args: new { field, T = field.Type },
buildMethod: m => m.Name = "Reset" + CamelCase( field.Name ) );
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
using Metalama.Framework.Advising;
using Metalama.Framework.Aspects;
using Metalama.Framework.Code;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;

namespace Doc.IntroduceNestedClass_Members;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public override void BuildAspect( IAspectBuilder<IFieldOrProperty> builder )
}

[Template]
private string OverrideProperty
private string? OverrideProperty
{
set => meta.Target.FieldOrProperty.Value = value?.Trim().ToLowerInvariant();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ namespace Doc.RegisterInstance;
[RegisterInstance]
internal class DemoClass
{
public DemoClass() : base() { }
public DemoClass() { }

public DemoClass( int i ) : this() { }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ namespace Doc.RegisterInstance;
[RegisterInstance]
internal class DemoClass
{
public DemoClass() : base()
public DemoClass()
{
_instanceRegistryHandle = InstanceRegistry.Register(this);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
// This is public domain Metalama sample code.

using Metalama.Framework.Aspects;
using Metalama.Framework.Code.SyntaxBuilders;
using System;
using System.Linq;

namespace Doc.SwitchStatementBuilder_;

[Dispatch]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
using Metalama.Framework.Aspects;
using Metalama.Framework.Code.SyntaxBuilders;
using System;
using System.Linq;
namespace Doc.SwitchStatementBuilder_;
[Dispatch]
public class FruitProcessor
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
// This is public domain Metalama sample code.

using Metalama.Framework.Aspects;
using Metalama.Framework.Code.SyntaxBuilders;
using System;
using System.Linq;

namespace Doc.SwitchStatementBuilder_FullTemplate;

[Dispatch]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,18 @@ private static async Task RunApp( string name )
backend =>
backend.Memory()
.WithAzureSynchronization(
connectionString ) ) );
connectionString ) ) );
// [<endsnippet AddMetalamaCaching>]

// Add other components as usual.
builder.Services.AddAsyncConsoleMain<ConsoleMain>();
builder.Services.AddSingleton<ProductCatalogue>();

// Build the application.
await using var app = builder.Build( new[] { name } );
await using var app = builder.Build( [name] );

// [<snippet Initialize>]
await app.Services.GetRequiredService<ICachingService>().InitializeAsync();
await app.Services.GetRequiredService<ICachingService>().InitializeAsync();
// [<endsnippet Initialize>]

// Run the application.
Expand Down
Loading

0 comments on commit a291209

Please sign in to comment.