Skip to content
This repository has been archived by the owner on Apr 10, 2018. It is now read-only.

Commit

Permalink
Fix problem with filters while stdin analyze (#81)
Browse files Browse the repository at this point in the history
  • Loading branch information
Oleg Safonov authored and xferra committed Jul 27, 2017
1 parent 912c305 commit e63e753
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 16 deletions.
32 changes: 17 additions & 15 deletions src/core/Runtime/EngineRunner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,11 @@ public LinterhubOutputSchema RunAnalyze(
{
return Directory.GetFiles(context.WorkingDirectory, x, System.IO.SearchOption.AllDirectories).ToList();
}).SelectMany(x => x).ToList()
.ForEach(x => {
.ForEach(x =>
{
var lo = new EngineOptions();
context.RunOptions.Select(y => {
context.RunOptions.Select(y =>
{
if (y.Key == "{path}")
{
return new KeyValuePair<string, string>(y.Key, Path.GetFullPath(x)
Expand Down Expand Up @@ -123,7 +125,8 @@ public LinterhubOutputSchema RunAnalyze(
result.AddRange(parsedOutput.Where(x => x.Path != string.Empty));
}
if (result.Count != 0) {
if (result.Count != 0)
{
var exists = output.Find(x => x.Engine == context.Specification.Schema.Name);
if (exists != null)
{
Expand Down Expand Up @@ -152,20 +155,19 @@ public LinterhubOutputSchema RunAnalyze(
});

if(config != null)
output.ForEach(x =>
{
output.ForEach(x => {
x.Result.ForEach(y => {
y.Messages = y.Messages.Where(m =>
{
return !(config.Ignore.Find(r => y.Path.Contains(r.Mask)) != null || config.Ignore.Find(r => y.Path.Contains(r.Mask) && m.RuleId == r.RuleId) != null ||
config.Ignore.Find(r => y.Path.Contains(r.Mask) && m.Line == r.Line) != null);
}).OrderBy(z => z.Line).ThenBy(z => z.Column).ThenBy(z => z.RuleId).ToList();
});
x.Result.Sort((a,b) => a.Path.CompareTo(b.Path));
x.Result.ForEach(y =>
{
y.Messages = y.Messages.Where(m =>
{
return config != null ? !(config.Ignore.Find(r => y.Path.Contains(r.Mask)) != null || config.Ignore.Find(r => y.Path.Contains(r.Mask) && m.RuleId == r.RuleId) != null ||
config.Ignore.Find(r => y.Path.Contains(r.Mask) && m.Line == r.Line) != null) : true;
}).OrderBy(z => z.Line).ThenBy(z => z.Column).ThenBy(z => z.RuleId).ToList();
});
output.Sort((a,b) => a.Engine.CompareTo(b.Engine));
}
x.Result.Sort((a, b) => a.Path.CompareTo(b.Path));
});
output.Sort((a, b) => a.Engine.CompareTo(b.Engine));

return output;

Expand Down
2 changes: 1 addition & 1 deletion test
Submodule test updated from 46e21d to 227bb0

0 comments on commit e63e753

Please sign in to comment.