Beispiel #1
0
        internal static string FindBetterName(IParameterSymbol symbol)
        {
            var method = symbol.GetEnclosingMethod();

            return(symbol.Equals(method.Parameters[0], SymbolEqualityComparer.Default)
                       ? Parameter1
                       : Parameter2);
        }
Beispiel #2
0
        internal static string FindBetterName(IParameterSymbol symbol)
        {
            var method     = symbol.GetEnclosingMethod();
            var parameters = method.Parameters;

            if (parameters.Length != 2)
            {
                return("value");
            }

            var isParameter1 = symbol.Equals(parameters[0], SymbolEqualityComparer.Default);

            return(isParameter1 ? "left" : "right");
        }
        internal static string FindBetterName(IParameterSymbol symbol)
        {
            var method = symbol.GetEnclosingMethod();

            var applicableParameters = method.Parameters.Where(_ => _.Type.IsEventArgs()).ToList();

            if (applicableParameters.Count == 1)
            {
                return(method.Name == nameof(Equals) ? "other" : "e");
            }

            var i = applicableParameters.IndexOf(symbol);

            return("e" + i);
        }
        internal static bool IsAccepted(IParameterSymbol parameter)
        {
            var method = parameter.GetEnclosingMethod();

            return(GetParameters(method).Contains(parameter) && FindBetterName(parameter) == parameter.Name);
        }
Beispiel #5
0
 protected override bool ShallAnalyze(IParameterSymbol symbol) => symbol.GetEnclosingMethod().IsInterfaceImplementation() is false;
Beispiel #6
0
 protected override string FindBetterName(IParameterSymbol symbol) => MiKo_1061_TryMethodOutParameterNameAnalyzer.FindBetterName(symbol.GetEnclosingMethod());
Beispiel #7
0
 protected override bool ShallAnalyze(IParameterSymbol symbol) => ShallAnalyze(symbol.GetEnclosingMethod());
 protected override bool ShallAnalyzeParameter(IParameterSymbol parameter) => parameter.RefKind != RefKind.Out &&
 parameter.Type.IsBoolean() &&
 parameter.GetEnclosingMethod().Name != nameof(IDisposable.Dispose);