Skip to content

Commit

Permalink
Merge pull request #371 from fabric-testbed/320.config-docstrings
Browse files Browse the repository at this point in the history
Add docstrings to config module
  • Loading branch information
sajith authored Sep 20, 2024
2 parents 700964e + fc2fd6c commit 476c346
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 0 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/check_docstring_coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# A check to ensure that our docstring coverage remains pretty good.
#
# We use interrogate (https://interrogate.readthedocs.io/) to check
# docstring coverage. Settings are under `[tool.interrogate]` section
# of the pyproject.toml file in the top-level directory.

name: Check docstring coverage

on:
push:
branches:
- "main"
pull_request:
workflow_dispatch:

permissions:
contents: read

jobs:

checks:
runs-on: ubuntu-latest

steps:
- name: Check out sources
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.x"
cache: 'pip' # cache pip dependencies
cache-dependency-path: pyproject.toml

- name: Install interrogate
run: |
python -m pip install --upgrade pip
python -m pip install interrogate==1.7.0
- name: Check docstring coverage with interrogate
run: |
python -m interrogate -vv fabrictestbed_extensions
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Missing docstrings in slice module (Issue [#316](https://github.com/fabric-testbed/fabrictestbed-extensions/issues/316))
- Missing docstrings in component module (Issue [#317](https://github.com/fabric-testbed/fabrictestbed-extensions/issues/317))
- Missing docstrings in fablib module (Issue [#319](https://github.com/fabric-testbed/fabrictestbed-extensions/issues/319))
- Missing docstrings in fablib.config module (Issue [#320](https://github.com/fabric-testbed/fabrictestbed-extensions/issues/320))

## [1.7.3] - 08/05/2024
### Fixed
Expand Down
11 changes: 11 additions & 0 deletions fabrictestbed_extensions/fablib/config/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,18 @@


class ConfigException(Exception):
"""
An exception class to represent configuration errors.
"""

pass


class Config:
"""
A class that represents fablib configuration.
"""

LOG_LEVELS = {
"DEBUG": logging.DEBUG,
"INFO": logging.INFO,
Expand Down Expand Up @@ -744,6 +752,9 @@ def get_config_pretty_names_dict(self) -> Dict[str, str]:
return self.REQUIRED_ATTRS_PRETTY_NAMES

def save_config(self):
"""
Write the configuration file.
"""
if self.config_file_path is None:
print("Config file path not set!")
return
Expand Down
14 changes: 14 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,17 @@ addopts = "-ra -q"
# tests will require some manual setup (namely token acquisition), and
# thus we can't run them on CI.
testpaths = ["tests/unit/"]

[tool.interrogate]
ignore-init-method = true
ignore-init-module = true
ignore-magic = true
ignore-module = true
ignore-nested-functions = true
ignore-nested-classes = true
ignore-private = true
ignore-semiprivate = true
omit-covered-files = true
verbose = 0
fail-under = 92.6
exclude = ["tests", "fabrictestbed_extensions/editors"]

0 comments on commit 476c346

Please sign in to comment.