Skip to content

Commit

Permalink
Fixing more warnings (#2258)
Browse files Browse the repository at this point in the history
* Fixing more warnings

* fixing build issues (Reverting)
  • Loading branch information
eddynaka committed Jan 22, 2021
1 parent a3019d3 commit bdc9747
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 12 deletions.
4 changes: 2 additions & 2 deletions src/Sarif.Converters/Extensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ public static bool HasDefaultConstructor(this Type type)
return type.GetConstructor(
BindingFlags.Instance | BindingFlags.Public,
binder: null,
types: new Type[0], // The types of the constructor arguments.
modifiers: new ParameterModifier[0]) != null;
types: Array.Empty<Type>(), // The types of the constructor arguments.
modifiers: Array.Empty<ParameterModifier>()) != null;
}

// Enforce the convention that the converter type name is derived from the tool name.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public abstract class SarifValidationSkimmerBase : Skimmer<SarifValidationContex

protected override sealed ResourceManager ResourceManager => RuleResources.ResourceManager;

private readonly string[] _emptyMessageResourceNames = new string[0];
private readonly string[] _emptyMessageResourceNames = Array.Empty<string>();

protected override IEnumerable<string> MessageResourceNames => _emptyMessageResourceNames;

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

namespace Microsoft.CodeAnalysis.Sarif.Baseline.ResultMatching.HeuristicMatchers
{
interface IResultMatchingComparer : IEqualityComparer<ExtractedResult>
internal interface IResultMatchingComparer : IEqualityComparer<ExtractedResult>
{
/// <summary>
/// Checks if the result matcher applies to a particular result.
Expand Down
2 changes: 1 addition & 1 deletion src/Sarif/Baseline/SarifLogBaseliner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace Microsoft.CodeAnalysis.Sarif.Baseline
{
internal class SarifLogBaseliner : ISarifLogBaseliner
{
readonly IEqualityComparer<Result> ResultComparator;
private readonly IEqualityComparer<Result> ResultComparator;

public SarifLogBaseliner(IEqualityComparer<Result> comparator)
{
Expand Down
6 changes: 3 additions & 3 deletions src/Sarif/Errors.cs
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ public static void LogExceptionCreatingLogFile(IAnalysisContext context, string
ERR997_ExceptionCreatingLogFile,
ruleId: null,
FailureLevel.Error,
exception: null,
exception: exception,
persistExceptionStack: false,
messageFormat: null,
fileName));
Expand Down Expand Up @@ -208,7 +208,7 @@ public static void LogExceptionAccessingFile(IAnalysisContext context, string fi
ERR997_ExceptionAccessingFile,
ruleId: null,
FailureLevel.Error,
exception: null,
exception: exception,
persistExceptionStack: false,
messageFormat: null,
fileName));
Expand Down Expand Up @@ -307,7 +307,7 @@ public static void LogExceptionLoadingPlugin(string pluginFilePath, IAnalysisCon
ERR997_ExceptionLoadingPlugIn,
ruleId: null,
FailureLevel.Error,
exception: null,
exception: exception,
persistExceptionStack: false,
messageFormat: null,
pluginFilePath));
Expand Down
2 changes: 1 addition & 1 deletion src/Sarif/Processors/Generic/GenericActionPipeline.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace Microsoft.CodeAnalysis.Sarif.Processors
{
public class GenericActionPipeline<T> : IActionWrapper<T>
{
readonly IEnumerable<IActionWrapper<T>> _stages;
private readonly IEnumerable<IActionWrapper<T>> _stages;

public GenericActionPipeline(IEnumerable<IActionWrapper<T>> stages)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Sarif/Visitors/FilteringVisitor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public class FilteringVisitor : SarifRewritingVisitor
private readonly IncludeResultPredicate predicate;

private Run currentRun;
bool includeReferencedObjects = true;
private bool includeReferencedObjects = true;

private IList<Result> filteredResults;
private IList<Artifact> filteredArtifacts;
Expand Down
3 changes: 1 addition & 2 deletions src/Sarif/Writers/PrereleaseCompatibilityTransformer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1852,7 +1852,6 @@ private static JToken ConvertRulesDictionaryToArray(JObject rules, Dictionary<st
foreach (JProperty ruleEntry in rules.Properties())
{
AddEntryToRuleToIndexMap(
rules,
ruleEntry.Name,
(JObject)ruleEntry.Value,
jObjectToIndexMap,
Expand All @@ -1871,7 +1870,7 @@ private static JToken ConvertRulesDictionaryToArray(JObject rules, Dictionary<st
return new JArray(rulesArray);
}

private static void AddEntryToRuleToIndexMap(JObject rulesDictionary, string key, JObject rule, Dictionary<JObject, int> jObjectToIndexMap, Dictionary<string, int> ruleKeyToIndexMap)
private static void AddEntryToRuleToIndexMap(string key, JObject rule, Dictionary<JObject, int> jObjectToIndexMap, Dictionary<string, int> ruleKeyToIndexMap)
{
ruleKeyToIndexMap = ruleKeyToIndexMap ?? throw new ArgumentNullException(nameof(ruleKeyToIndexMap));
jObjectToIndexMap = jObjectToIndexMap ?? throw new ArgumentNullException(nameof(jObjectToIndexMap));
Expand Down

0 comments on commit bdc9747

Please sign in to comment.