Skip to content

Commit

Permalink
Add bandit, isort and pre-commit, resolve issues
Browse files Browse the repository at this point in the history
  • Loading branch information
florczakraf committed Oct 19, 2024
1 parent c8182c6 commit ec3f375
Show file tree
Hide file tree
Showing 5 changed files with 508 additions and 9 deletions.
118 changes: 118 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
exclude: '.git/|.tox/|venv/|.venv/|db_v2/'
default_stages: [pre-commit]
fail_fast: true

repos:
- repo: local
hooks:
- id: black
name: black
entry: black
language: system
files: '.*\.py$'

- id: isort
name: isort
entry: isort
language: system
files: '.*\.py$'

- id: flake8
name: flake8
entry: flake8
language: system
files: '.*\.py$'

- id: bandit
name: bandit
entry: bandit
language: system
files: 'src/.*\.py$'

- id: check poetry lock file
name: check poetry lock file
entry: poetry check --no-interaction
language: system
pass_filenames: false
files: '^pyproject\.toml$'

- id: check-added-large-files
name: check-added-large-files
entry: check-added-large-files
args: [ '--maxkb=512' ]
language: system

- id: check-ast
name: check-ast
entry: check-ast
language: system
files: '.*\.py$'

- id: check-case-conflict
name: check-case-conflict
entry: check-case-conflict
language: system

- id: check-docstring-first
name: check-docstring-first
entry: check-docstring-first
language: system
files: '.*\.py$'

- id: check-json
name: check-json
entry: check-json
language: system
files: '.*\.json$'

- id: check-merge-conflict
name: check-merge-conflict
entry: check-merge-conflict
language: system

- id: check-toml
name: check-toml
entry: check-toml
language: system
files: '.*\.toml$'

- id: check-xml
name: check-xml
entry: check-xml
language: system
files: '.*\.xml$'

- id: check-yaml
name: check-yaml
entry: check-yaml
language: system
types: [yaml]

- id: detect-private-key
name: detect-private-key
entry: detect-private-key
language: system

- id: end-of-file-fixer
name: end-of-file-fixer
entry: end-of-file-fixer
language: system
types: [ text ]

- id: trailing-whitespace-fixer
name: trailing-whitespace-fixer
entry: trailing-whitespace-fixer
language: system
types: [ text ]

- id: debug-statements
name: debug-statements
entry: debug-statement-hook
language: system
files: '.*\.py$'

- id: check-executables-have-shebangs
name: check-executables-have-shebangs
entry: check-executables-have-shebangs
language: system
types: [text, executable]
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ tournament pack.
Each pack has a file in `<db>/packs` directory that contains a list of chart
hashes within that packs, for example:
```
$ cat "db_v2/packs/Yhono Originals.json"
$ cat "db_v2/packs/Yhono Originals.json"
["b395e84a3a864b96", "a188216a0bc0b837", "4526ddf1c2e112e6", "dd6c5f9c0c6496ef", "96abb92df1877371"]
```

Expand All @@ -115,6 +115,14 @@ tweak number of workers depending on the type of disk and number of CPU cores
you have. On my machine it processed over 125k simfiles in 5 minutes where
charts were on an HDD and db was being saved to an SSD, 4c/4t i5-4460 CPU.

## Dev
```
$ poetry install
$ poetry shell
$ pre-commit
$ pre-commit run -a
```

## License
The project is licensed under GNU Affero General Public License v3.0 or later.

Expand Down
Loading

0 comments on commit ec3f375

Please sign in to comment.