Skip to content

Commit

Permalink
💄 adding interrogate docstring check
Browse files Browse the repository at this point in the history
  • Loading branch information
MaaniBeigy committed Aug 13, 2024
1 parent 250e2a4 commit 4df24a5
Show file tree
Hide file tree
Showing 10 changed files with 113 additions and 120 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,6 @@ jobs:
- name: Run maintainability
run: |
make maintainability
- name: Run interrogate
run: |
make interrogate
4 changes: 4 additions & 0 deletions .logs/docstring.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"actual": "80.0%,",
"RESULT": "PASSED"
}
1 change: 1 addition & 0 deletions .shell/badges.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ sh .shell/complexity.sh
sh .shell/maintainability.sh
sh .shell/cov.sh
sh .shell/dependencies.sh
sh .shell/docstring.sh
25 changes: 25 additions & 0 deletions .shell/docstring.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Run the interrogate command and capture the output
$output = poetry run interrogate pycvcqv

# Extract the RESULT
$result = $output | Select-String -Pattern 'RESULT:' | ForEach-Object {
$_.Line -split ' ' | Select-Object -Index 1
}

# Extract the actual percentage
$actual = $output | Select-String -Pattern 'actual:' | ForEach-Object {
$line = $_.Line -split ' ' | Select-Object -Index 3
$line.TrimEnd(')')
}

# Create an object to store the RESULT and actual percentage in JSON format
$jsonOutput = @{
RESULT = $result
actual = $actual
} | ConvertTo-Json

# Save the JSON output to a file
$jsonOutput | Set-Content -Path ".logs/docstring.json"

# Output for verification
Write-Output "RESULT: $result, actual: $actual"
4 changes: 4 additions & 0 deletions .shell/docstring.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash
find . -name 'docstring.txt' -delete
interrogate -v lib/web/ >>.logs/docstring.txt
poetry run interrogate pycvcqv
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ complexity:
maintainability:
poetry run radon mi pycvcqv

.PHONY: interrogate
interrogate:
poetry run interrogate -v pycvcqv

.PHONY: coverage
coverage:
poetry run pytest --cov-report term --cov pycvcqv tests/
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,7 @@ poetry run mypy --install-types --non-interactive pycvcqv/ tests/
7. Unit tests and coverage

```powershell
poetry run
--cov-report term --cov pycvcqv tests/
poetry run pytest --cov-report term --cov pycvcqv tests/
poetry run coverage-badge -o assets/images/coverage.svg -f
```

Expand All @@ -153,14 +152,15 @@ poetry run pyupgrade --exit-zero-even-if-changed --py37-plus
poetry run isort --diff --check-only --settings-path pyproject.toml ./
poetry run black --diff --check --config pyproject.toml ./
poetry run darglint --verbosity 2 pycvcqv tests
poetry run interrogate -v pycvcqv
```

9. Safety check

```powershell
poetry check
poetry run safety check --policy-file safety_policy.yml --output json > .logs/safety.json
poetry run bandit -ll --recursive pycvcqv tests
poetry run safety check --policy-file safety_policy.yml
poetry run bandit -ll --configfile pyproject.toml --recursive pycvcqv tests
```

10. Creating badges data
Expand Down
178 changes: 64 additions & 114 deletions poetry.lock

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ pandas = "^1.3.3"
python = ">=3.8.1,<4.0"

[tool.poetry.dev-dependencies]
anybadge = "^1.9.0"
bandit = "^1.7.4"
black = {version = "^24.3.0", allow-prereleases = true}
coverage = "^6.4.1"
Expand All @@ -52,14 +51,15 @@ isort = {extras = ["colors"], version = "^5.10.1"}
mypy = "^1.4"
mypy-extensions = "^1.0.0"
pre-commit = "^2.19.0"
pybadges = "^3.0.0"
pydocstyle = "^6.1.1"
pylint = "^2.13.9"
pytest = "^7.1.1"
pytest-cov = "^3.0.0"
pyupgrade = "^2.37.2"
radon = "^5.1.0"
safety = "^2.0.0"
interrogate = "^1.5.0"
py = "^1.11.0"

[tool.black]
# https://github.com/psf/black
Expand Down
2 changes: 2 additions & 0 deletions safety_policy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,7 @@ security: # configuration for the `safety check` command
ignore-vulnerabilities: # Here you can list multiple specific vulnerabilities you want to ignore (optionally for a time period)
70612:
reason: disputed, inapplicable
51457:
reason: disputed, inapplicable
continue-on-vulnerability-error: False # Suppress non-zero exit codes when vulnerabilities are found. Enable this in pipelines and CI/CD processes if you want to pass builds that have vulnerabilities

0 comments on commit 4df24a5

Please sign in to comment.