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

MeindertN / RoboClerk / 19315366704

12 Nov 2025 05:53PM UTC coverage: 72.366% (-0.7%) from 73.034%
19315366704

push

github

MeindertN
WIP: Added support for listing template files for inclusion in other files, getting and changing the project configuration, refreshing the project (with or without tag calculations) and refreshing the project datasources. TODO: ensure the refresh works as expected in all plugins and add the ability to return the specifications and parameters for all content creators. For this, each individual content creator needs to be able to describe its own parameters.

1747 of 2521 branches covered (69.3%)

Branch coverage included in aggregate %.

61 of 71 new or added lines in 4 files covered. (85.92%)

239 existing lines in 13 files now uncovered.

5685 of 7749 relevant lines covered (73.36%)

54.75 hits per line

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

85.78
/RoboClerk.Core/DataSources/CheckpointDataSources.cs
1
using RoboClerk.Core.Configuration;
2
using System;
3
using System.Collections.Generic;
4
using System.IO.Abstractions;
5
using System.Text.Json;
6

7
namespace RoboClerk
8
{
9
    public class CheckpointDataSources : DataSourcesBase
10
    {
11
        private CheckpointDataStorage dataStorage = new CheckpointDataStorage();
5✔
12
        private IDataSources? pluginDatasource = null;
5✔
13
        private string checkpointFile = string.Empty;
5✔
14

15
        public CheckpointDataSources(IConfiguration configuration, IPluginLoader pluginLoader, IFileProviderPlugin fileSystem, string checkpointFile)
16
            : base(configuration, fileSystem)
5✔
17
        {
5✔
18
            logger.Info($"RoboClerk is using the following checkpoint file in the template directory to read its input data: {checkpointFile}");
5✔
19
            pluginDatasource = new PluginDataSources(configuration, pluginLoader, fileSystem);
5✔
20
            SetFileSource(checkpointFile);
5✔
21
            ChangeUpdatedItems();
4✔
22
        }
4✔
23

24
        public void SetFileSource(string fileName)
25
        {
5✔
26
            checkpointFile = fileSystem.Combine(new string[] { configuration.TemplateDir, fileName });
5✔
27
            if (!fileSystem.FileExists(checkpointFile))
5✔
28
            {
1✔
29
                throw new Exception($"Could not find checkpoint file \"{checkpointFile}\". Unable to continue.");
1✔
30
            }
31
            dataStorage = JsonSerializer.Deserialize<CheckpointDataStorage>(GetFileStreamFromTemplateDir(fileName));
4✔
32
        }
4✔
33

34
        public override void RefreshDataSources()
NEW
35
        {
×
NEW
36
            SetFileSource(checkpointFile);
×
NEW
37
            ChangeUpdatedItems();
×
NEW
38
        }
×
39

40
        private void ChangeUpdatedItems()
41
        {
4✔
42
            var checkpointConfig = configuration.CheckpointConfig;
4✔
43
            foreach (var riskID in checkpointConfig.UpdatedRiskIDs)
16✔
44
            {
2✔
45
                var sourceRiskItem = pluginDatasource.GetRisk(riskID);
2✔
46
                if (sourceRiskItem != null)
2✔
47
                {
1✔
48
                    //item still exists, update it
49
                    dataStorage.UpdateRisk(sourceRiskItem);
1✔
50
                }
1✔
51
                else
52
                {
1✔
53
                    //item no longer exists, should remove from checkpoint data
54
                    dataStorage.RemoveRisk(riskID);
1✔
55
                }
1✔
56
            }
2✔
57
            foreach (var systemRequirementID in checkpointConfig.UpdatedSystemRequirementIDs)
16✔
58
            {
2✔
59
                var systemRequirement = pluginDatasource.GetSystemRequirement(systemRequirementID);
2✔
60
                if (systemRequirement != null)
2✔
61
                {
1✔
62
                    //item still exists, update it
63
                    dataStorage.UpdateSystemRequirement(systemRequirement);
1✔
64
                }
1✔
65
                else
66
                {
1✔
67
                    //item no longer exists, should remove from checkpoint data
68
                    dataStorage.RemoveSystemRequirement(systemRequirementID);
1✔
69
                }
1✔
70
            }
2✔
71
            foreach (var softwareRequirementID in checkpointConfig.UpdatedSoftwareRequirementIDs)
16✔
72
            {
2✔
73
                var softwareRequirement = pluginDatasource.GetSoftwareRequirement(softwareRequirementID);
2✔
74
                if (softwareRequirement != null)
2✔
75
                {
1✔
76
                    //item still exists, update it
77
                    dataStorage.UpdateSoftwareRequirement(softwareRequirement);
1✔
78
                }
1✔
79
                else
80
                {
1✔
81
                    //item no longer exists, should remove from checkpoint data
82
                    dataStorage.RemoveSoftwareRequirement(softwareRequirementID);
1✔
83
                }
1✔
84
            }
2✔
85
            foreach (var documentationRequirementID in checkpointConfig.UpdatedDocumentationRequirementIDs)
16✔
86
            {
2✔
87
                var documentationRequirement = pluginDatasource.GetDocumentationRequirement(documentationRequirementID);
2✔
88
                if (documentationRequirement != null)
2✔
89
                {
1✔
90
                    //item still exists, update it
91
                    dataStorage.UpdateDocumentationRequirement(documentationRequirement);
1✔
92
                }
1✔
93
                else
94
                {
1✔
95
                    //item no longer exists, should remove from checkpoint data
96
                    dataStorage.RemoveDocumentationRequirement(documentationRequirementID);
1✔
97
                }
1✔
98
            }
2✔
99
            foreach (var docContentID in checkpointConfig.UpdatedDocContentIDs)
16✔
100
            {
2✔
101
                var docContent = pluginDatasource.GetDocContent(docContentID);
2✔
102
                if (docContent != null)
2✔
103
                {
1✔
104
                    //item still exists, update it
105
                    dataStorage.UpdateDocContent(docContent);
1✔
106
                }
1✔
107
                else
108
                {
1✔
109
                    //item no longer exists, should remove from checkpoint data
110
                    dataStorage.RemoveDocContent(docContentID);
1✔
111
                }
1✔
112
            }
2✔
113
            foreach (var softwareSystemTestID in checkpointConfig.UpdatedSoftwareSystemTestIDs)
16✔
114
            {
2✔
115
                var softwareSystemTest = pluginDatasource.GetSoftwareSystemTest(softwareSystemTestID);
2✔
116
                if (softwareSystemTest != null)
2✔
117
                {
1✔
118
                    //item still exists, update it
119
                    dataStorage.UpdateSoftwareSystemTest(softwareSystemTest);
1✔
120
                }
1✔
121
                else
122
                {
1✔
123
                    //item no longer exists, should remove from checkpoint data
124
                    dataStorage.RemoveSoftwareSystemTest(softwareSystemTestID);
1✔
125
                }
1✔
126
            }
2✔
127
            foreach (var unitTestID in checkpointConfig.UpdatedUnitTestIDs)
16✔
128
            {
2✔
129
                var unitTest = pluginDatasource.GetUnitTest(unitTestID);
2✔
130
                if (unitTest != null)
2✔
131
                {
1✔
132
                    //item still exists, update it
133
                    dataStorage.UpdateUnitTest(unitTest);
1✔
134
                }
1✔
135
                else
136
                {
1✔
137
                    //item no longer exists, should remove from checkpoint data
138
                    dataStorage.RemoveUnitTest(unitTestID);
1✔
139
                }
1✔
140
            }
2✔
141
            foreach (var anomalyID in checkpointConfig.UpdatedAnomalyIDs)
16✔
142
            {
2✔
143
                var anomaly = pluginDatasource.GetAnomaly(anomalyID);
2✔
144
                if (anomaly != null)
2✔
145
                {
1✔
146
                    //item still exists, update it
147
                    dataStorage.UpdateAnomaly(anomaly);
1✔
148
                }
1✔
149
                else
150
                {
1✔
151
                    //item no longer exists, should remove from checkpoint data
152
                    dataStorage.RemoveAnomaly(anomalyID);
1✔
153
                }
1✔
154
            }
2✔
155
            foreach (var soupID in checkpointConfig.UpdatedSOUPIDs)
16✔
156
            {
2✔
157
                var soup = pluginDatasource.GetSOUP(soupID);
2✔
158
                if (soup != null)
2✔
159
                {
1✔
160
                    //item still exists, update it
161
                    dataStorage.UpdateSOUP(soup);
1✔
162
                }
1✔
163
                else
164
                {
1✔
165
                    //item no longer exists, should remove from checkpoint data
166
                    dataStorage.RemoveSOUP(soupID);
1✔
167
                }
1✔
168
            }
2✔
169
        }
4✔
170

171
        public override List<AnomalyItem> GetAllAnomalies()
172
        {
3✔
173
            return dataStorage.Anomalies;
3✔
174
        }
3✔
175

176
        public override List<EliminatedAnomalyItem> GetAllEliminatedAnomalies()
177
        {
×
178
            return dataStorage.EliminatedAnomalies;
×
179
        }
×
180

181
        public override List<ExternalDependency> GetAllExternalDependencies()
182
        {
1✔
183
            return pluginDatasource.GetAllExternalDependencies();
1✔
184
        }
1✔
185

186
        public override List<TestResult> GetAllTestResults()
187
        {
×
188
            return pluginDatasource.GetAllTestResults(); 
×
189
        }
×
190

191
        public override List<RiskItem> GetAllRisks()
192
        {
3✔
193
            return dataStorage.Risks;
3✔
194
        }
3✔
195

196
        public override List<EliminatedRiskItem> GetAllEliminatedRisks()
197
        {
×
198
            return dataStorage.EliminatedRisks;
×
199
        }
×
200

201
        public override List<RequirementItem> GetAllSoftwareRequirements()
202
        {
3✔
203
            return dataStorage.SoftwareRequirements;
3✔
204
        }
3✔
205

206
        public override List<EliminatedRequirementItem> GetAllEliminatedSoftwareRequirements()
207
        {
×
208
            return dataStorage.EliminatedSoftwareRequirements;
×
209
        }
×
210

211
        public override List<SoftwareSystemTestItem> GetAllSoftwareSystemTests()
212
        {
3✔
213
            return dataStorage.SoftwareSystemTests;
3✔
214
        }
3✔
215

216
        public override List<EliminatedSoftwareSystemTestItem> GetAllEliminatedSoftwareSystemTests()
217
        {
×
218
            return dataStorage.EliminatedSoftwareSystemTests;
×
219
        }
×
220

221
        public override List<UnitTestItem> GetAllUnitTests()
222
        {
3✔
223
            return dataStorage.UnitTests;
3✔
224
        }
3✔
225

226
        public override List<SOUPItem> GetAllSOUP()
227
        {
3✔
228
            return dataStorage.SOUPs;
3✔
229
        }
3✔
230

231
        public override List<EliminatedSOUPItem> GetAllEliminatedSOUP()
232
        {
×
233
            return dataStorage.EliminatedSOUPs;
×
234
        }
×
235

236
        public override List<RequirementItem> GetAllSystemRequirements()
237
        {
3✔
238
            return dataStorage.SystemRequirements;
3✔
239
        }
3✔
240

241
        public override List<EliminatedRequirementItem> GetAllEliminatedSystemRequirements()
242
        {
×
243
            return dataStorage.EliminatedSystemRequirements;
×
244
        }
×
245

246
        public override List<RequirementItem> GetAllDocumentationRequirements()
247
        {
3✔
248
            return dataStorage.DocumentationRequirements;
3✔
249
        }
3✔
250

251
        public override List<EliminatedRequirementItem> GetAllEliminatedDocumentationRequirements()
252
        {
×
253
            return dataStorage.EliminatedDocumentationRequirements;
×
254
        }
×
255

256
        public override List<DocContentItem> GetAllDocContents()
257
        {
3✔
258
            return dataStorage.DocContents;
3✔
259
        }
3✔
260

261
        public override List<EliminatedDocContentItem> GetAllEliminatedDocContents()
262
        {
×
263
            return dataStorage.EliminatedDocContents;
×
264
        }
×
265
    }
266
}
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