Skip to content

Commit

Permalink
Update pre-commit & apply bandit fixes (#17)
Browse files Browse the repository at this point in the history
  • Loading branch information
aliavni authored May 2, 2024
1 parent 53f9d0a commit a27475b
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 12 deletions.
27 changes: 18 additions & 9 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,22 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: check-yaml
- id: check-toml
- id: end-of-file-fixer
- id: trailing-whitespace
- id: requirements-txt-fixer
- repo: https://github.com/psf/black
rev: 24.3.0
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace
- id: detect-private-key
- id: detect-aws-credentials
args: [--allow-missing-credentials]
- id: check-added-large-files
- repo: https://github.com/PyCQA/bandit
rev: 1.7.8
hooks:
- id: black
- id: bandit
additional_dependencies: ["bandit[toml]"]
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.3.5
hooks:
- id: ruff
args: ["--preview", "--fix"]
- id: ruff-format
6 changes: 3 additions & 3 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def get_categories_and_file_names() -> Tuple[Dict, List]:

with file.open() as f:
try:
data_info = yaml.load(f.read(), Loader=yaml.FullLoader)
data_info = yaml.safe_load(f.read())
except yaml.scanner.ScannerError:
yml_errors.append(file)
continue
Expand All @@ -50,7 +50,7 @@ def get_data_info(category: str, file_name: str) -> Dict[str, Any]:
p = Path("apd-core/core") / category / file_name

with p.open() as f:
data = yaml.load(f.read(), Loader=yaml.FullLoader)
data = yaml.safe_load(f.read())

return data

Expand Down Expand Up @@ -81,7 +81,7 @@ def display_info_table(selected_data_info: Dict[str, Any]):
@st.cache_resource(show_spinner=False)
def check_url(url: str) -> Tuple[bool, Any]:
try:
response = requests.head(url, allow_redirects=False)
response = requests.head(url, allow_redirects=False, timeout=5)
return True, response
except requests.exceptions.SSLError:
return False, "SSL error"
Expand Down

0 comments on commit a27475b

Please sign in to comment.