Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tool version #135

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion inc/vcf/odb_report.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ namespace ebi
// ReportWriter implementation
virtual void write_error(Error &error) override;
virtual void write_warning(Error &error) override;
virtual void write_message(const std::string &report_result) override;
virtual void write_message(const std::string &message) override;

// ReportReader implementation
virtual size_t count_warnings() override;
Expand Down
6 changes: 3 additions & 3 deletions inc/vcf/report_writer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ namespace ebi
virtual ~ReportWriter() {} // needed if using raw pointers, instead of references or shared_ptrs in children
virtual void write_error(Error &error) = 0;
virtual void write_warning(Error &error) = 0;
virtual void write_message(const std::string &report_result) = 0;
virtual void write_message(const std::string &message) = 0;

virtual std::string get_report_message() = 0;
};
Expand Down Expand Up @@ -61,9 +61,9 @@ namespace ebi
file << error.what() << " (warning)" << std::endl;
}

virtual void write_message(const std::string &report_result) override
virtual void write_message(const std::string &message) override
{
file << report_result << std::endl;
file << message << std::endl;
}

virtual std::string get_report_message() override
Expand Down
7 changes: 2 additions & 5 deletions inc/vcf/summary_report_writer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,9 @@ namespace ebi
summary.add_to_summary("Warning: " + error.message, error.line);
}

virtual void write_message(const std::string &report_result) override
virtual void write_message(const std::string &message) override
{
this->report_result = report_result;
file << message << std::endl;
}

virtual std::string get_report_message() override
Expand All @@ -100,14 +100,11 @@ namespace ebi

private:
SummaryTracker summary;
std::string report_result;
std::string file_name;
std::ofstream file;

void write_summary()
{
file << report_result << std::endl;

for (auto & error_message : summary.error_order) {
file << error_message << ". This occurs " << summary.error_summary_report[error_message].occurrences
<< " time(s), first time in line " << summary.error_summary_report[error_message].first_occurrence_line << "." << std::endl;
Expand Down
4 changes: 4 additions & 0 deletions src/validator_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,10 @@ int main(int argc, char** argv)
auto outdir = get_output_path(vm[ebi::vcf::OUTDIR].as<std::string>(), path);
auto outputs = get_outputs(vm[ebi::vcf::REPORT].as<std::string>(), outdir);

for (auto & output : outputs) {
output->write_message(version_info);
}

if (path == ebi::vcf::STDIN) {
BOOST_LOG_TRIVIAL(info) << "Reading from standard input...";
is_valid = ebi::vcf::is_valid_vcf_file(std::cin, path, validationLevel, outputs);
Expand Down
2 changes: 1 addition & 1 deletion src/vcf/odb_report.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ namespace ebi
error.severity = Severity::WARNING;
write(error);
}
void OdbReportRW::write_message(const std::string &report_result)
void OdbReportRW::write_message(const std::string &message)
{
// do nothing
}
Expand Down
2 changes: 1 addition & 1 deletion test/vcf/report_writer_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ namespace ebi
input.close();
}

CHECK(count_lines(summary_path.string()) == 3);
CHECK(count_lines(summary_path.string()) == 2);
}

boost::filesystem::remove(summary_path);
Expand Down