MCPcopy Create free account
hub / github.com/OpenCppCoverage/OpenCppCoverage / AddUnifiedDiff

Function AddUnifiedDiff

CppCoverage/OptionsParser.cpp:198–232  ·  view source on GitHub ↗

----------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

196
197 //----------------------------------------------------------------------------
198 void AddUnifiedDiff(const ProgramOptionsVariablesMap& variablesMap,
199 Options& options)
200 {
201 auto unifiedDiffCollection =
202 variablesMap.GetOptionalValue<std::vector<std::string>>(
203 ProgramOptions::UnifiedDiffOption);
204
205 if (unifiedDiffCollection)
206 {
207 for (const auto& unifiedDiff : *unifiedDiffCollection)
208 {
209 fs::path unifiedDiffPath;
210 boost::optional<fs::path> rootDiffFolder;
211
212 std::tie(unifiedDiffPath, rootDiffFolder) =
213 ExtractUnifiedDiffOption(unifiedDiff);
214
215 if (!fs::is_regular_file(unifiedDiffPath))
216 {
217 throw Plugin::OptionsParserException("Unified diff path " +
218 unifiedDiffPath.string() +
219 " does not exist.");
220 }
221 if (rootDiffFolder && !is_directory(*rootDiffFolder))
222 {
223 throw Plugin::OptionsParserException(
224 "Unified diff root folder " +
225 rootDiffFolder->string() + " does not exist.");
226 }
227
228 options.AddUnifiedDiffSettings(
229 UnifiedDiffSettings{unifiedDiffPath, rootDiffFolder});
230 }
231 }
232 }
233
234 //----------------------------------------------------------------------------
235 void

Callers 1

ParseMethod · 0.85

Calls 3

ExtractUnifiedDiffOptionFunction · 0.85

Tested by

no test coverage detected