Skip to content

Conversation

@coiby
Copy link
Member

@coiby coiby commented Dec 23, 2025

This PR resolves warnings emitted by current shellcheck (v0.11).

shellcheck v0.11 now gives the following warnings,

    In kdump-logger.sh line 163:
                    ddebug()
                    ^-- SC2329 (info): This function is never invoked. Check usage (or ignored if invoked indirectly).

    In kdump-logger.sh line 171:
                    dinfo()
                    ^-- SC2329 (info): This function is never invoked. Check usage (or ignored if invoked indirectly).
    ...

This happens because since shellcheck commit
4f81dbe ("Add warning about uninvoked functions,
reduce repeated triggering of SC2317 (fixes #2966)"), shellcheck
have a separate SC2329 for unreachable functions.

[1] koalaman/shellcheck@4f81dbe

Signed-off-by: Coiby Xu <coxu@redhat.com>
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @coiby, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request focuses on maintaining code quality by updating shellcheck suppression directives. It resolves SC2329 warnings that have emerged with the newer shellcheck v0.11, ensuring that the codebase remains clean and compliant with the linter's updated rules without introducing new issues. The changes are primarily in comments, adjusting the specific warning codes being ignored.

Highlights

  • Shellcheck Warning Resolution: Updated shellcheck disable directives in kdump-logger.sh and kdumpctl to address SC2329 warnings, which are now emitted by shellcheck v0.11.
  • Linter Directive Update: Changed SC2317 to SC2329 in shellcheck comments, specifically for the dlog_init() function in kdump-logger.sh and _record_block_drivers() in kdumpctl.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request updates shellcheck disable comments to use the SC2329 warning code, which is correct for the latest version of shellcheck. The changes are appropriate. For kdump-logger.sh, I've provided a suggestion to refactor the code to avoid disabling the shellcheck warning, which is a better long-term solution. The change in kdumpctl is fine as it addresses a known false positive.

# @retval 1 if something has gone wrong
# @retval 0 on success.
# shellcheck disable=SC2317 # skip for empty functions like dwarn
# shellcheck disable=SC2329 # skip for empty functions like dwarn
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

Instead of disabling the SC2329 warning, it's better to fix the underlying issue. The empty function definitions for loggers like ddebug, dinfo, dwarn, etc., inside dlog_init trigger this warning because they are called with arguments that they don't use.

You can silence this warning by modifying these empty functions to explicitly consume and ignore any arguments passed to them. This is considered better practice than disabling a static analysis check.

For example, you can change:

ddebug()
{
    :
}

to:

ddebug()
{
    : "$@"
}

This change should be applied to all the empty logger function definitions in dlog_init (ddebug, dinfo, dwarn, dwarning, derror). This will make the code cleaner and the shellcheck disable comment will no longer be needed.

shellcheck v0.11 emits the following warnings,

    In kdumpctl line 551:
                    _record_block_drivers()
                    ^-- SC2329 (info): This function is never invoked. Check usage (or ignored if invoked indirectly).

    In dracut/99kdumpbase/module-setup.sh line 902:
        kdump_check_setup_iscsi() {
        ^-- SC2329 (info): This function is never invoked. Check usage (or ignored if invoked indirectly).

These warnings are false positives caused by a regression of shellcheck
koalaman/shellcheck#3273

Before shellcheck fixes it, let's suppress this warning for now.

Signed-off-by: Coiby Xu <coxu@redhat.com>
Suppress the following shellcheck warnings,

    In spec/kdumpctl_general_spec.sh line 8:
                    grubby() {
                    ^-- SC2329 (info): This function is never invoked. Check usage (or ignored if invoked indirectly).
    ...
    In spec/kdumpctl_general_spec.sh line 77:
    ...
    In spec/kdumpctl_manage_crashkernel_spec.sh line 12:
    ...
    In spec/kdumpctl_reset_crashkernel_spec.sh line 12:
    ...
    In spec/kdumpctl_reset_crashkernel_spec.sh line 17:
    ...
    In spec/kdumpctl_setup_crypttab_spec.sh line 22:
                                    get_all_kdump_crypt_dev() {
                                    ^-- SC2329 (info): This function is never invoked. Check usage (or ignored if invoked indirectly).
    ...

    In spec/kdumpctl_setup_crypttab_spec.sh line 82:
                                    The stderr should include "Device UUID=$(get_all_kdump_crypt_dev) doesn't exist"
                                                                             ^---------------------^ SC2218 (error): This function is only defined later. Move the definition up

Signed-off-by: Coiby Xu <coxu@redhat.com>
@coiby coiby force-pushed the shellcheck_SC2329 branch from 51eed30 to 96e67b0 Compare December 23, 2025 08:32
@coiby coiby changed the title Resolve Shellcheck SC2329 warnings Resolve Shellcheck v0.11 warnings Dec 23, 2025
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.

1 participant