Skip to content

Commit cadf61f

Browse files
fix: better handling for /dev/null (#174)
* fix: better handling for /dev/null * chore: update CHANGELOG.md * ci: 🤖 render readme * test: add tests for /dev --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
1 parent c3f942d commit cadf61f

4 files changed

Lines changed: 7 additions & 3 deletions

File tree

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
## Tools development version
22

3+
- `ccbr-hooks detect-absolute-paths`: Reduce false positives caused by `/dev/null`. (#174, @kelly-sovacool)
4+
35
## Tools 0.5.2
46

57
- `ccbr-hooks detect-absolute-paths`: Reduce false positives caused by `/dev/shm` and language comments. (#157, @kelly-sovacool)

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ guidelines](https://CCBR.github.io/Tools/CONTRIBUTING).
178178
Please cite this software if you use it in a publication:
179179

180180
> Sovacool K., Koparde V., Kuhn S., Tandon M., and Huse S. (2026). CCBR
181-
> Tools: Utilities for CCBR Bioinformatics Software (version v0.5.1).
181+
> Tools: Utilities for CCBR Bioinformatics Software (version v0.5.2).
182182
> DOI: 10.5281/zenodo.13377166 URL: https://ccbr.github.io/Tools/
183183
184184
### Bibtex entry

src/ccbr_tools/hooks/detect_absolute_paths.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,9 @@ def word_is_absolute_path(word):
5858

5959
return word.startswith("/") and not any(
6060
[
61-
word == "/dev/null",
62-
word.startswith("/dev/shm"),
6361
word == "/", # FP from pathlib. abs-path:ignore
62+
word.startswith("/dev/null"),
63+
word.startswith("/dev/shm"),
6464
word.startswith("//"), # FP from groovy comments. abs-path:ignore
6565
word.startswith("/*"), # FP from CSS & groovy comments. abs-path:ignore
6666
word.startswith("/$"), # FP from nextflow scripts. abs-path:ignore

tests/test_hooks.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ def test_word_is_absolute_path():
3737
assert not hooks.word_is_absolute_path("//") # groovy comments
3838
assert not hooks.word_is_absolute_path("/*") # groovy multiline comments
3939
assert not hooks.word_is_absolute_path("/*--") # CSS comments
40+
assert not hooks.word_is_absolute_path("/dev/null") # common shell redirection
41+
assert not hooks.word_is_absolute_path("/dev/shm") # common shell redirection
4042
assert not hooks.word_is_absolute_path("/$") # nextflow script
4143

4244

0 commit comments

Comments
 (0)