Upgrade pre-commit hooks and introduce bandit hook
This commit is contained in:
parent
dba77147a5
commit
487d38eafe
2 changed files with 36 additions and 31 deletions
|
@ -1,31 +1,36 @@
|
||||||
# Pre-commit hooks to run tests and ensure code is cleaned.
|
# Pre-commit hooks to run tests and ensure code is cleaned.
|
||||||
# See https://pre-commit.com for more information
|
# See https://pre-commit.com for more information
|
||||||
repos:
|
repos:
|
||||||
- repo: local
|
- repo: https://github.com/asottile/pyupgrade
|
||||||
hooks:
|
rev: v3.15.0
|
||||||
- id: pylint
|
hooks:
|
||||||
name: pylint
|
- id: pyupgrade
|
||||||
entry: pylint
|
args: ['--keep-percent-format', '--py37-plus']
|
||||||
language: system
|
- repo: https://github.com/psf/black
|
||||||
types: [python]
|
rev: 23.11.0
|
||||||
require_serial: true
|
hooks:
|
||||||
- repo: https://github.com/PyCQA/flake8
|
- id: black
|
||||||
rev: 6.0.0
|
args: ['--target-version', 'py37', '--line-length', '100']
|
||||||
hooks:
|
- repo: https://github.com/PyCQA/isort
|
||||||
- id: flake8
|
rev: 5.12.0
|
||||||
args: ['--max-line-length=100']
|
hooks:
|
||||||
- repo: https://github.com/asottile/pyupgrade
|
- id: isort
|
||||||
rev: v3.3.1
|
args: ['--profile', 'black', '--line-length', '100']
|
||||||
hooks:
|
- repo: https://github.com/PyCQA/flake8
|
||||||
- id: pyupgrade
|
rev: 6.1.0
|
||||||
args: ['--keep-percent-format', '--py37-plus']
|
hooks:
|
||||||
- repo: https://github.com/psf/black
|
- id: flake8
|
||||||
rev: 22.12.0
|
args: ['--max-line-length=100']
|
||||||
hooks:
|
- repo: local
|
||||||
- id: black
|
hooks:
|
||||||
args: ['--target-version', 'py37', '--line-length', '100']
|
- id: pylint
|
||||||
- repo: https://github.com/PyCQA/isort
|
name: pylint
|
||||||
rev: 5.12.0
|
entry: pylint
|
||||||
hooks:
|
language: system
|
||||||
- id: isort
|
types: [python]
|
||||||
args: ['--profile', 'black', '--line-length', '100']
|
require_serial: true
|
||||||
|
- repo: https://github.com/PyCQA/bandit
|
||||||
|
rev: 1.7.5
|
||||||
|
hooks:
|
||||||
|
- id: bandit
|
||||||
|
args: [--skip, "B101", --recursive, "mylib"]
|
||||||
|
|
|
@ -21,7 +21,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
import argparse
|
import argparse
|
||||||
import logging
|
import logging
|
||||||
import re
|
import re
|
||||||
import subprocess
|
import subprocess # nosec
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
import requests
|
import requests
|
||||||
|
@ -59,7 +59,7 @@ logging.debug("Command use to retreive current version of Forgejo: %s", " ".join
|
||||||
OUTPUT = None
|
OUTPUT = None
|
||||||
EXCEPTION = None
|
EXCEPTION = None
|
||||||
try:
|
try:
|
||||||
OUTPUT = subprocess.check_output(cmd)
|
OUTPUT = subprocess.check_output(cmd) # nosec
|
||||||
logging.debug("Output:\n%s", OUTPUT)
|
logging.debug("Output:\n%s", OUTPUT)
|
||||||
m = re.search("version ([^ ]+) built", OUTPUT.decode("utf8", errors="ignore"))
|
m = re.search("version ([^ ]+) built", OUTPUT.decode("utf8", errors="ignore"))
|
||||||
if m:
|
if m:
|
||||||
|
@ -106,7 +106,7 @@ try:
|
||||||
LATEST_INT = version_int
|
LATEST_INT = version_int
|
||||||
else:
|
else:
|
||||||
logging.debug("Version %s considered as oldest than %s", version, LATEST)
|
logging.debug("Version %s considered as oldest than %s", version, LATEST)
|
||||||
except Exception: # pylint: disable=broad-except
|
except Exception: # pylint: disable=broad-except # nosec
|
||||||
pass
|
pass
|
||||||
logging.debug("Latest version: %s", LATEST)
|
logging.debug("Latest version: %s", LATEST)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue