📄 core/src/ScannerOptions.cs
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
using System.Collections.Immutable;
using System.Linq;
using GlobExpressions;

namespace Cfa;

public sealed record ScannerOptions
{
    public IImmutableList<Glob> IncludePatterns { get; init; } = [];
    public IImmutableList<Glob> ExcludePatterns { get; init; } = [];

    internal bool IncludesProject(string projectPath) =>
        (IncludePatterns.Count == 0 || IncludePatterns.Any(pattern => pattern.IsMatch(projectPath)))
        && !ExcludePatterns.Any(pattern => pattern.IsMatch(projectPath));
}