• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

MeindertN / RoboClerk / 6606619471

22 Oct 2023 10:37PM UTC coverage: 80.755% (+0.4%) from 80.334%
6606619471

push

github

web-flow
Merge pull request #54 from MeindertN/V1.2.0

V1.2.0

888 of 1088 branches covered (0.0%)

Branch coverage included in aggregate %.

1729 of 1729 new or added lines in 36 files covered. (100.0%)

3027 of 3760 relevant lines covered (80.51%)

115.2 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

86.57
/RoboClerk/PluginSupport/SourceCodeAnalysisPluginBase.cs
1
using RoboClerk.Configuration;
2
using System;
3
using System.Collections.Generic;
4
using System.IO;
5
using System.IO.Abstractions;
6
using Tomlyn.Model;
7

8
namespace RoboClerk
9
{
10
    public abstract class SourceCodeAnalysisPluginBase : DataSourcePluginBase
11
    {
12
        protected bool subDir = false;
7✔
13
        protected List<string> directories = new List<string>();
7✔
14
        protected List<string> fileMasks = new List<string>();
7✔
15
        protected List<string> sourceFiles = new List<string>();
7✔
16
        protected GitRepository gitRepo = null;
7✔
17

18
        public SourceCodeAnalysisPluginBase(IFileSystem fileSystem)
19
            : base(fileSystem)
7✔
20
        {
7✔
21
        }
7✔
22

23
        public override void Initialize(IConfiguration configuration)
24
        {
5✔
25
            var config = GetConfigurationTable(configuration.PluginConfigDir, $"{name}.toml");
5✔
26
            subDir = (bool)config["SubDirs"];
5✔
27
            foreach (var obj in (TomlArray)config["TestDirectories"])
35✔
28
            {
10✔
29
                directories.Add((string)obj);
10✔
30
            }
10✔
31

32
            foreach (var obj in (TomlArray)config["FileMasks"])
29✔
33
            {
7✔
34
                fileMasks.Add((string)obj);
7✔
35
            }
7✔
36

37
            try
38
            {
5✔
39
                if (config.ContainsKey("UseGit") && (bool)config["UseGit"])
5!
40
                {
×
41
                    gitRepo = new GitRepository(configuration);
×
42
                }
×
43
            }
5✔
44
            catch (Exception)
×
45
            {
×
46
                logger.Error($"Error opening git repo at project root \"{configuration.ProjectRoot}\" even though the {name}.toml configuration file UseGit setting was set to true.");
×
47
                throw;
×
48
            }
49
        }
5✔
50

51
        protected void ScanDirectoriesForSourceFiles()
52
        {
4✔
53
            sourceFiles.Clear();
4✔
54
            foreach (var testDirectory in directories)
27✔
55
            {
8✔
56
                IDirectoryInfo dir = fileSystem.DirectoryInfo.New(testDirectory);
8✔
57
                try
58
                {
8✔
59
                    foreach (var fileMask in fileMasks)
45✔
60
                    {
11✔
61
                        IFileInfo[] files = dir.GetFiles(fileMask, subDir ? SearchOption.AllDirectories : SearchOption.TopDirectoryOnly);
11✔
62
                        foreach (var file in files)
58✔
63
                        {
14✔
64
                            sourceFiles.Add(file.FullName);
14✔
65
                        }
14✔
66
                    }
10✔
67
                }
7✔
68
                catch
1✔
69
                {
1✔
70
                    logger.Error($"Error reading directory {testDirectory}");
1✔
71
                    throw;
1✔
72
                }
73
            }
7✔
74
        }
3✔
75
    }
76
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc