RepoAuditor 0.2.20__tar.gz → 0.2.21__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.
- {repoauditor-0.2.20 → repoauditor-0.2.21}/PKG-INFO +1 -1
- repoauditor-0.2.21/src/RepoAuditor/Plugins/GitHub/Module.py +33 -0
- {repoauditor-0.2.20/src/RepoAuditor/Plugins/GitHub → repoauditor-0.2.21/src/RepoAuditor/Plugins/GitHubBase}/Module.py +144 -158
- {repoauditor-0.2.20 → repoauditor-0.2.21}/src/RepoAuditor/Plugins/GitHubCustomization/Module.py +5 -16
- {repoauditor-0.2.20 → repoauditor-0.2.21}/src/RepoAuditor/__init__.py +1 -1
- repoauditor-0.2.21/src/RepoAuditor/py.typed +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.21}/tests/Plugins/GitHubModule_UnitTest.py +2 -1
- {repoauditor-0.2.20 → repoauditor-0.2.21}/.copier-answers.yml +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.21}/.github/CODEOWNERS +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.21}/.github/ISSUE_TEMPLATE/bug_report.md +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.21}/.github/ISSUE_TEMPLATE/config.yml +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.21}/.github/ISSUE_TEMPLATE/custom.md +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.21}/.github/ISSUE_TEMPLATE/feature_request.md +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.21}/.github/actions/release_impl/action.yml +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.21}/.github/pull_request_template.md +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.21}/.github/release_sources.yaml +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.21}/.github/workflows/CICD.yml +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.21}/.github/workflows/CICD_impl.yml +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.21}/.github/workflows/codeql.yml +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.21}/.gitignore +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.21}/.pre-commit-config.yaml +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.21}/.python-version +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.21}/CODE_OF_CONDUCT.md +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.21}/CONTRIBUTING.md +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.21}/DEVELOPMENT.md +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.21}/GOVERNANCE.md +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.21}/LICENSE +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.21}/MAINTAINERS.md +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.21}/README.md +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.21}/SECURITY.md +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.21}/minisign_key.pub +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.21}/pyproject.toml +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.21}/src/AutoGitSemVer.yaml +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.21}/src/RepoAuditor/CommandLineProcessor.py +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.21}/src/RepoAuditor/EntryPoint.py +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.21}/src/RepoAuditor/ExecuteModules.py +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.21}/src/RepoAuditor/Impl/ParallelSequentialProcessor.py +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.21}/src/RepoAuditor/Impl/__init__.py +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.21}/src/RepoAuditor/Module.py +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.21}/src/RepoAuditor/Plugin.py +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.21}/src/RepoAuditor/Plugins/GitHub/ClassicBranchProtectionQuery.py +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.21}/src/RepoAuditor/Plugins/GitHub/ClassicBranchProtectionRequirements/AllowDeletions.py +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.21}/src/RepoAuditor/Plugins/GitHub/ClassicBranchProtectionRequirements/AllowForcePushes.py +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.21}/src/RepoAuditor/Plugins/GitHub/ClassicBranchProtectionRequirements/DismissStalePullRequestApprovals.py +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.21}/src/RepoAuditor/Plugins/GitHub/ClassicBranchProtectionRequirements/DoNotAllowBypassSettings.py +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.21}/src/RepoAuditor/Plugins/GitHub/ClassicBranchProtectionRequirements/EnsureStatusChecks.py +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.21}/src/RepoAuditor/Plugins/GitHub/ClassicBranchProtectionRequirements/Impl/ClassicEnableRequirementImpl.py +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.21}/src/RepoAuditor/Plugins/GitHub/ClassicBranchProtectionRequirements/Impl/ClassicValueRequirementImpl.py +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.21}/src/RepoAuditor/Plugins/GitHub/ClassicBranchProtectionRequirements/Impl/__init__.py +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.21}/src/RepoAuditor/Plugins/GitHub/ClassicBranchProtectionRequirements/RequireApprovalMostRecentPush.py +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.21}/src/RepoAuditor/Plugins/GitHub/ClassicBranchProtectionRequirements/RequireApprovals.py +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.21}/src/RepoAuditor/Plugins/GitHub/ClassicBranchProtectionRequirements/RequireCodeOwnerReview.py +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.21}/src/RepoAuditor/Plugins/GitHub/ClassicBranchProtectionRequirements/RequireConversationResolution.py +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.21}/src/RepoAuditor/Plugins/GitHub/ClassicBranchProtectionRequirements/RequireLinearHistory.py +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.21}/src/RepoAuditor/Plugins/GitHub/ClassicBranchProtectionRequirements/RequirePullRequests.py +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.21}/src/RepoAuditor/Plugins/GitHub/ClassicBranchProtectionRequirements/RequireSignedCommits.py +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.21}/src/RepoAuditor/Plugins/GitHub/ClassicBranchProtectionRequirements/RequireStatusChecksToPass.py +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.21}/src/RepoAuditor/Plugins/GitHub/ClassicBranchProtectionRequirements/RequireUpToDateBranches.py +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.21}/src/RepoAuditor/Plugins/GitHub/ClassicBranchProtectionRequirements/__init__.py +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.21}/src/RepoAuditor/Plugins/GitHub/DefaultBranchQuery.py +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.21}/src/RepoAuditor/Plugins/GitHub/DefaultBranchQueryRequirements/Protected.py +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.21}/src/RepoAuditor/Plugins/GitHub/DefaultBranchQueryRequirements/__init__.py +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.21}/src/RepoAuditor/Plugins/GitHub/Impl/Common.py +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.21}/src/RepoAuditor/Plugins/GitHub/Impl/EnableRequirementImpl.py +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.21}/src/RepoAuditor/Plugins/GitHub/Impl/ValueRequirementImpl.py +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.21}/src/RepoAuditor/Plugins/GitHub/Impl/__init__.py +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.21}/src/RepoAuditor/Plugins/GitHub/StandardQuery.py +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.21}/src/RepoAuditor/Plugins/GitHub/StandardQueryRequirements/AutoMerge.py +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.21}/src/RepoAuditor/Plugins/GitHub/StandardQueryRequirements/DefaultBranch.py +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.21}/src/RepoAuditor/Plugins/GitHub/StandardQueryRequirements/DeleteHeadBranches.py +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.21}/src/RepoAuditor/Plugins/GitHub/StandardQueryRequirements/DependabotSecurityUpdates.py +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.21}/src/RepoAuditor/Plugins/GitHub/StandardQueryRequirements/Description.py +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.21}/src/RepoAuditor/Plugins/GitHub/StandardQueryRequirements/Impl/StandardEnableRequirementImpl.py +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.21}/src/RepoAuditor/Plugins/GitHub/StandardQueryRequirements/Impl/StandardValueRequirementImpl.py +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.21}/src/RepoAuditor/Plugins/GitHub/StandardQueryRequirements/Impl/__init__.py +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.21}/src/RepoAuditor/Plugins/GitHub/StandardQueryRequirements/License.py +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.21}/src/RepoAuditor/Plugins/GitHub/StandardQueryRequirements/MergeCommit.py +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.21}/src/RepoAuditor/Plugins/GitHub/StandardQueryRequirements/MergeCommitMessage.py +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.21}/src/RepoAuditor/Plugins/GitHub/StandardQueryRequirements/Private.py +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.21}/src/RepoAuditor/Plugins/GitHub/StandardQueryRequirements/RebaseMergeCommit.py +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.21}/src/RepoAuditor/Plugins/GitHub/StandardQueryRequirements/SecretScanning.py +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.21}/src/RepoAuditor/Plugins/GitHub/StandardQueryRequirements/SecretScanningPushProtection.py +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.21}/src/RepoAuditor/Plugins/GitHub/StandardQueryRequirements/SquashCommitMerge.py +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.21}/src/RepoAuditor/Plugins/GitHub/StandardQueryRequirements/SquashMergeCommitMessage.py +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.21}/src/RepoAuditor/Plugins/GitHub/StandardQueryRequirements/SuggestUpdatingPullRequestBranches.py +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.21}/src/RepoAuditor/Plugins/GitHub/StandardQueryRequirements/SupportDiscussions.py +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.21}/src/RepoAuditor/Plugins/GitHub/StandardQueryRequirements/SupportIssues.py +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.21}/src/RepoAuditor/Plugins/GitHub/StandardQueryRequirements/SupportProjects.py +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.21}/src/RepoAuditor/Plugins/GitHub/StandardQueryRequirements/SupportWikis.py +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.21}/src/RepoAuditor/Plugins/GitHub/StandardQueryRequirements/TemplateRepository.py +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.21}/src/RepoAuditor/Plugins/GitHub/StandardQueryRequirements/WebCommitSignoff.py +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.21}/src/RepoAuditor/Plugins/GitHub/StandardQueryRequirements/__init__.py +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.21}/src/RepoAuditor/Plugins/GitHub/__init__.py +0 -0
- {repoauditor-0.2.20/src/RepoAuditor/Plugins/GitHubCustomization → repoauditor-0.2.21/src/RepoAuditor/Plugins/GitHubBase}/__init__.py +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.21}/src/RepoAuditor/Plugins/GitHubCustomization/CustomizationQuery.py +0 -0
- {repoauditor-0.2.20/src/RepoAuditor/Plugins → repoauditor-0.2.21/src/RepoAuditor/Plugins/GitHubCustomization}/__init__.py +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.21}/src/RepoAuditor/Plugins/GitHubCustomizationPlugin.py +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.21}/src/RepoAuditor/Plugins/GitHubPlugin.py +0 -0
- /repoauditor-0.2.20/src/RepoAuditor/py.typed → /repoauditor-0.2.21/src/RepoAuditor/Plugins/__init__.py +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.21}/src/RepoAuditor/Query.py +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.21}/src/RepoAuditor/Requirement.py +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.21}/tests/CommandLineProcessor_UnitTest.py +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.21}/tests/EntryPoint_UnitTest.py +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.21}/tests/ExecuteModules_UnitTest.py +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.21}/tests/Module_UnitTest.py +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.21}/tests/Plugin_UnitTest.py +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.21}/tests/Plugins/GitHubCustomization_UnitTest.py +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.21}/tests/Plugins/GitHub_EndToEndTest.py +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.21}/tests/Plugins/__snapshots__/GitHub_EndToEndTest.ambr +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.21}/tests/Plugins/utilities.py +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.21}/tests/Query_UnitTest.py +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.21}/tests/Requirement_UnitTest.py +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.21}/tests/__snapshots__/ExecuteModules_UnitTest.ambr +0 -0
- {repoauditor-0.2.20 → repoauditor-0.2.21}/uv.lock +0 -0
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# -------------------------------------------------------------------------------
|
|
2
|
+
# |
|
|
3
|
+
# | Copyright (c) 2024 Scientific Software Engineering Center at Georgia Tech
|
|
4
|
+
# | Distributed under the MIT License.
|
|
5
|
+
# |
|
|
6
|
+
# -------------------------------------------------------------------------------
|
|
7
|
+
"""Contains the GitHubModule object."""
|
|
8
|
+
|
|
9
|
+
from RepoAuditor.Module import ExecutionStyle
|
|
10
|
+
from RepoAuditor.Plugins.GitHubBase.Module import GitHubBaseModule
|
|
11
|
+
|
|
12
|
+
from .ClassicBranchProtectionQuery import ClassicBranchProtectionQuery
|
|
13
|
+
from .DefaultBranchQuery import DefaultBranchQuery
|
|
14
|
+
from .StandardQuery import StandardQuery
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
# ----------------------------------------------------------------------
|
|
18
|
+
class GitHubModule(GitHubBaseModule):
|
|
19
|
+
"""Module for validating GitHub repository configuration settings."""
|
|
20
|
+
|
|
21
|
+
# ----------------------------------------------------------------------
|
|
22
|
+
def __init__(self) -> None:
|
|
23
|
+
super().__init__(
|
|
24
|
+
"GitHub",
|
|
25
|
+
"Validates GitHub configuration settings.",
|
|
26
|
+
ExecutionStyle.Parallel,
|
|
27
|
+
[
|
|
28
|
+
StandardQuery(),
|
|
29
|
+
DefaultBranchQuery(),
|
|
30
|
+
ClassicBranchProtectionQuery(),
|
|
31
|
+
],
|
|
32
|
+
requires_explicit_include=True,
|
|
33
|
+
)
|
|
@@ -1,158 +1,144 @@
|
|
|
1
|
-
# -------------------------------------------------------------------------------
|
|
2
|
-
# |
|
|
3
|
-
# | Copyright (c) 2024 Scientific Software Engineering Center at Georgia Tech
|
|
4
|
-
# | Distributed under the MIT License.
|
|
5
|
-
# |
|
|
6
|
-
# -------------------------------------------------------------------------------
|
|
7
|
-
"""Contains the
|
|
8
|
-
|
|
9
|
-
from pathlib import Path
|
|
10
|
-
from typing import Any, Optional
|
|
11
|
-
from urllib.parse import urlparse
|
|
12
|
-
|
|
13
|
-
import requests
|
|
14
|
-
import typer
|
|
15
|
-
|
|
16
|
-
from dbrownell_Common.TyperEx import TypeDefinitionItemType # type: ignore[import-untyped]
|
|
17
|
-
from dbrownell_Common.Types import override # type: ignore[import-untyped]
|
|
18
|
-
|
|
19
|
-
from RepoAuditor.Module import
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
# ----------------------------------------------------------------------
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
# ----------------------------------------------------------------------
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
"
|
|
50
|
-
str,
|
|
51
|
-
typer.Option(
|
|
52
|
-
|
|
53
|
-
help="
|
|
54
|
-
),
|
|
55
|
-
),
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
)
|
|
106
|
-
|
|
107
|
-
if
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
method: str,
|
|
146
|
-
url: str,
|
|
147
|
-
*args,
|
|
148
|
-
**kwargs,
|
|
149
|
-
) -> requests.Response:
|
|
150
|
-
if url and not url.startswith("/"):
|
|
151
|
-
url = f"/{url}"
|
|
152
|
-
|
|
153
|
-
return super().request(
|
|
154
|
-
method,
|
|
155
|
-
f"{self.api_url}{url}",
|
|
156
|
-
*args,
|
|
157
|
-
**kwargs,
|
|
158
|
-
)
|
|
1
|
+
# -------------------------------------------------------------------------------
|
|
2
|
+
# |
|
|
3
|
+
# | Copyright (c) 2024 Scientific Software Engineering Center at Georgia Tech
|
|
4
|
+
# | Distributed under the MIT License.
|
|
5
|
+
# |
|
|
6
|
+
# -------------------------------------------------------------------------------
|
|
7
|
+
"""Contains the GitHubBaseModule object."""
|
|
8
|
+
|
|
9
|
+
from pathlib import Path
|
|
10
|
+
from typing import Any, Optional
|
|
11
|
+
from urllib.parse import urlparse
|
|
12
|
+
|
|
13
|
+
import requests
|
|
14
|
+
import typer
|
|
15
|
+
|
|
16
|
+
from dbrownell_Common.TyperEx import TypeDefinitionItemType # type: ignore[import-untyped]
|
|
17
|
+
from dbrownell_Common.Types import override # type: ignore[import-untyped]
|
|
18
|
+
|
|
19
|
+
from RepoAuditor.Module import Module
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
# ----------------------------------------------------------------------
|
|
23
|
+
class GitHubBaseModule(Module):
|
|
24
|
+
"""Module for common GitHub settings which can be inherited by various GitHub plugins."""
|
|
25
|
+
|
|
26
|
+
# ----------------------------------------------------------------------
|
|
27
|
+
# The __init__ method is inherited from the Module class
|
|
28
|
+
# and does not need to be overriden.
|
|
29
|
+
|
|
30
|
+
# ----------------------------------------------------------------------
|
|
31
|
+
@override
|
|
32
|
+
def GetDynamicArgDefinitions(self) -> dict[str, TypeDefinitionItemType]:
|
|
33
|
+
"""Get the definitions for the arguments to this requirement."""
|
|
34
|
+
return {
|
|
35
|
+
"url": (
|
|
36
|
+
str,
|
|
37
|
+
typer.Option(
|
|
38
|
+
...,
|
|
39
|
+
help="[REQUIRED] Github URL (e.g. https://github.com/gt-sse-center/RepoAuditor)",
|
|
40
|
+
),
|
|
41
|
+
),
|
|
42
|
+
"pat": (
|
|
43
|
+
str,
|
|
44
|
+
typer.Option(
|
|
45
|
+
None,
|
|
46
|
+
help="GitHub Personal Access Token (PAT) or path to a local file containing the PAT.",
|
|
47
|
+
),
|
|
48
|
+
),
|
|
49
|
+
"branch": (
|
|
50
|
+
str,
|
|
51
|
+
typer.Option(
|
|
52
|
+
None,
|
|
53
|
+
help="Branch to evaluate. The default branch will be used if not specified.",
|
|
54
|
+
),
|
|
55
|
+
),
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
# ----------------------------------------------------------------------
|
|
59
|
+
@override
|
|
60
|
+
def GenerateInitialData(self, dynamic_args: dict[str, Any]) -> Optional[dict[str, Any]]:
|
|
61
|
+
"""Generate the initial data to be used in the `dynamic_args`, such as session info, etc."""
|
|
62
|
+
# Create a GitHub API session
|
|
63
|
+
dynamic_args["session"] = _GitHubSession(dynamic_args["url"], dynamic_args.get("pat"))
|
|
64
|
+
|
|
65
|
+
return dynamic_args
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
# ----------------------------------------------------------------------
|
|
69
|
+
# |
|
|
70
|
+
# | Private Types
|
|
71
|
+
# |
|
|
72
|
+
# ----------------------------------------------------------------------
|
|
73
|
+
class _GitHubSession(requests.Session):
|
|
74
|
+
"""Session used to communicate with GitHub APIs."""
|
|
75
|
+
|
|
76
|
+
# ----------------------------------------------------------------------
|
|
77
|
+
def __init__(
|
|
78
|
+
self,
|
|
79
|
+
github_url: str,
|
|
80
|
+
github_pat: Optional[str],
|
|
81
|
+
*args,
|
|
82
|
+
**kwargs,
|
|
83
|
+
) -> None:
|
|
84
|
+
super().__init__(*args, **kwargs)
|
|
85
|
+
|
|
86
|
+
self.headers.update(
|
|
87
|
+
{
|
|
88
|
+
"X-GitHub-Api-Version": "2022-11-28",
|
|
89
|
+
"Accept": "application/vnd.github+json",
|
|
90
|
+
},
|
|
91
|
+
)
|
|
92
|
+
|
|
93
|
+
if github_pat:
|
|
94
|
+
potential_file = Path(github_pat)
|
|
95
|
+
|
|
96
|
+
if potential_file.is_file():
|
|
97
|
+
with potential_file.open("r") as f:
|
|
98
|
+
github_pat = f.read().strip()
|
|
99
|
+
|
|
100
|
+
self.headers["Authorization"] = f"Bearer {github_pat}"
|
|
101
|
+
|
|
102
|
+
github_url = github_url.removesuffix("/")
|
|
103
|
+
|
|
104
|
+
url_parts = urlparse(github_url)
|
|
105
|
+
path_parts = url_parts.path.split("/")
|
|
106
|
+
|
|
107
|
+
if len(path_parts) != 3:
|
|
108
|
+
msg = f"'{github_url}' is not a valid GitHub repository URL."
|
|
109
|
+
raise ValueError(msg)
|
|
110
|
+
|
|
111
|
+
_, username, repo = path_parts
|
|
112
|
+
|
|
113
|
+
if url_parts.netloc.lower() in ["github.com", "www.github.com"]:
|
|
114
|
+
api_url = f"https://api.github.com/repos/{username}/{repo}"
|
|
115
|
+
is_enterprise = False
|
|
116
|
+
else:
|
|
117
|
+
api_url = f"{url_parts.scheme}://{url_parts.netloc}/api/v3/orgs/{username}/repos/{repo}"
|
|
118
|
+
is_enterprise = True
|
|
119
|
+
|
|
120
|
+
self.github_url = github_url
|
|
121
|
+
self.github_pat = github_pat
|
|
122
|
+
self.github_username = username
|
|
123
|
+
self.github_repository = repo
|
|
124
|
+
self.api_url = api_url
|
|
125
|
+
self.is_enterprise = is_enterprise
|
|
126
|
+
self.has_pat = bool(github_pat)
|
|
127
|
+
|
|
128
|
+
# ----------------------------------------------------------------------
|
|
129
|
+
def request(
|
|
130
|
+
self,
|
|
131
|
+
method: str,
|
|
132
|
+
url: str,
|
|
133
|
+
*args,
|
|
134
|
+
**kwargs,
|
|
135
|
+
) -> requests.Response:
|
|
136
|
+
if url and not url.startswith("/"):
|
|
137
|
+
url = f"/{url}"
|
|
138
|
+
|
|
139
|
+
return super().request(
|
|
140
|
+
method,
|
|
141
|
+
f"{self.api_url}{url}",
|
|
142
|
+
*args,
|
|
143
|
+
**kwargs,
|
|
144
|
+
)
|
{repoauditor-0.2.20 → repoauditor-0.2.21}/src/RepoAuditor/Plugins/GitHubCustomization/Module.py
RENAMED
|
@@ -6,13 +6,14 @@
|
|
|
6
6
|
# -------------------------------------------------------------------------------
|
|
7
7
|
"""Contains the GitHubCustomizationModule object."""
|
|
8
8
|
|
|
9
|
-
from typing import Any
|
|
10
|
-
from RepoAuditor.Module import ExecutionStyle, Module
|
|
11
|
-
from dbrownell_Common.TyperEx import TypeDefinitionItemType
|
|
9
|
+
from typing import Any
|
|
12
10
|
from dbrownell_Common.Types import override
|
|
13
11
|
|
|
12
|
+
from RepoAuditor.Module import ExecutionStyle
|
|
13
|
+
from RepoAuditor.Plugins.GitHubBase.Module import GitHubBaseModule
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
|
|
16
|
+
class GitHubCustomizationModule(GitHubBaseModule):
|
|
16
17
|
"""Module that validates GitHub repository customization files."""
|
|
17
18
|
|
|
18
19
|
def __init__(self) -> None:
|
|
@@ -24,18 +25,6 @@ class GitHubCustomizationModule(Module):
|
|
|
24
25
|
requires_explicit_include=False,
|
|
25
26
|
)
|
|
26
27
|
|
|
27
|
-
@override
|
|
28
|
-
def GetDynamicArgDefinitions(self) -> dict[str, TypeDefinitionItemType]:
|
|
29
|
-
"""Return the dynamic arguments for this module."""
|
|
30
|
-
# Return an empty dictionary as we don't have any dynamic args yet
|
|
31
|
-
return {}
|
|
32
|
-
|
|
33
|
-
@override
|
|
34
|
-
def GenerateInitialData(self, dynamic_args: dict[str, Any]) -> Optional[dict[str, Any]]: # noqa: ARG002
|
|
35
|
-
"""Generate initial data for queries to use."""
|
|
36
|
-
# Return an empty dictionary as we don't have any initial data yet
|
|
37
|
-
return {}
|
|
38
|
-
|
|
39
28
|
@override
|
|
40
29
|
def Cleanup(self, dynamic_args: dict[str, Any]) -> None:
|
|
41
30
|
"""Clean up any resources created during execution."""
|
|
@@ -3,4 +3,4 @@ APP_NAME = "RepoAuditor"
|
|
|
3
3
|
# Note that this value will be overwritten by calls to `python ../../Build.py update_version` based
|
|
4
4
|
# on changes observed in the git repository. The default value below will be used until the value
|
|
5
5
|
# here is explicitly updated by the Continuous Integration system.
|
|
6
|
-
__version__ = "0.2.
|
|
6
|
+
__version__ = "0.2.21"
|
|
File without changes
|
|
@@ -11,7 +11,8 @@ from pathlib import Path
|
|
|
11
11
|
import pytest
|
|
12
12
|
from pyfakefs.fake_filesystem_unittest import TestCase as FakeFSTestCase
|
|
13
13
|
|
|
14
|
-
from RepoAuditor.Plugins.GitHub.Module import GitHubModule
|
|
14
|
+
from RepoAuditor.Plugins.GitHub.Module import GitHubModule
|
|
15
|
+
from RepoAuditor.Plugins.GitHubBase.Module import _GitHubSession
|
|
15
16
|
|
|
16
17
|
|
|
17
18
|
class TestGitHubSession(FakeFSTestCase):
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{repoauditor-0.2.20 → repoauditor-0.2.21}/src/RepoAuditor/Impl/ParallelSequentialProcessor.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{repoauditor-0.2.20 → repoauditor-0.2.21}/src/RepoAuditor/Plugins/GitHub/DefaultBranchQuery.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{repoauditor-0.2.20 → repoauditor-0.2.21}/src/RepoAuditor/Plugins/GitHubCustomizationPlugin.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{repoauditor-0.2.20 → repoauditor-0.2.21}/tests/Plugins/__snapshots__/GitHub_EndToEndTest.ambr
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|