unittest should check expected error id
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
- Domain
- devtools, testing-qa
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
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from koalaman/shellcheck
-
shellcheck silently ignores --enable=unknown optionPossibly taken @eyadstein claimed this 6 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
koalaman/shellcheck#3593 ·
Maintainers usually reply within 3 days
-
Difficulty 1/5 Under an hour Newbie friendliness 76/100
koalaman/shellcheck#3465 ·
Maintainers usually reply within 3 days
-
Difficulty 4/5 3-5 days Newbie friendliness 45/100
koalaman/shellcheck#3602 ·
Maintainers usually reply within 3 days
-
Difficulty 3/5 1-2 days Newbie friendliness 65/100
koalaman/shellcheck#3600 ·
Maintainers usually reply within 3 days
-
Difficulty 3/5 1-2 days Newbie friendliness 72/100
koalaman/shellcheck#3599 · 1 comment ·
Maintainers usually reply within 3 days
All issues in koalaman/shellcheck
Similar issues
-
newcomers
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
JacquesCarette/Drasil#5597 ·
Maintainers usually reply within 4 days
-
`unsafeReleaseAll` throws `ResourceRegistryUsedFromUntrackedThread` when called from an untracked threadPossibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 2/5 1-3 hours Newbie friendliness 80/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 64/100
-
bug
Difficulty 1/5 Under an hour Newbie friendliness 86/100
Maintainers usually reply within 1 day
-
Vim-mode indent crashes: monaco-vim's browser build inlines monaco-editor 0.33Possibly taken @x-labb claimed this 2 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
compiler-explorer/compiler-explorer#9402 ·
Maintainers usually reply within 1 day