Capstone C++ Workflows
Release Score
A capstone workflow can combine several measurements into one release signal.
Release Score
release_score.cpp
#include <iostream>
struct ReleaseStats {
int tests;
int warnings;
int blockers;
};
int scoreRelease(const ReleaseStats& stats) {
return stats.tests * 10 - stats.warnings * 2 - stats.blockers * 25;
}
int main() {
int warnings = ;
ReleaseStats stats{12, warnings, 1};
int score = scoreRelease(stats);
bool ready = score >= 80;
std::cout << "warnings=" << warnings << std::endl;
std::cout << "score=" << score << std::endl;
std::cout << "ready=" << ready << std::endl;
return 0;
}
#include <iostream>
struct ReleaseStats {
int tests;
int warnings;
int blockers;
};
int scoreRelease(const ReleaseStats& stats) {
return stats.tests * 10 - stats.warnings * 2 - stats.blockers * 25;
}
int main() {
int warnings = ;
ReleaseStats stats{12, warnings, 1};
int score = scoreRelease(stats);
bool ready = score >= 80;
std::cout << "warnings=" << warnings << std::endl;
std::cout << "score=" << score << std::endl;
std::cout << "ready=" << ready << std::endl;
return 0;
}
#include <iostream>
struct ReleaseStats {
int tests;
int warnings;
int blockers;
};
int scoreRelease(const ReleaseStats& stats) {
return stats.tests * 10 - stats.warnings * 2 - stats.blockers * 25;
}
int main() {
int warnings = ;
ReleaseStats stats{12, warnings, 1};
int score = scoreRelease(stats);
bool ready = score >= 80;
std::cout << "warnings=" << warnings << std::endl;
std::cout << "score=" << score << std::endl;
std::cout << "ready=" << ready << std::endl;
return 0;
}
scoring
A scoring helper keeps the release rule in one place while main prepares the inputs.
readiness
The final boolean is easier to inspect than repeating the score threshold everywhere.