Skip to content

refactor(job): pull out shared fail_cond and log_opt init#57

Merged
dlyongemallo merged 1 commit intomainfrom
refactor_job_utils
Mar 28, 2026
Merged

refactor(job): pull out shared fail_cond and log_opt init#57
dlyongemallo merged 1 commit intomainfrom
refactor_job_utils

Conversation

@dlyongemallo
Copy link
Copy Markdown
Owner

No description provided.

Copilot AI review requested due to automatic review settings March 24, 2026 11:14
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors job-related option initialization by centralizing fail_cond resolution and default log_opt construction into a shared utility module, and adds functional tests to validate the new helpers.

Changes:

  • Introduces diffview.job_utils with resolve_fail_cond() and default_log_opt() helpers.
  • Updates Job and MultiJob initializers to use the shared helpers instead of duplicating logic.
  • Adds functional tests covering both helper functions.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
lua/diffview/job_utils.lua New shared helper module for fail condition resolution and log option defaults.
lua/diffview/job.lua Uses job_utils to initialize log_opt and check_status.
lua/diffview/multi_job.lua Uses job_utils to initialize log_opt and check_status.
lua/diffview/tests/functional/job_utils_spec.lua Adds functional test coverage for the new helper functions.
Comments suppressed due to low confidence (1)

lua/diffview/multi_job.lua:10

  • local fmt = string.format is now unused in this module after the refactor. Please remove it to avoid dead code.
local job_utils = require("diffview.job_utils")
local utils = lazy.require("diffview.utils") ---@module "diffview.utils"

local await = async.await
local fmt = string.format

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@dlyongemallo dlyongemallo merged commit 0bedc54 into main Mar 28, 2026
6 checks passed
@dlyongemallo dlyongemallo deleted the refactor_job_utils branch March 28, 2026 08:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants