Skip to content

Commit

Permalink
Fixed issue #38.
Browse files Browse the repository at this point in the history
  • Loading branch information
BADF00D committed Sep 28, 2017
1 parent 817a6ed commit 1f3f6fd
Show file tree
Hide file tree
Showing 4 changed files with 127 additions and 120 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ public DefaultConfiguration() {
["Microsoft.AspNetCore.Http.HttpResponse"] = new List<MethodCall>
{
new MethodCall("RegisterForDispose", new [] {"System.IDisposable"}, false)
},
["Microsoft.Extensions.Logging"] = new List<MethodCall>
{
new MethodCall("AddConsole", Empty.Array<string>(), true)
}
};
TrackingFactoryMethods = new Dictionary<string, IReadOnlyCollection<MethodCall>>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,12 @@ private static void AnalyseInvokationExpressionInsideAwaitExpression(SyntaxNodeA

private static bool IsIgnoredTypeOrImplementsIgnoredInterface(INamedTypeSymbol type)
{
if (!type.IsType) return false;
if (Detector.IsIgnoredType(type)) return true;
/* maybe the given type symbol is a interface. We cannot check if a type
* is a interface, so we simply take the brute force approach and check,
* if this type is in list of ignored interfaces */
if (Detector.IsIgnoredInterface(type)) return true;

var inter = type.AllInterfaces.Select(ai => ai);
return inter.Any(@if => Detector.IsIgnoredInterface(@if));
Expand Down
119 changes: 59 additions & 60 deletions src/DisposeableFixer/DisposeableFixer/DisposeableFixer.Test/Dummy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,75 +50,74 @@ public ILogger CreateLogger(string categoryName)
}
}

public interface IConsoleLoggerSettings {
bool IncludeScopes { get; }
//IChangeToken ChangeToken { get; }
bool TryGetSwitch(string name, out LogLevel level);
IConsoleLoggerSettings Reload();
}
public interface ILoggingBuilder {
//IServiceCollection Services { get; }
}
public class ConsoleLoggerOptions {
public bool IncludeScopes { get; set; } = false;
}
public static class ConsoleLoggerExtensions {
public static ILoggingBuilder AddConsole(this ILoggingBuilder builder) {
throw new NotImplementedException();
}

public static ILoggingBuilder AddConsole(this ILoggingBuilder builder, Action<ConsoleLoggerOptions> configure) {
throw new NotImplementedException();
namespace Microsoft.Extensions.Logging {
public interface IConsoleLoggerSettings {
bool IncludeScopes { get; }
//IChangeToken ChangeToken { get; }
bool TryGetSwitch(string name, out LogLevel level);
IConsoleLoggerSettings Reload();
}

public static ILoggerFactory AddConsole(this ILoggerFactory factory) {
throw new NotImplementedException();
public interface ILoggingBuilder {
//IServiceCollection Services { get; }
}
public static ILoggerFactory AddConsole(this ILoggerFactory factory, bool includeScopes) {
throw new NotImplementedException();
public class ConsoleLoggerOptions {
public bool IncludeScopes { get; set; } = false;
}
public static class ConsoleLoggerExtensions {
public static ILoggingBuilder AddConsole(this ILoggingBuilder builder) {
throw new NotImplementedException();
}

public static ILoggerFactory AddConsole(this ILoggerFactory factory, LogLevel minLevel) {
throw new NotImplementedException();
}
public static ILoggingBuilder AddConsole(this ILoggingBuilder builder, Action<ConsoleLoggerOptions> configure) {
throw new NotImplementedException();
}

public static ILoggerFactory AddConsole(
this ILoggerFactory factory,
LogLevel minLevel,
bool includeScopes) {
throw new NotImplementedException();
}
public static ILoggerFactory AddConsole(
this ILoggerFactory factory,
Func<string, LogLevel, bool> filter) {
throw new NotImplementedException();
}
public static ILoggerFactory AddConsole(
this ILoggerFactory factory,
Func<string, LogLevel, bool> filter,
bool includeScopes) {
throw new NotImplementedException();
}
public static ILoggerFactory AddConsole(
this ILoggerFactory factory,
IConsoleLoggerSettings settings) {
throw new NotImplementedException();
}
public static ILoggerFactory AddConsole(this ILoggerFactory factory) {
throw new NotImplementedException();
}
public static ILoggerFactory AddConsole(this ILoggerFactory factory, bool includeScopes) {
throw new NotImplementedException();
}

public static ILoggerFactory AddConsole(this ILoggerFactory factory, IConfiguration configuration) {
throw new NotImplementedException();
}
}
public static ILoggerFactory AddConsole(this ILoggerFactory factory, LogLevel minLevel) {
throw new NotImplementedException();
}

public static ILoggerFactory AddConsole(
this ILoggerFactory factory,
LogLevel minLevel,
bool includeScopes) {
throw new NotImplementedException();
}
public static ILoggerFactory AddConsole(
this ILoggerFactory factory,
Func<string, LogLevel, bool> filter) {
throw new NotImplementedException();
}
public static ILoggerFactory AddConsole(
this ILoggerFactory factory,
Func<string, LogLevel, bool> filter,
bool includeScopes) {
throw new NotImplementedException();
}
public static ILoggerFactory AddConsole(
this ILoggerFactory factory,
IConsoleLoggerSettings settings) {
throw new NotImplementedException();
}

public interface IConfiguration {
string this[string key] { get; set; }
//IConfigurationSection GetSection(string key);
public static ILoggerFactory AddConsole(this ILoggerFactory factory, IConfiguration configuration) {
throw new NotImplementedException();
}
}
public interface IConfiguration {
string this[string key] { get; set; }
//IConfigurationSection GetSection(string key);

//IEnumerable<IConfigurationSection> GetChildren();
//IEnumerable<IConfigurationSection> GetChildren();

//IChangeToken GetReloadToken();
}
namespace Microsoft.Extensions.Logging {
//IChangeToken GetReloadToken();
}
public interface ILogger {
void Log<TState>(LogLevel logLevel, EventId eventId, TState state, Exception exception,
Func<TState, Exception, string> formatter);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,75 +60,74 @@ public ILogger CreateLogger(string categoryName)
}
}
public interface IConsoleLoggerSettings {
bool IncludeScopes { get; }
//IChangeToken ChangeToken { get; }
bool TryGetSwitch(string name, out LogLevel level);
IConsoleLoggerSettings Reload();
}
public interface ILoggingBuilder {
//IServiceCollection Services { get; }
}
public class ConsoleLoggerOptions {
public bool IncludeScopes { get; set; } = false;
}
public static class ConsoleLoggerExtensions {
public static ILoggingBuilder AddConsole(this ILoggingBuilder builder) {
throw new NotImplementedException();
}
public static ILoggingBuilder AddConsole(this ILoggingBuilder builder, Action<ConsoleLoggerOptions> configure) {
throw new NotImplementedException();
namespace Microsoft.Extensions.Logging {
public interface IConsoleLoggerSettings {
bool IncludeScopes { get; }
//IChangeToken ChangeToken { get; }
bool TryGetSwitch(string name, out LogLevel level);
IConsoleLoggerSettings Reload();
}
public static ILoggerFactory AddConsole(this ILoggerFactory factory) {
throw new NotImplementedException();
public interface ILoggingBuilder {
//IServiceCollection Services { get; }
}
public static ILoggerFactory AddConsole(this ILoggerFactory factory, bool includeScopes) {
throw new NotImplementedException();
public class ConsoleLoggerOptions {
public bool IncludeScopes { get; set; } = false;
}
public static class ConsoleLoggerExtensions {
public static ILoggingBuilder AddConsole(this ILoggingBuilder builder) {
throw new NotImplementedException();
}
public static ILoggerFactory AddConsole(this ILoggerFactory factory, LogLevel minLevel) {
throw new NotImplementedException();
}
public static ILoggingBuilder AddConsole(this ILoggingBuilder builder, Action<ConsoleLoggerOptions> configure) {
throw new NotImplementedException();
}
public static ILoggerFactory AddConsole(
this ILoggerFactory factory,
LogLevel minLevel,
bool includeScopes) {
throw new NotImplementedException();
}
public static ILoggerFactory AddConsole(
this ILoggerFactory factory,
Func<string, LogLevel, bool> filter) {
throw new NotImplementedException();
}
public static ILoggerFactory AddConsole(
this ILoggerFactory factory,
Func<string, LogLevel, bool> filter,
bool includeScopes) {
throw new NotImplementedException();
}
public static ILoggerFactory AddConsole(
this ILoggerFactory factory,
IConsoleLoggerSettings settings) {
throw new NotImplementedException();
}
public static ILoggerFactory AddConsole(this ILoggerFactory factory) {
throw new NotImplementedException();
}
public static ILoggerFactory AddConsole(this ILoggerFactory factory, bool includeScopes) {
throw new NotImplementedException();
}
public static ILoggerFactory AddConsole(this ILoggerFactory factory, IConfiguration configuration) {
throw new NotImplementedException();
}
}
public static ILoggerFactory AddConsole(this ILoggerFactory factory, LogLevel minLevel) {
throw new NotImplementedException();
}
public static ILoggerFactory AddConsole(
this ILoggerFactory factory,
LogLevel minLevel,
bool includeScopes) {
throw new NotImplementedException();
}
public static ILoggerFactory AddConsole(
this ILoggerFactory factory,
Func<string, LogLevel, bool> filter) {
throw new NotImplementedException();
}
public static ILoggerFactory AddConsole(
this ILoggerFactory factory,
Func<string, LogLevel, bool> filter,
bool includeScopes) {
throw new NotImplementedException();
}
public static ILoggerFactory AddConsole(
this ILoggerFactory factory,
IConsoleLoggerSettings settings) {
throw new NotImplementedException();
}
public interface IConfiguration {
string this[string key] { get; set; }
//IConfigurationSection GetSection(string key);
public static ILoggerFactory AddConsole(this ILoggerFactory factory, IConfiguration configuration) {
throw new NotImplementedException();
}
}
public interface IConfiguration {
string this[string key] { get; set; }
//IConfigurationSection GetSection(string key);
//IEnumerable<IConfigurationSection> GetChildren();
//IEnumerable<IConfigurationSection> GetChildren();
//IChangeToken GetReloadToken();
}
namespace Microsoft.Extensions.Logging {
//IChangeToken GetReloadToken();
}
public interface ILogger {
void Log<TState>(LogLevel logLevel, EventId eventId, TState state, Exception exception,
Func<TState, Exception, string> formatter);
Expand Down

0 comments on commit 1f3f6fd

Please sign in to comment.