Skip to content

Commit

Permalink
Add Pydocstyle linting requirements
Browse files Browse the repository at this point in the history
Adds Pydocstyle linting requirements using the google convention by
adding this linting to the PR gate. Updates developing.md documentation
and adds Pydocstyle linting to the vscode settings.
  • Loading branch information
Javagedes committed Nov 1, 2022
1 parent 4199795 commit dd13068
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 6 deletions.
2 changes: 2 additions & 0 deletions .pydocstyle
@@ -0,0 +1,2 @@
[pydocstyle]
convention = google
3 changes: 2 additions & 1 deletion .vscode/settings.json
Expand Up @@ -9,5 +9,6 @@
"python.testing.pytestEnabled": false,
"python.testing.unittestEnabled": true,
"python.linting.flake8Enabled": true,
"python.linting.enabled": true
"python.linting.enabled": true,
"python.linting.pydocstyleEnabled": true
}
2 changes: 2 additions & 0 deletions azure-pipelines/templates/build-test-job.yml
Expand Up @@ -33,6 +33,8 @@ jobs:

- template: flake8-test-steps.yml

- template: pydocstyle-test-steps.yml

- template: spell-test-steps.yml

- template: markdown-lint-steps.yml
Expand Down
27 changes: 27 additions & 0 deletions azure-pipelines/templates/pydocstyle-test-steps.yml
@@ -0,0 +1,27 @@
# File pydocstyle-test-steps.yml
#
# template file to run pydocstyle and if error publish log
#
# Copyright (c) Microsoft Corporation
# SPDX-License-Identifier: BSD-2-Clause-Patent
##

parameters:
none: ''

steps:
- script: pydocstyle .
displayName: 'Run pydocstyle'
condition: succeededOrFailed()

# Only capture and archive the lint log on failures.
- script: pydocstyle . > pydocstyle.err.log
displayName: 'Capture pydocstyle failures'
condition: Failed()

- task: PublishBuildArtifacts@1
inputs:
pathtoPublish: 'pydocstyle.err.log'
artifactName: 'Pydocstyle Error log file'
continueOnError: true
condition: Failed()
16 changes: 11 additions & 5 deletions docs/developing.md
Expand Up @@ -94,13 +94,19 @@ out all the different parts.
(whitespace, indentation, etc). In VSCode open the py file and use
++alt+shift+f++ to auto format.

2. Run the `BasicDevTests.py` script to check file encoding, file naming, etc
2. Run a Basic Python docstring Check (using pydocstring) and resolve any issues

``` cmd
pydocstyle .
```

3. Run the `BasicDevTests.py` script to check file encoding, file naming, etc

```cmd
BasicDevTests.py
```

3. Run pytest with coverage data collected
4. Run pytest with coverage data collected

``` cmd
pytest -v --junitxml=test.junit.xml --html=pytest_report.html --self-contained-html --cov=edk2toolext --cov-report html:cov_html --cov-report xml:cov.xml --cov-config .coveragerc
Expand All @@ -112,17 +118,17 @@ out all the different parts.
Coverage is uploaded to `codecov.io`. For more information, review
`coverage.md` in the docs folder.

4. Look at the reports
5. Look at the reports
* pytest_report.html
* cov_html/index.html

5. Run the spell checker
6. Run the spell checker

```cmd
cspell -c .cspell.json "**/*.py" "**/*.md"
```

6. Run the markdown linter
7. Run the markdown linter

```cmd
markdownlint "**/*.md"
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Expand Up @@ -2,6 +2,7 @@ pytest == 7.1.2
pytest-html == 3.1.1
pytest-cov == 3.0.0
flake8 == 5.0.4
pydocstyle == 6.1.1
pyopenssl == 22.0.0
pefile == 2022.5.30
semantic_version == 2.10.0

0 comments on commit dd13068

Please sign in to comment.