Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

unittest should check expected error id

Open
#3,603 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 3 days

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
66/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Active
Tech stack
haskell

Research direction

The issue identifies the test in src/ShellCheck/Checks/Commands.hs and shows verify calls that accept any failure or expect a specific error ID. Start by reading those examples and the verify helper's definition to see how expected IDs are checked. Add coverage for the /boot/* case expecting SC2114, then run the relevant ShellCheck test suite and confirm the test fails for SC2115 but passes for SC2114.

Written by the indexing model from the issue text.

Description

At the moment tests do not strictly check which one is returned (if any).

--- a/src/ShellCheck/Checks/Commands.hs
+++ b/src/ShellCheck/Checks/Commands.hs
@@ -1155,2 +1155,3 @@ prop_checkCatastrophicRmA = verify checkCatastrophicRm "rm -rf /usr /lib/nvidia-
 prop_checkCatastrophicRmB = verify checkCatastrophicRm "rm -rf \"$STEAMROOT/\"*"
+prop_checkCatastrophicRmZ = verify checkCatastrophicRm "rm -rf /boot/*"
 checkCatastrophicRm = CommandCheck (Basename "rm") $ \t ->

As of cd9072643932ee2008e454e2cd990e25c1dc9d49 the above test passes but it is SC2115 but not SC2114 (#2833). Something like below is necessary:

prop_checkCatastrophicRmY = verify checkCatastrophicRm "rm -rf /boot/*"      -- any failure is expected
prop_checkCatastrophicRmZ = verify checkCatastrophicRm "rm -rf /boot/*" 2114 -- SC2114 is expected
Dominant language
Haskell
Stars
40.2k
Forks
2k
Avg merge
4d 9h
Merged PRs (30d)
24

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from koalaman/shellcheck

All issues in koalaman/shellcheck

Similar issues

More Haskell issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.