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

Commit

Permalink
CatalogStartegy returns ative linters (#31)
Browse files Browse the repository at this point in the history
* Now CatalogStartegy returns ative linters
* Improve CatalogStartegy code
  • Loading branch information
Oleg Safonov authored and xferra committed Jan 26, 2017
1 parent a158f00 commit 703ad84
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
11 changes: 10 additions & 1 deletion src/cli/Strategy/CatalogStrategy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,30 @@ namespace Linterhub.Cli.Strategy
using Runtime;
using Engine;
using Engine.Exceptions;
using System.IO;
using Engine.Extensions;

public class CatalogStrategy : IStrategy
{
public object Run(RunContext context, LinterFactory factory, LogManager log)
{
var catalog = GetCatalog(context, factory);
ProjectConfig config = null;
if(context.Project != null)
{
var projectConfigFile = context.GetProjectConfigPath();
if(File.Exists(projectConfigFile))
config = context.GetProjectConfig();
}
var result =
from record in factory.GetRecords().OrderBy(x => x.Name)
let item = catalog.linters.FirstOrDefault(y => y.name == record.Name)
select new
{
name = record.Name,
description = item?.description,
languages = item?.languages
languages = item?.languages,
active = config == null ? false : config?.Linters.Any(x => x.Name == record.Name && x.Active == true)
};

return result;
Expand Down
2 changes: 1 addition & 1 deletion src/cli/project.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "1.3.0-*",
"version": "1.3.1-*",
"buildOptions": {
"outputName": "cli",
"debugType": "portable",
Expand Down

0 comments on commit 703ad84

Please sign in to comment.