Skip to content

Commit

Permalink
Add hook to prevent sys.path.append usage (#23)
Browse files Browse the repository at this point in the history
  • Loading branch information
hofbi authored Sep 18, 2024
1 parent 78430e1 commit 8f8eda0
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 18 deletions.
6 changes: 6 additions & 0 deletions .pre-commit-hooks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@
files: "-"
types_or:
- markdown
- id: check-sys-path-append
name: Check sys path append usage
description: Check that no `sys.path.append` is used in Python code
entry: "sys.path.append"
language: pygrep
types: ["python"]
- id: check-number-of-lines-count
name: Check Number of Lines
description: Check that number of lines in scripts do not exceed max-lines. Use `--max-lines=<number>` to set the maximum number of lines. Default is 30 for shell scripts.
Expand Down
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ These tools are used to help developers in their day-to-day tasks.
- [`check-snake-case`](#check-snake-case)
- [`check-cpp-and-cu-unit-test-naming-pattern`](#check-cpp-and-cu-unit-test-naming-pattern)
- [`check-no-dashes`](#check-no-dashes)
- [`check-sys-path-append`](#check-sys-path-append)
- [`check-number-of-lines-count`](#check-number-of-lines-count)
- [`check-shellscript-set-options`](#check-shellscript-set-options)
- [`check-jira-reference-in-todo`](#check-jira-reference-in-todo)
Expand Down Expand Up @@ -75,6 +76,10 @@ Check that all C++ and Cuda unit test files end with `_test.cpp` or `_test.cu`.

Check that markdown filenames do not use dashes

### `check-sys-path-append`

Check that no `sys.path.append` is used in Python code

### `check-number-of-lines-count`

Check that number of lines in scripts do not exceed max-lines. Use `--max-lines=<number>` to set the maximum number of lines. Default is 30 for shell scripts.
Expand Down
36 changes: 18 additions & 18 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 8f8eda0

Please sign in to comment.