mirror of
https://github.com/johndoe6345789/GithubWorkflowTool.git
synced 2026-04-24 13:45:02 +00:00
Address code review feedback: use modern C++ range-based loops
- Use asKeyValueRange() for cleaner QMap iteration - Use jobId from map key instead of job.id field - Improve code readability and consistency Co-authored-by: johndoe6345789 <224850594+johndoe6345789@users.noreply.github.com>
This commit is contained in:
@@ -239,13 +239,12 @@ int CommandHandler::handleDoctor(const QStringList& args) {
|
||||
|
||||
// Check for job dependencies
|
||||
bool hasValidDeps = true;
|
||||
for (auto it = workflow.jobs.begin(); it != workflow.jobs.end(); ++it) {
|
||||
const WorkflowJob& job = it.value();
|
||||
for (const auto& [jobId, job] : workflow.jobs.asKeyValueRange()) {
|
||||
if (!job.needs.isEmpty()) {
|
||||
for (const QString& dep : job.needs) {
|
||||
if (!workflow.jobs.contains(dep)) {
|
||||
hasValidDeps = false;
|
||||
out << "✗ Error: Job '" << job.id << "' depends on non-existent job '" << dep << "'" << Qt::endl;
|
||||
out << "✗ Error: Job '" << jobId << "' depends on non-existent job '" << dep << "'" << Qt::endl;
|
||||
errors++;
|
||||
issues++;
|
||||
}
|
||||
@@ -255,8 +254,8 @@ int CommandHandler::handleDoctor(const QStringList& args) {
|
||||
|
||||
if (hasValidDeps && workflow.jobs.size() > 1) {
|
||||
bool hasDeps = false;
|
||||
for (auto it = workflow.jobs.begin(); it != workflow.jobs.end(); ++it) {
|
||||
if (!it.value().needs.isEmpty()) {
|
||||
for (const auto& [jobId, job] : workflow.jobs.asKeyValueRange()) {
|
||||
if (!job.needs.isEmpty()) {
|
||||
hasDeps = true;
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user