saltext.github 1.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- saltext_github-1.0.0/.copier-answers.yml +28 -0
- saltext_github-1.0.0/.coveragerc +42 -0
- saltext_github-1.0.0/.github/ISSUE_TEMPLATE/bug_report.md +48 -0
- saltext_github-1.0.0/.github/ISSUE_TEMPLATE/config.yml +14 -0
- saltext_github-1.0.0/.github/ISSUE_TEMPLATE/docs.md +23 -0
- saltext_github-1.0.0/.github/ISSUE_TEMPLATE/feature_request.md +20 -0
- saltext_github-1.0.0/.github/ISSUE_TEMPLATE/tech-debt.md +13 -0
- saltext_github-1.0.0/.github/ISSUE_TEMPLATE.md +11 -0
- saltext_github-1.0.0/.github/PULL_REQUEST_TEMPLATE.md +24 -0
- saltext_github-1.0.0/.github/workflows/pr.yml +21 -0
- saltext_github-1.0.0/.github/workflows/tag.yml +33 -0
- saltext_github-1.0.0/.gitignore +135 -0
- saltext_github-1.0.0/.pre-commit-config.yaml +139 -0
- saltext_github-1.0.0/.pre-commit-hooks/check-cli-examples.py +64 -0
- saltext_github-1.0.0/.pre-commit-hooks/make-autodocs.py +118 -0
- saltext_github-1.0.0/.pylintrc +681 -0
- saltext_github-1.0.0/CHANGELOG.md +13 -0
- saltext_github-1.0.0/CODE-OF-CONDUCT.md +127 -0
- saltext_github-1.0.0/CONTRIBUTING.md +14 -0
- saltext_github-1.0.0/LICENSE +201 -0
- saltext_github-1.0.0/NOTICE +10 -0
- saltext_github-1.0.0/PKG-INFO +142 -0
- saltext_github-1.0.0/README.md +87 -0
- saltext_github-1.0.0/changelog/.template.jinja +15 -0
- saltext_github-1.0.0/docs/Makefile +20 -0
- saltext_github-1.0.0/docs/_ext/saltdomain.py +18 -0
- saltext_github-1.0.0/docs/_static/.gitkeep +0 -0
- saltext_github-1.0.0/docs/changelog.md +12 -0
- saltext_github-1.0.0/docs/conf.py +196 -0
- saltext_github-1.0.0/docs/index.rst +35 -0
- saltext_github-1.0.0/docs/make.bat +35 -0
- saltext_github-1.0.0/docs/ref/.gitkeep +0 -0
- saltext_github-1.0.0/docs/ref/modules/index.rst +12 -0
- saltext_github-1.0.0/docs/ref/modules/saltext.github.modules.github.rst +5 -0
- saltext_github-1.0.0/docs/ref/states/index.rst +12 -0
- saltext_github-1.0.0/docs/ref/states/saltext.github.states.github.rst +5 -0
- saltext_github-1.0.0/docs/ref/utils/index.rst +12 -0
- saltext_github-1.0.0/docs/ref/utils/saltext.github.utils.github.rst +5 -0
- saltext_github-1.0.0/docs/sitevars.rst +0 -0
- saltext_github-1.0.0/docs/topics/installation.md +28 -0
- saltext_github-1.0.0/noxfile.py +525 -0
- saltext_github-1.0.0/pyproject.toml +153 -0
- saltext_github-1.0.0/setup.cfg +4 -0
- saltext_github-1.0.0/setup.py +5 -0
- saltext_github-1.0.0/src/saltext/github/__init__.py +28 -0
- saltext_github-1.0.0/src/saltext/github/modules/__init__.py +0 -0
- saltext_github-1.0.0/src/saltext/github/modules/github.py +2195 -0
- saltext_github-1.0.0/src/saltext/github/states/__init__.py +0 -0
- saltext_github-1.0.0/src/saltext/github/states/github.py +930 -0
- saltext_github-1.0.0/src/saltext/github/utils/__init__.py +0 -0
- saltext_github-1.0.0/src/saltext/github/utils/github.py +64 -0
- saltext_github-1.0.0/src/saltext/github/version.py +1 -0
- saltext_github-1.0.0/src/saltext.github.egg-info/PKG-INFO +142 -0
- saltext_github-1.0.0/src/saltext.github.egg-info/SOURCES.txt +73 -0
- saltext_github-1.0.0/src/saltext.github.egg-info/dependency_links.txt +1 -0
- saltext_github-1.0.0/src/saltext.github.egg-info/entry_points.txt +2 -0
- saltext_github-1.0.0/src/saltext.github.egg-info/not-zip-safe +1 -0
- saltext_github-1.0.0/src/saltext.github.egg-info/requires.txt +32 -0
- saltext_github-1.0.0/src/saltext.github.egg-info/top_level.txt +1 -0
- saltext_github-1.0.0/tests/__init__.py +0 -0
- saltext_github-1.0.0/tests/conftest.py +39 -0
- saltext_github-1.0.0/tests/functional/__init__.py +0 -0
- saltext_github-1.0.0/tests/functional/conftest.py +150 -0
- saltext_github-1.0.0/tests/functional/modules/__init__.py +0 -0
- saltext_github-1.0.0/tests/functional/states/__init__.py +0 -0
- saltext_github-1.0.0/tests/integration/__init__.py +0 -0
- saltext_github-1.0.0/tests/integration/conftest.py +28 -0
- saltext_github-1.0.0/tests/integration/modules/__init__.py +0 -0
- saltext_github-1.0.0/tests/integration/states/__init__.py +0 -0
- saltext_github-1.0.0/tests/unit/__init__.py +0 -0
- saltext_github-1.0.0/tests/unit/conftest.py +62 -0
- saltext_github-1.0.0/tests/unit/modules/__init__.py +0 -0
- saltext_github-1.0.0/tests/unit/modules/test_github.py +204 -0
- saltext_github-1.0.0/tests/unit/states/__init__.py +0 -0
- saltext_github-1.0.0/tests/unit/states/test_github.py +286 -0
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# Autogenerated. Do not edit this by hand, use `copier update`.
|
|
2
|
+
---
|
|
3
|
+
_commit: 0.3.7
|
|
4
|
+
_src_path: https://github.com/lkubb/salt-extension-copier
|
|
5
|
+
author: EITR Technologies, LLC
|
|
6
|
+
author_email: devops@eitr.tech
|
|
7
|
+
coc_contact: devops@eitr.tech
|
|
8
|
+
copyright_begin: 2024
|
|
9
|
+
deploy_docs: rolling
|
|
10
|
+
docs_url: https://salt-extensions.github.io/saltext-github/
|
|
11
|
+
integration_name: GitHub
|
|
12
|
+
license: apache
|
|
13
|
+
loaders:
|
|
14
|
+
- module
|
|
15
|
+
- state
|
|
16
|
+
max_salt_version: 3007
|
|
17
|
+
no_saltext_namespace: false
|
|
18
|
+
package_name: github
|
|
19
|
+
project_name: github
|
|
20
|
+
python_requires: '3.8'
|
|
21
|
+
salt_version: '3005'
|
|
22
|
+
source_url: https://github.com/salt-extensions/saltext-github
|
|
23
|
+
ssh_fixtures: false
|
|
24
|
+
summary: Salt Extension for interacting with GitHub
|
|
25
|
+
test_containers: false
|
|
26
|
+
tracker_url: https://github.com/salt-extensions/saltext-github/issues
|
|
27
|
+
url: https://github.com/salt-extensions/saltext-github
|
|
28
|
+
workflows: org
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
[run]
|
|
2
|
+
branch = True
|
|
3
|
+
cover_pylib = False
|
|
4
|
+
relative_files = True
|
|
5
|
+
parallel = True
|
|
6
|
+
concurrency = multiprocessing
|
|
7
|
+
|
|
8
|
+
omit =
|
|
9
|
+
.nox/*
|
|
10
|
+
setup.py
|
|
11
|
+
|
|
12
|
+
[report]
|
|
13
|
+
# Regexes for lines to exclude from consideration
|
|
14
|
+
exclude_lines =
|
|
15
|
+
# Have to re-enable the standard pragma
|
|
16
|
+
pragma: no cover
|
|
17
|
+
|
|
18
|
+
# Don't complain about missing debug-only code:
|
|
19
|
+
def __repr__
|
|
20
|
+
|
|
21
|
+
# Don't complain if tests don't hit defensive assertion code:
|
|
22
|
+
raise AssertionError
|
|
23
|
+
raise NotImplementedError
|
|
24
|
+
|
|
25
|
+
# Don't complain if non-runnable code isn't run:
|
|
26
|
+
if 0:
|
|
27
|
+
if False:
|
|
28
|
+
if __name__ == .__main__.:
|
|
29
|
+
|
|
30
|
+
omit =
|
|
31
|
+
.nox/*
|
|
32
|
+
setup.py
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
ignore_errors = True
|
|
36
|
+
|
|
37
|
+
[paths]
|
|
38
|
+
source =
|
|
39
|
+
saltext/github
|
|
40
|
+
src/saltext/github
|
|
41
|
+
testsuite =
|
|
42
|
+
tests/
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Bug report
|
|
3
|
+
about: Create a report to help us improve
|
|
4
|
+
title: "[BUG]"
|
|
5
|
+
labels: bug, needs-triage
|
|
6
|
+
assignees: ''
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
**Description**
|
|
11
|
+
A clear and concise description of what the bug is.
|
|
12
|
+
|
|
13
|
+
**Setup**
|
|
14
|
+
(Please provide relevant configs and/or SLS files (be sure to remove sensitive info. There is no general set-up of Salt.)
|
|
15
|
+
|
|
16
|
+
Please be as specific as possible and give set-up details.
|
|
17
|
+
|
|
18
|
+
- [ ] on-prem machine
|
|
19
|
+
- [ ] VM (Virtualbox, KVM, etc. please specify)
|
|
20
|
+
- [ ] VM running on a cloud service, please be explicit and add details
|
|
21
|
+
- [ ] container (Kubernetes, Docker, containerd, etc. please specify)
|
|
22
|
+
- [ ] or a combination, please be explicit
|
|
23
|
+
- [ ] jails if it is FreeBSD
|
|
24
|
+
- [ ] classic packaging
|
|
25
|
+
- [ ] onedir packaging
|
|
26
|
+
- [ ] used bootstrap to install
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
**Steps to Reproduce the behavior**
|
|
30
|
+
(Include debug logs if possible and relevant)
|
|
31
|
+
|
|
32
|
+
**Expected behavior**
|
|
33
|
+
A clear and concise description of what you expected to happen.
|
|
34
|
+
|
|
35
|
+
**Screenshots**
|
|
36
|
+
If applicable, add screenshots to help explain your problem.
|
|
37
|
+
|
|
38
|
+
**Versions Report**
|
|
39
|
+
<details><summary>salt --versions-report</summary>
|
|
40
|
+
(Provided by running salt --versions-report. Please also mention any differences in master/minion versions.)
|
|
41
|
+
|
|
42
|
+
```yaml
|
|
43
|
+
PASTE HERE
|
|
44
|
+
```
|
|
45
|
+
</details>
|
|
46
|
+
|
|
47
|
+
**Additional context**
|
|
48
|
+
Add any other context about the problem here.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
blank_issues_enabled: true
|
|
2
|
+
contact_links:
|
|
3
|
+
- name: Salt Community Slack
|
|
4
|
+
url: https://saltstackcommunity.slack.com/
|
|
5
|
+
about: Please ask and answer questions here.
|
|
6
|
+
- name: Salt-Users Forum
|
|
7
|
+
url: https://groups.google.com/forum/#!forum/salt-users
|
|
8
|
+
about: Please ask and answer questions here.
|
|
9
|
+
- name: Salt on LiberaChat
|
|
10
|
+
url: https://web.libera.chat/#salt
|
|
11
|
+
about: Please ask and answer questions here.
|
|
12
|
+
- name: Security vulnerabilities
|
|
13
|
+
email: saltproject-security.pdl@broadcom.com
|
|
14
|
+
about: Please report security vulnerabilities here.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Docs
|
|
3
|
+
about: Issue related to Salt Documentation
|
|
4
|
+
title: "[DOCS]"
|
|
5
|
+
labels: documentation, needs-triage
|
|
6
|
+
assignees: ''
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
**Description**
|
|
11
|
+
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
|
12
|
+
|
|
13
|
+
**Suggested Fix**
|
|
14
|
+
What did you expect to see in the documentation that is missing or needs updating?
|
|
15
|
+
|
|
16
|
+
**Type of documentation**
|
|
17
|
+
This could be module documentation or a guide.
|
|
18
|
+
|
|
19
|
+
**Location or format of documentation**
|
|
20
|
+
Insert page URL if applicable.
|
|
21
|
+
|
|
22
|
+
**Additional context**
|
|
23
|
+
Add any other context or screenshots here.
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Feature request
|
|
3
|
+
about: Suggest an idea for this project
|
|
4
|
+
title: "[FEATURE REQUEST]"
|
|
5
|
+
labels: feature, needs-triage
|
|
6
|
+
assignees: ''
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
**Is your feature request related to a problem? Please describe.**
|
|
11
|
+
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
|
12
|
+
|
|
13
|
+
**Describe the solution you'd like**
|
|
14
|
+
A clear and concise description of what you want to happen.
|
|
15
|
+
|
|
16
|
+
**Describe alternatives you've considered**
|
|
17
|
+
A clear and concise description of any alternative solutions or features you've considered.
|
|
18
|
+
|
|
19
|
+
**Additional context**
|
|
20
|
+
Add any other context or screenshots about the feature request here.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Tech Debt
|
|
3
|
+
about: Issue is related to tech debt. This includes compatibility changes for newer versions of software and OSes that salt interacts with.
|
|
4
|
+
title: "[TECH DEBT]"
|
|
5
|
+
labels: tech-debt
|
|
6
|
+
assignees: ''
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
### Description of the tech debt to be addressed, include links and screenshots
|
|
11
|
+
|
|
12
|
+
### Versions Report
|
|
13
|
+
(Provided by running `salt --versions-report`. Please also mention any differences in master/minion versions.)
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
### Description of Issue
|
|
2
|
+
<!-- Note: Please direct questions to the salt-users google group, Slack, IRC, etc. Only post issues and feature requests here -->
|
|
3
|
+
|
|
4
|
+
### Setup
|
|
5
|
+
(Please provide relevant configs and/or SLS files (Be sure to remove sensitive info).)
|
|
6
|
+
|
|
7
|
+
### Steps to Reproduce Issue
|
|
8
|
+
(Include debug logs if possible and relevant.)
|
|
9
|
+
|
|
10
|
+
### Versions Report
|
|
11
|
+
(Provided by running `salt --versions-report`. Please also mention any differences in master/minion versions.)
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
### What does this PR do?
|
|
2
|
+
|
|
3
|
+
### What issues does this PR fix or reference?
|
|
4
|
+
Fixes:
|
|
5
|
+
|
|
6
|
+
### Previous Behavior
|
|
7
|
+
Remove this section if not relevant
|
|
8
|
+
|
|
9
|
+
### New Behavior
|
|
10
|
+
Remove this section if not relevant
|
|
11
|
+
|
|
12
|
+
### Merge requirements satisfied?
|
|
13
|
+
**[NOTICE] Bug fixes or features added to Salt require tests.**
|
|
14
|
+
<!-- Please review the [test documentation](https://docs.saltproject.io/en/master/topics/tutorials/writing_tests.html) for details on how to implement tests into Salt's test suite. -->
|
|
15
|
+
- [ ] Docs
|
|
16
|
+
- [ ] Changelog - https://docs.saltproject.io/en/master/topics/development/changelog.html
|
|
17
|
+
- [ ] Tests written/updated
|
|
18
|
+
|
|
19
|
+
### Commits signed with GPG?
|
|
20
|
+
Yes/No
|
|
21
|
+
|
|
22
|
+
Please review [Salt's Contributing Guide](https://docs.saltproject.io/en/master/topics/development/contributing.html) for best practices.
|
|
23
|
+
|
|
24
|
+
See GitHub's [page on GPG signing](https://help.github.com/articles/signing-commits-using-gpg/) for more information about signing commits with GPG.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
name: Pull Request or Push
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- 'main' # Run on pushes to main
|
|
7
|
+
tags-ignore:
|
|
8
|
+
- '*' # Ignore pushes to tags
|
|
9
|
+
pull_request:
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
call_central_workflow:
|
|
13
|
+
name: CI
|
|
14
|
+
uses: salt-extensions/central-artifacts/.github/workflows/ci.yml@main
|
|
15
|
+
with:
|
|
16
|
+
deploy-docs: true
|
|
17
|
+
permissions:
|
|
18
|
+
contents: write
|
|
19
|
+
id-token: write
|
|
20
|
+
pages: write
|
|
21
|
+
pull-requests: read
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
name: Tagged Releases
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- "v*" # Only tags starting with "v" for "v1.0.0", etc.
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
get_tag_version:
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
outputs:
|
|
12
|
+
version: ${{ steps.get_version.outputs.version }}
|
|
13
|
+
steps:
|
|
14
|
+
- name: Checkout code
|
|
15
|
+
uses: actions/checkout@v4
|
|
16
|
+
|
|
17
|
+
- name: Extract tag name
|
|
18
|
+
id: get_version
|
|
19
|
+
run: echo "version=$(echo ${GITHUB_REF#refs/tags/v})" >> $GITHUB_OUTPUT
|
|
20
|
+
|
|
21
|
+
call_central_workflow:
|
|
22
|
+
needs: get_tag_version
|
|
23
|
+
uses: salt-extensions/central-artifacts/.github/workflows/ci.yml@main
|
|
24
|
+
with:
|
|
25
|
+
deploy-docs: true
|
|
26
|
+
release: true
|
|
27
|
+
version: ${{ needs.get_tag_version.outputs.version }}
|
|
28
|
+
permissions:
|
|
29
|
+
contents: write
|
|
30
|
+
id-token: write
|
|
31
|
+
pages: write
|
|
32
|
+
pull-requests: read
|
|
33
|
+
secrets: inherit
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
build/
|
|
12
|
+
develop-eggs/
|
|
13
|
+
dist/
|
|
14
|
+
downloads/
|
|
15
|
+
eggs/
|
|
16
|
+
.eggs/
|
|
17
|
+
lib/
|
|
18
|
+
lib64/
|
|
19
|
+
parts/
|
|
20
|
+
sdist/
|
|
21
|
+
var/
|
|
22
|
+
wheels/
|
|
23
|
+
pip-wheel-metadata/
|
|
24
|
+
share/python-wheels/
|
|
25
|
+
*.egg-info/
|
|
26
|
+
.installed.cfg
|
|
27
|
+
*.egg
|
|
28
|
+
MANIFEST
|
|
29
|
+
|
|
30
|
+
# PyInstaller
|
|
31
|
+
# Usually these files are written by a python script from a template
|
|
32
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
33
|
+
*.manifest
|
|
34
|
+
*.spec
|
|
35
|
+
|
|
36
|
+
# Installer logs
|
|
37
|
+
pip-log.txt
|
|
38
|
+
pip-delete-this-directory.txt
|
|
39
|
+
|
|
40
|
+
# Unit test / coverage reports
|
|
41
|
+
htmlcov/
|
|
42
|
+
.tox/
|
|
43
|
+
.nox/
|
|
44
|
+
.coverage
|
|
45
|
+
.coverage.*
|
|
46
|
+
.cache
|
|
47
|
+
nosetests.xml
|
|
48
|
+
coverage.xml
|
|
49
|
+
*.cover
|
|
50
|
+
*.py,cover
|
|
51
|
+
.hypothesis/
|
|
52
|
+
.pytest_cache/
|
|
53
|
+
|
|
54
|
+
# Translations
|
|
55
|
+
*.mo
|
|
56
|
+
*.pot
|
|
57
|
+
|
|
58
|
+
# Django stuff:
|
|
59
|
+
*.log
|
|
60
|
+
local_settings.py
|
|
61
|
+
db.sqlite3
|
|
62
|
+
db.sqlite3-journal
|
|
63
|
+
|
|
64
|
+
# Flask stuff:
|
|
65
|
+
instance/
|
|
66
|
+
.webassets-cache
|
|
67
|
+
|
|
68
|
+
# Scrapy stuff:
|
|
69
|
+
.scrapy
|
|
70
|
+
|
|
71
|
+
# Sphinx documentation
|
|
72
|
+
docs/_build/
|
|
73
|
+
|
|
74
|
+
# PyBuilder
|
|
75
|
+
target/
|
|
76
|
+
|
|
77
|
+
# Jupyter Notebook
|
|
78
|
+
.ipynb_checkpoints
|
|
79
|
+
|
|
80
|
+
# IPython
|
|
81
|
+
profile_default/
|
|
82
|
+
ipython_config.py
|
|
83
|
+
|
|
84
|
+
# pyenv
|
|
85
|
+
.python-version
|
|
86
|
+
|
|
87
|
+
# pipenv
|
|
88
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
89
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
90
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
91
|
+
# install all needed dependencies.
|
|
92
|
+
#Pipfile.lock
|
|
93
|
+
|
|
94
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
|
|
95
|
+
__pypackages__/
|
|
96
|
+
|
|
97
|
+
# Celery stuff
|
|
98
|
+
celerybeat-schedule
|
|
99
|
+
celerybeat.pid
|
|
100
|
+
|
|
101
|
+
# SageMath parsed files
|
|
102
|
+
*.sage.py
|
|
103
|
+
|
|
104
|
+
# Environments
|
|
105
|
+
.env
|
|
106
|
+
.venv
|
|
107
|
+
env/
|
|
108
|
+
venv/
|
|
109
|
+
ENV/
|
|
110
|
+
env.bak/
|
|
111
|
+
venv.bak/
|
|
112
|
+
|
|
113
|
+
# Spyder project settings
|
|
114
|
+
.spyderproject
|
|
115
|
+
.spyproject
|
|
116
|
+
|
|
117
|
+
# Rope project settings
|
|
118
|
+
.ropeproject
|
|
119
|
+
|
|
120
|
+
# mkdocs documentation
|
|
121
|
+
/site
|
|
122
|
+
|
|
123
|
+
# mypy
|
|
124
|
+
.mypy_cache/
|
|
125
|
+
.dmypy.json
|
|
126
|
+
dmypy.json
|
|
127
|
+
|
|
128
|
+
# Pyre type checker
|
|
129
|
+
.pyre/
|
|
130
|
+
|
|
131
|
+
# Ignore the setuptools_scm auto-generated version module
|
|
132
|
+
src/saltext/github/version.py
|
|
133
|
+
|
|
134
|
+
# Ignore CI generated artifacts
|
|
135
|
+
artifacts/
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
---
|
|
2
|
+
minimum_pre_commit_version: 2.4.0
|
|
3
|
+
repos:
|
|
4
|
+
- repo: https://github.com/pre-commit/pre-commit-hooks
|
|
5
|
+
rev: v4.6.0
|
|
6
|
+
hooks:
|
|
7
|
+
- id: check-merge-conflict # Check for files that contain merge conflict strings.
|
|
8
|
+
- id: trailing-whitespace # Trims trailing whitespace.
|
|
9
|
+
args: [--markdown-linebreak-ext=md]
|
|
10
|
+
- id: mixed-line-ending # Replaces or checks mixed line ending.
|
|
11
|
+
args: [--fix=lf]
|
|
12
|
+
- id: end-of-file-fixer # Makes sure files end in a newline and only a newline.
|
|
13
|
+
- id: check-merge-conflict # Check for files that contain merge conflict strings.
|
|
14
|
+
- id: check-ast # Simply check whether files parse as valid python.
|
|
15
|
+
|
|
16
|
+
# ----- Formatting ---------------------------------------------------------------------------->
|
|
17
|
+
- repo: https://github.com/saltstack/pre-commit-remove-import-headers
|
|
18
|
+
rev: 1.1.0
|
|
19
|
+
hooks:
|
|
20
|
+
- id: remove-import-headers
|
|
21
|
+
|
|
22
|
+
- repo: local
|
|
23
|
+
hooks:
|
|
24
|
+
- id: check-cli-examples
|
|
25
|
+
name: Check CLI examples on execution modules
|
|
26
|
+
entry: python .pre-commit-hooks/check-cli-examples.py
|
|
27
|
+
language: system
|
|
28
|
+
files: ^src/saltext/github/modules/.*\.py$
|
|
29
|
+
|
|
30
|
+
- repo: local
|
|
31
|
+
hooks:
|
|
32
|
+
- id: check-docs
|
|
33
|
+
name: Check rST doc files exist for modules/states
|
|
34
|
+
entry: python .pre-commit-hooks/make-autodocs.py
|
|
35
|
+
language: system
|
|
36
|
+
pass_filenames: false
|
|
37
|
+
|
|
38
|
+
- repo: https://github.com/s0undt3ch/salt-rewrite
|
|
39
|
+
# Automatically rewrite code with known rules
|
|
40
|
+
rev: 2.5.2
|
|
41
|
+
hooks:
|
|
42
|
+
- id: salt-rewrite
|
|
43
|
+
alias: rewrite-docstrings
|
|
44
|
+
name: Salt extensions docstrings auto-fixes
|
|
45
|
+
files: ^src/saltext/github/.*\.py$
|
|
46
|
+
args: [--silent]
|
|
47
|
+
|
|
48
|
+
- repo: https://github.com/s0undt3ch/salt-rewrite
|
|
49
|
+
# Automatically rewrite code with known rules
|
|
50
|
+
rev: 2.5.2
|
|
51
|
+
hooks:
|
|
52
|
+
- id: salt-rewrite
|
|
53
|
+
alias: rewrite-tests
|
|
54
|
+
name: Rewrite the test suite
|
|
55
|
+
files: ^tests/.*\.py$
|
|
56
|
+
args: [--silent, -E, fix_docstrings]
|
|
57
|
+
|
|
58
|
+
- repo: https://github.com/asottile/pyupgrade
|
|
59
|
+
rev: v3.15.2
|
|
60
|
+
hooks:
|
|
61
|
+
- id: pyupgrade
|
|
62
|
+
name: Rewrite Code to be Py3.8+
|
|
63
|
+
args: [
|
|
64
|
+
--py38-plus
|
|
65
|
+
]
|
|
66
|
+
exclude: src/saltext/github/version.py
|
|
67
|
+
|
|
68
|
+
- repo: https://github.com/PyCQA/isort
|
|
69
|
+
rev: 5.13.2
|
|
70
|
+
hooks:
|
|
71
|
+
- id: isort
|
|
72
|
+
args: [
|
|
73
|
+
--py 38,
|
|
74
|
+
]
|
|
75
|
+
exclude: src/saltext/github/(__init__|version).py
|
|
76
|
+
|
|
77
|
+
- repo: https://github.com/psf/black
|
|
78
|
+
rev: 24.2.0
|
|
79
|
+
hooks:
|
|
80
|
+
- id: black
|
|
81
|
+
args: [-l 100]
|
|
82
|
+
exclude: src/saltext/github/version.py
|
|
83
|
+
|
|
84
|
+
- repo: https://github.com/adamchainz/blacken-docs
|
|
85
|
+
rev: 1.16.0
|
|
86
|
+
hooks:
|
|
87
|
+
- id: blacken-docs
|
|
88
|
+
args: [--skip-errors]
|
|
89
|
+
files: ^(docs/.*\.rst|src/saltext/github/.*\.py)$
|
|
90
|
+
additional_dependencies:
|
|
91
|
+
- black==24.2.0
|
|
92
|
+
# <---- Formatting -----------------------------------------------------------------------------
|
|
93
|
+
|
|
94
|
+
# ----- Security ------------------------------------------------------------------------------>
|
|
95
|
+
- repo: https://github.com/PyCQA/bandit
|
|
96
|
+
rev: 1.7.8
|
|
97
|
+
hooks:
|
|
98
|
+
- id: bandit
|
|
99
|
+
alias: bandit-salt
|
|
100
|
+
name: Run bandit against the code base
|
|
101
|
+
args: [--silent, -lll, --skip, B701]
|
|
102
|
+
exclude: src/saltext/github/version.py
|
|
103
|
+
- repo: https://github.com/PyCQA/bandit
|
|
104
|
+
rev: 1.7.8
|
|
105
|
+
hooks:
|
|
106
|
+
- id: bandit
|
|
107
|
+
alias: bandit-tests
|
|
108
|
+
name: Run bandit against the test suite
|
|
109
|
+
args: [--silent, -lll, --skip, B701]
|
|
110
|
+
files: ^tests/.*
|
|
111
|
+
# <---- Security -------------------------------------------------------------------------------
|
|
112
|
+
|
|
113
|
+
# ----- Code Analysis ------------------------------------------------------------------------->
|
|
114
|
+
- repo: https://github.com/saltstack/mirrors-nox
|
|
115
|
+
rev: v2022.11.21
|
|
116
|
+
hooks:
|
|
117
|
+
- id: nox
|
|
118
|
+
alias: lint-src
|
|
119
|
+
name: Lint Source Code
|
|
120
|
+
files: ^((setup|noxfile)|src/.*)\.py$
|
|
121
|
+
require_serial: true
|
|
122
|
+
args:
|
|
123
|
+
- -e
|
|
124
|
+
- lint-code-pre-commit
|
|
125
|
+
- --
|
|
126
|
+
|
|
127
|
+
- repo: https://github.com/saltstack/mirrors-nox
|
|
128
|
+
rev: v2022.11.21
|
|
129
|
+
hooks:
|
|
130
|
+
- id: nox
|
|
131
|
+
alias: lint-tests
|
|
132
|
+
name: Lint Tests
|
|
133
|
+
files: ^tests/.*\.py$
|
|
134
|
+
require_serial: true
|
|
135
|
+
args:
|
|
136
|
+
- -e
|
|
137
|
+
- lint-tests-pre-commit
|
|
138
|
+
- --
|
|
139
|
+
# <---- Code Analysis --------------------------------------------------------------------------
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import ast
|
|
2
|
+
import pathlib
|
|
3
|
+
import re
|
|
4
|
+
import sys
|
|
5
|
+
|
|
6
|
+
CODE_ROOT = pathlib.Path(__file__).resolve().parent.parent
|
|
7
|
+
EXECUTION_MODULES_PATH = CODE_ROOT / "src" / "saltext" / "github" / "modules"
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def check_cli_examples(files):
|
|
11
|
+
"""
|
|
12
|
+
Check that every function on every execution module provides a CLI example
|
|
13
|
+
"""
|
|
14
|
+
errors = 0
|
|
15
|
+
for file in files:
|
|
16
|
+
path = pathlib.Path(file).resolve()
|
|
17
|
+
try:
|
|
18
|
+
relpath = path.relative_to(EXECUTION_MODULES_PATH)
|
|
19
|
+
if str(relpath.parent) != ".":
|
|
20
|
+
# We don't want to check nested packages
|
|
21
|
+
continue
|
|
22
|
+
except ValueError:
|
|
23
|
+
# We're only interested in execution modules
|
|
24
|
+
continue
|
|
25
|
+
module = ast.parse(path.read_text(), filename=str(path))
|
|
26
|
+
for funcdef in [node for node in module.body if isinstance(node, ast.FunctionDef)]:
|
|
27
|
+
if funcdef.name.startswith("_"):
|
|
28
|
+
# We're not interested in internal functions
|
|
29
|
+
continue
|
|
30
|
+
|
|
31
|
+
docstring = ast.get_docstring(funcdef, clean=False)
|
|
32
|
+
if not docstring:
|
|
33
|
+
errors += 1
|
|
34
|
+
print(
|
|
35
|
+
"The function {!r} on '{}' does not have a docstring".format(
|
|
36
|
+
funcdef.name,
|
|
37
|
+
path.relative_to(CODE_ROOT),
|
|
38
|
+
),
|
|
39
|
+
file=sys.stderr,
|
|
40
|
+
)
|
|
41
|
+
continue
|
|
42
|
+
|
|
43
|
+
if _check_cli_example_present(docstring) is False:
|
|
44
|
+
errors += 1
|
|
45
|
+
print(
|
|
46
|
+
"The function {!r} on '{}' does not have a 'CLI Example:' in it's docstring".format(
|
|
47
|
+
funcdef.name,
|
|
48
|
+
path.relative_to(CODE_ROOT),
|
|
49
|
+
),
|
|
50
|
+
file=sys.stderr,
|
|
51
|
+
)
|
|
52
|
+
continue
|
|
53
|
+
sys.exit(errors)
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
CLI_EXAMPLE_PRESENT_RE = re.compile(r"CLI Example(?:s)?:")
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
def _check_cli_example_present(docstring):
|
|
60
|
+
return CLI_EXAMPLE_PRESENT_RE.search(docstring) is not None
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
if __name__ == "__main__":
|
|
64
|
+
check_cli_examples(sys.argv[1:])
|