Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 35 additions & 39 deletions .github/workflows/validate.yaml
Original file line number Diff line number Diff line change
@@ -1,67 +1,63 @@
name: Validate
---
name: validate

on:

Check warning on line 4 in .github/workflows/validate.yaml

View workflow job for this annotation

GitHub Actions / lint workflow yaml

4:1 [truthy] truthy value should be one of [false, true]
push:
branches: [main]
pull_request:
branches: [main]

env:
PIP_DISABLE_PIP_VERSION_CHECK: true
PIP_INDEX_URL: https://mirrors.ustc.edu.cn/pypi/simple
PIP_PROGRESS_BAR: off

Check warning on line 13 in .github/workflows/validate.yaml

View workflow job for this annotation

GitHub Actions / lint workflow yaml

13:21 [truthy] truthy value should be one of [false, true]
PIP_ROOT_USER_ACTION: ignore

jobs:
create-venv:
lint-yaml:
name: lint workflow yaml
runs-on: ubuntu-latest
name: Setup Python + uv
steps:
- uses: actions/checkout@v4
- name: Run yamllint
uses: karancode/yamllint-github-action@master
with:
yamllint_file_or_dir: .github/workflows

validate-and-lint:
name: Validate and Run Linters
runs-on: ubuntu-latest
needs: [lint-yaml]
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Python 3.12
- name: set up python
uses: actions/setup-python@v5
with:
python-version: 3.12
python-version: '3.12'

- name: Install uv and dependencies
run: |
pip install uv
uv venv
uv pip install --group bandit --group mypy --group ruff --group secret
env:
PIP_INDEX_URL: ${{ env.PIP_INDEX_URL }}
- name: set up uv
uses: astral-sh/setup-uv@v4

- name: Save env variable
run: echo "PYPI_MIRROR=${{ env.PIP_INDEX_URL }}" >> $GITHUB_ENV
- name: create virtual enviroment
run: uv venv

bandit:
runs-on: ubuntu-latest
needs: create-venv
steps:
- uses: actions/checkout@v4
- name: Run bandit
run: .venv/bin/bandit -c pyproject.toml -r .
- name: Install dependencies
run: uv sync --group dev --group lint --group security --group typing

- name: Run Bandit
run: uv run bandit -c pyproject.toml -r .

mypy:
runs-on: ubuntu-latest
needs: create-venv
steps:
- uses: actions/checkout@v4
- name: Run mypy
run: .venv/bin/mypy .
run: uv run mypy .

ruff:
runs-on: ubuntu-latest
needs: create-venv
steps:
- uses: actions/checkout@v4
- name: Run ruff
run: .venv/bin/ruff check .
run: uv run ruff check .

secrets:
runs-on: ubuntu-latest
needs: create-venv
steps:
- uses: actions/checkout@v4
- name: Run detect-secrets
run: .venv/bin/detect-secrets-hook --baseline .secrets.baseline
run: |
FILES_TO_SCAN=$(git ls-files -z | xargs -0)
uv run detect-secrets-hook \
--baseline .secrets.baseline \
"${FILES_TO_SCAN}"
107 changes: 107 additions & 0 deletions .secrets.baseline
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
{
"version": "1.5.0",
"plugins_used": [
{
"name": "AWSKeyDetector"
},
{
"name": "ArtifactoryDetector"
},
{
"name": "AzureStorageKeyDetector"
},
{
"name": "Base64HighEntropyString",
"limit": 4.5
},
{
"name": "BasicAuthDetector"
},
{
"name": "CloudantDetector"
},
{
"name": "HexHighEntropyString",
"limit": 3.0
},
{
"name": "IbmCloudIamDetector"
},
{
"name": "IbmCosHmacDetector"
},
{
"name": "JwtTokenDetector"
},
{
"name": "KeywordDetector",
"keyword_exclude": []
},
{
"name": "MailchimpDetector"
},
{
"name": "PrivateKeyDetector"
},
{
"name": "SlackDetector"
},
{
"name": "SoftlayerDetector"
},
{
"name": "StripeDetector"
},
{
"name": "TwilioKeyDetector"
}
],
"filters_used": [
{
"path": "detect_secrets.filters.allowlist.is_line_allowlisted"
},
{
"path": "detect_secrets.filters.common.is_baseline_file",
"filename": ".secrets.baseline"
},
{
"path": "detect_secrets.filters.common.is_ignored_due_to_verification_policies",
"min_level": 2
},
{
"path": "detect_secrets.filters.heuristic.is_indirect_reference"
},
{
"path": "detect_secrets.filters.heuristic.is_likely_id_string",
"pattern": "\\b[0-9]{4,}\\b"
},
{
"path": "detect_secrets.filters.heuristic.is_lock_file",
"pattern": "\\.lock$"
},
{
"path": "detect_secrets.filters.heuristic.is_not_alphanumeric_string"
},
{
"path": "detect_secrets.filters.heuristic.is_potential_uuid",
"pattern": "[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}"
},
{
"path": "detect_secrets.filters.heuristic.is_prefixed_with_dollar_sign"
},
{
"path": "detect_secrets.filters.heuristic.is_sequential_string",
"pattern": "\\b(?:[a-z]{2,}\\s*){3,}\\b"
},
{
"path": "detect_secrets.filters.heuristic.is_swagger_file",
"pattern": "swagger"
},
{
"path": "detect_secrets.filters.heuristic.is_templated_secret",
"pattern": "\\{\\{[^}]*\\}\\}"
}
],
"results": [],
"generated_at": "2024-01-01T00:00:00Z"
}
4 changes: 2 additions & 2 deletions main.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
def main():
print("Hello from trimodalparser!")
def main() -> None:
print("Hello from mmdocparser!")


if __name__ == "__main__":
Expand Down
67 changes: 58 additions & 9 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,21 +1,70 @@
[project]
name = "trimodalparser"
name = "mmdocparser"
version = "0.1.0"
description = "Add your description here"
readme = "README.md"
requires-python = ">=3.12"
dependencies = []


[dependency-groups]
bandit = [
"bandit>=1.8.5",
all-dev = [
{include-group = "dev"},
{include-group = "lint"},
{include-group = "security"},
{include-group = "typing"}
]
dev = [
"pytest>=8.4.1",
"pytest-cov>=6.2.1",
]
lint = [
"bandit>=1.8.6",
"ruff>=0.12.7",
]
security = [
"detect-secrets>=1.5.0",
]
mypy = [
"mypy>=1.16.1",
typing = [
"mypy>=1.17.1",
]
ruff = [
"ruff>=0.12.0",

[tool.bandit]
exclude_dirs = [".venv", ".git", ".mypy_cache"]
skips = ["B101", "B601"]

[tool.mypy]
python_version = "3.12"
warn_return_any = true
warn_unused_configs = true
disallow_untyped_defs = true
disallow_incomplete_defs = true
check_untyped_defs = true
disallow_untyped_decorators = true
no_implicit_optional = true
warn_redundant_casts = true
warn_unused_ignores = true
warn_no_return = true
warn_unreachable = true
strict_equality = true

[tool.ruff]
target-version = "py312"
line-length = 88
select = [
"E", # pycodestyle errors
"W", # pycodestyle warnings
"F", # pyflakes
"I", # isort
"B", # flake8-bugbear
"C4", # flake8-comprehensions
"UP", # pyupgrade
]
secret = [
"secret>=0.8",
ignore = [
"E501", # line too long, handled by black
"B008", # do not perform function calls in argument defaults
"C901", # too complex
]

[tool.ruff.per-file-ignores]
"__init__.py" = ["F401"]
Loading