Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

SC2183: Fix pluralization for zero arguments in printf format string#3342

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
Simon-Brandt wants to merge1 commit intokoalaman:master
base:master
Choose a base branch
Loading
fromSimon-Brandt:master

Conversation

@Simon-Brandt
Copy link

Currently,SC2183 pluralizes "variable" and "argument" in the warning message when there are at least two variables/arguments, using the singular form for 1 of either (correct) or 0 of either (wrong):

#!/bin/sh# Wrong usage:printf'Hello %s.\n'printf'Hello %s, and goodbye %s.\n'# Correct usage:world="world"space="space"printf'Hello %s.\n'"${world}"printf'Hello %s, and goodbye %s.\n'"${space}""${world}"

ShellCheck output onshellcheck.net:

Line 2:printf 'Hello %s.\n'       ^-- SC2183 (warning): This format string has 1 variable, but is passed 0 argument. Line 3:printf 'Hello %s, and goodbye %s.\n'       ^-- SC2183 (warning): This format string has 2 variables, but is passed 0 argument.

This PR is a follow-up of the attempt in#2535 andea4e009 to pluralize at all, (hopefully) fixing the last oversight.

(And yes, I switched the condition in the check,let pluraliseIfMany word n = if n /= 1 then word ++ "s" else word read weird to me...)

@koalamankoalamanforce-pushed themaster branch 4 times, most recently from50074dc toeac8effCompareNovember 5, 2025 03:37
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

1 participant

@Simon-Brandt

[8]ページ先頭

©2009-2025 Movatter.jp