chore: ruff linter

- replace pylint & isort
This commit is contained in:
Ming Di Leom 2023-03-06 10:46:34 +00:00
parent 34b8f39eca
commit 5f11caab67
No known key found for this signature in database
GPG Key ID: 32D3E28E96A695E8
6 changed files with 14 additions and 27 deletions

1
.gitignore vendored
View File

@ -4,3 +4,4 @@ pip-log.txt
pip-delete-this-directory.txt pip-delete-this-directory.txt
lib/ lib/
malware_filter-*.tar.gz malware_filter-*.tar.gz
.ruff_cache/

View File

@ -17,28 +17,15 @@ repos:
hooks: hooks:
- id: end-of-file-fixer - id: end-of-file-fixer
- id: trailing-whitespace - id: trailing-whitespace
- repo: https://github.com/PyCQA/isort - repo: https://github.com/charliermarsh/ruff-pre-commit
rev: "5.11.4" rev: "v0.0.254"
hooks: hooks:
- id: isort - id: ruff
types: [python] args: [--fix, --exit-non-zero-on-fix]
args: [
".", # sort all Python files recursively
]
- repo: https://github.com/psf/black - repo: https://github.com/psf/black
rev: 22.12.0 rev: 22.12.0
hooks: hooks:
- id: black - id: black
- repo: https://github.com/PyCQA/pylint
rev: "v2.15.10"
hooks:
- id: pylint
language: system
types: [python]
args: [
"-rn", # Only display messages
"-sn", # Don't display the score
]
- repo: https://github.com/pre-commit/mirrors-prettier - repo: https://github.com/pre-commit/mirrors-prettier
rev: "v2.7.1" rev: "v2.7.1"
hooks: hooks:

View File

@ -9,14 +9,10 @@
"editor.formatOnSave": true, "editor.formatOnSave": true,
"editor.tabSize": 4, "editor.tabSize": 4,
"editor.codeActionsOnSave": { "editor.codeActionsOnSave": {
"source.fixAll": true,
"source.organizeImports": true "source.organizeImports": true
} }
}, },
"isort.args": ["--profile", "black"],
"[javascript]": {
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[markdown]": { "[markdown]": {
"editor.formatOnSave": true, "editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode" "editor.defaultFormatter": "esbenp.prettier-vscode"

View File

@ -105,7 +105,8 @@ class Utility:
Arguments: Arguments:
row {dict} -- A row of an array-parsed CSV row {dict} -- A row of an array-parsed CSV
prefix_opt {string/list} -- A column name or a comma-separated list of column names to have wildcard prefixed to their non-empty value. prefix_opt {string/list} -- A column name or a comma-separated list of column names to have
wildcard prefixed to their non-empty value.
suffix_opt {string/list} -- Same as prefix_opt but have the wildcard suffixed instead. suffix_opt {string/list} -- Same as prefix_opt but have the wildcard suffixed instead.
affix_opt {string/list} -- Same as prefix_opt but have the wildcard prefixed and suffixed. affix_opt {string/list} -- Same as prefix_opt but have the wildcard prefixed and suffixed.

View File

@ -1,6 +1,3 @@
[tool.isort]
profile = "black"
[tool.pylint.'MASTER'] [tool.pylint.'MASTER']
py-version = "3.10" py-version = "3.10"
init-hook='import sys; sys.path.append("./bin")' init-hook='import sys; sys.path.append("./bin")'
@ -30,3 +27,8 @@ disable = [
indent-after-paren = 4 indent-after-paren = 4
indent-string = " " indent-string = " "
expected-line-ending-format="LF" expected-line-ending-format="LF"
[tool.ruff]
line-length = 115
# Module level import not at top of file (`E402`).
ignore = ["E402"]

View File

@ -1,5 +1,5 @@
-r requirements.txt -r requirements.txt
pylint == 2.* pylint == 2.*
isort == 5.*
pre-commit == 2.* pre-commit == 2.*
black ~= 22.1 black ~= 22.1
ruff == 0.0.*