Compare commits
No commits in common. "5693cf8f8a2192aded90119ef171e578a43bc236" and "73735b378f69857ec836024b06b533ac21817032" have entirely different histories.
5693cf8f8a
...
73735b378f
4 changed files with 31 additions and 41 deletions
|
@ -1,6 +1,27 @@
|
|||
# Pre-commit hooks to run tests and ensure code is cleaned.
|
||||
# See https://pre-commit.com for more information
|
||||
repos:
|
||||
- repo: local
|
||||
hooks:
|
||||
- id: pytest
|
||||
name: pytest
|
||||
entry: python3 -m pytest tests
|
||||
language: system
|
||||
types: [python]
|
||||
pass_filenames: false
|
||||
- repo: local
|
||||
hooks:
|
||||
- id: pylint
|
||||
name: pylint
|
||||
entry: pylint --extension-pkg-whitelist=cx_Oracle
|
||||
language: system
|
||||
types: [python]
|
||||
require_serial: true
|
||||
- repo: https://github.com/PyCQA/flake8
|
||||
rev: 6.0.0
|
||||
hooks:
|
||||
- id: flake8
|
||||
args: ['--max-line-length=100']
|
||||
- repo: https://github.com/asottile/pyupgrade
|
||||
rev: v3.3.1
|
||||
hooks:
|
||||
|
@ -16,30 +37,3 @@ repos:
|
|||
hooks:
|
||||
- id: isort
|
||||
args: ['--profile', 'black', '--line-length', '100']
|
||||
- repo: https://github.com/PyCQA/flake8
|
||||
rev: 6.0.0
|
||||
hooks:
|
||||
- id: flake8
|
||||
args: ['--max-line-length=100']
|
||||
- repo: local
|
||||
hooks:
|
||||
- id: pylint
|
||||
name: pylint
|
||||
entry: pylint --extension-pkg-whitelist=cx_Oracle
|
||||
language: system
|
||||
types: [python]
|
||||
require_serial: true
|
||||
- repo: https://github.com/Lucas-C/pre-commit-hooks-bandit
|
||||
rev: v1.0.5
|
||||
hooks:
|
||||
- id: python-bandit-vulnerability-check
|
||||
name: bandit
|
||||
args: [--skip, "B101", --recursive, mylib]
|
||||
- repo: local
|
||||
hooks:
|
||||
- id: pytest
|
||||
name: pytest
|
||||
entry: python3 -m pytest tests
|
||||
language: system
|
||||
types: [python]
|
||||
pass_filenames: false
|
||||
|
|
|
@ -261,7 +261,7 @@ class DB:
|
|||
def insert(self, table, values, just_try=False):
|
||||
"""Run INSERT SQL query"""
|
||||
# pylint: disable=consider-using-f-string
|
||||
sql = "INSERT INTO {} ({}) VALUES ({})".format( # nosec
|
||||
sql = "INSERT INTO {} ({}) VALUES ({})".format(
|
||||
self._quote_table_name(table),
|
||||
", ".join([self._quote_field_name(field) for field in values.keys()]),
|
||||
", ".join([self.format_param(key) for key in values]),
|
||||
|
@ -280,7 +280,7 @@ class DB:
|
|||
def update(self, table, values, where_clauses, where_op=None, just_try=False):
|
||||
"""Run UPDATE SQL query"""
|
||||
# pylint: disable=consider-using-f-string
|
||||
sql = "UPDATE {} SET {}".format( # nosec
|
||||
sql = "UPDATE {} SET {}".format(
|
||||
self._quote_table_name(table),
|
||||
", ".join(
|
||||
[f"{self._quote_field_name(key)} = {self.format_param(key)}" for key in values]
|
||||
|
@ -306,7 +306,7 @@ class DB:
|
|||
|
||||
def delete(self, table, where_clauses, where_op="AND", just_try=False):
|
||||
"""Run DELETE SQL query"""
|
||||
sql = f"DELETE FROM {self._quote_table_name(table)}" # nosec
|
||||
sql = f"DELETE FROM {self._quote_table_name(table)}"
|
||||
params = {}
|
||||
|
||||
try:
|
||||
|
@ -327,7 +327,7 @@ class DB:
|
|||
|
||||
def truncate(self, table, just_try=False):
|
||||
"""Run TRUNCATE SQL query"""
|
||||
sql = f"TRUNCATE TABLE {self._quote_table_name(table)}" # nosec
|
||||
sql = f"TRUNCATE TABLE {self._quote_table_name(table)}"
|
||||
|
||||
if just_try:
|
||||
log.debug("Just-try mode: execute TRUNCATE query: %s", sql)
|
||||
|
|
|
@ -173,9 +173,7 @@ class EmailClient(
|
|||
self.templates[template_name] = {}
|
||||
log.debug("Load email template %s %s from %s", template_name, template_type, filepath)
|
||||
with open(filepath, encoding="utf8") as file_desc:
|
||||
self.templates[template_name][template_type] = MakoTemplate(
|
||||
file_desc.read()
|
||||
) # nosec
|
||||
self.templates[template_name][template_type] = MakoTemplate(file_desc.read())
|
||||
|
||||
def forge_message(
|
||||
self,
|
||||
|
@ -577,14 +575,13 @@ if __name__ == "__main__":
|
|||
text=(
|
||||
"Just a test email sent at {sent_date}."
|
||||
if not options.test_mako
|
||||
else MakoTemplate("Just a test email sent at ${sent_date | h}.") # nosec
|
||||
else MakoTemplate("Just a test email sent at ${sent_date}.")
|
||||
),
|
||||
html=(
|
||||
"<strong>Just a test email.</strong> <small>(sent at {sent_date | h})</small>"
|
||||
"<strong>Just a test email.</strong> <small>(sent at {sent_date})</small>"
|
||||
if not options.test_mako
|
||||
else MakoTemplate( # nosec
|
||||
"<strong>Just a test email.</strong> "
|
||||
"<small>(sent at ${sent_date | h})</small>"
|
||||
else MakoTemplate(
|
||||
"<strong>Just a test email.</strong> <small>(sent at ${sent_date})</small>"
|
||||
)
|
||||
),
|
||||
)
|
||||
|
|
|
@ -51,8 +51,7 @@ def main(argv=None): # pylint: disable=too-many-locals,too-many-statements
|
|||
test_content = b"Juste un test."
|
||||
tmp_dir = tempfile.TemporaryDirectory() # pylint: disable=consider-using-with
|
||||
tmp_file = os.path.join(
|
||||
tmp_dir.name,
|
||||
f'tmp{"".join(random.choice(string.ascii_lowercase) for i in range(8))}', # nosec
|
||||
tmp_dir.name, f'tmp{"".join(random.choice(string.ascii_lowercase) for i in range(8))}'
|
||||
)
|
||||
log.debug('Temporary file path: "%s"', tmp_file)
|
||||
with open(tmp_file, "wb") as file_desc:
|
||||
|
|
Loading…
Reference in a new issue