RepoAuditor 0.2.27__tar.gz → 0.2.29__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.27 → repoauditor-0.2.29}/PKG-INFO +1 -1
- {repoauditor-0.2.27 → repoauditor-0.2.29}/pyproject.toml +1 -1
- {repoauditor-0.2.27 → repoauditor-0.2.29}/src/RepoAuditor/Module.py +3 -0
- {repoauditor-0.2.27 → repoauditor-0.2.29}/src/RepoAuditor/Plugins/GitHubCustomization/CustomizationQuery.py +17 -5
- {repoauditor-0.2.27 → repoauditor-0.2.29}/src/RepoAuditor/Plugins/GitHubCustomization/Impl/ExistsRequirementImpl.py +14 -18
- {repoauditor-0.2.27 → repoauditor-0.2.29}/src/RepoAuditor/Plugins/GitHubCustomization/Module.py +0 -8
- {repoauditor-0.2.27 → repoauditor-0.2.29}/src/RepoAuditor/Plugins/GitHubCustomization/Requirements/CodeOwners.py +0 -5
- {repoauditor-0.2.27 → repoauditor-0.2.29}/src/RepoAuditor/Plugins/GitHubCustomization/Requirements/Contributing.py +0 -5
- {repoauditor-0.2.27 → repoauditor-0.2.29}/src/RepoAuditor/Plugins/GitHubCustomization/Requirements/IssueTemplates.py +0 -4
- {repoauditor-0.2.27 → repoauditor-0.2.29}/src/RepoAuditor/Plugins/GitHubCustomization/Requirements/PullRequestTemplates.py +0 -6
- {repoauditor-0.2.27 → repoauditor-0.2.29}/src/RepoAuditor/Plugins/GitHubCustomization/Requirements/SecurityPolicy.py +0 -5
- repoauditor-0.2.29/src/RepoAuditor/Plugins/GitHubRulesets/Impl/EnableRulesetRequirementImpl.py +83 -0
- repoauditor-0.2.29/src/RepoAuditor/Plugins/GitHubRulesets/Module.py +26 -0
- repoauditor-0.2.29/src/RepoAuditor/Plugins/GitHubRulesets/Requirements/RequirePullRequests.py +25 -0
- repoauditor-0.2.29/src/RepoAuditor/Plugins/GitHubRulesets/Requirements/RequireSignedCommits.py +25 -0
- repoauditor-0.2.29/src/RepoAuditor/Plugins/GitHubRulesets/Requirements/RequireStatusChecks.py +25 -0
- {repoauditor-0.2.27 → repoauditor-0.2.29}/src/RepoAuditor/Plugins/GitHubRulesets/RulesetQuery.py +24 -3
- repoauditor-0.2.27/src/RepoAuditor/Plugins/GitHubRuleset.py → repoauditor-0.2.29/src/RepoAuditor/Plugins/GitHubRulesetsPlugin.py +2 -2
- {repoauditor-0.2.27 → repoauditor-0.2.29}/src/RepoAuditor/Query.py +8 -0
- {repoauditor-0.2.27 → repoauditor-0.2.29}/src/RepoAuditor/__init__.py +1 -1
- repoauditor-0.2.29/src/RepoAuditor/py.typed +0 -0
- {repoauditor-0.2.27 → repoauditor-0.2.29}/tests/Plugins/GitHubCustomization_EndToEndTest.py +72 -5
- repoauditor-0.2.29/tests/Plugins/GitHubRuleset_EndToEndTest.py +73 -0
- repoauditor-0.2.29/tests/Plugins/GitHubRuleset_UnitTest.py +190 -0
- repoauditor-0.2.29/tests/Plugins/__snapshots__/GitHubCustomization_EndToEndTest.ambr +403 -0
- repoauditor-0.2.29/tests/Plugins/__snapshots__/GitHubRuleset_EndToEndTest.ambr +133 -0
- repoauditor-0.2.27/src/RepoAuditor/Plugins/GitHubRulesets/Module.py +0 -49
- repoauditor-0.2.27/src/RepoAuditor/Plugins/GitHubRulesets/Requirements/RequirePullRequests.py +0 -47
- repoauditor-0.2.27/src/RepoAuditor/Plugins/GitHubRulesets/Requirements/RequireSignedCommits.py +0 -47
- repoauditor-0.2.27/src/RepoAuditor/Plugins/GitHubRulesets/Requirements/RequireStatusChecks.py +0 -47
- repoauditor-0.2.27/tests/Plugins/GitHubRuleset_UnitTest.py +0 -213
- repoauditor-0.2.27/tests/Plugins/__snapshots__/GitHubCustomization_EndToEndTest.ambr +0 -146
- {repoauditor-0.2.27 → repoauditor-0.2.29}/.copier-answers.yml +0 -0
- {repoauditor-0.2.27 → repoauditor-0.2.29}/.github/CODEOWNERS +0 -0
- {repoauditor-0.2.27 → repoauditor-0.2.29}/.github/ISSUE_TEMPLATE/bug_report.md +0 -0
- {repoauditor-0.2.27 → repoauditor-0.2.29}/.github/ISSUE_TEMPLATE/config.yml +0 -0
- {repoauditor-0.2.27 → repoauditor-0.2.29}/.github/ISSUE_TEMPLATE/custom.md +0 -0
- {repoauditor-0.2.27 → repoauditor-0.2.29}/.github/ISSUE_TEMPLATE/feature_request.md +0 -0
- {repoauditor-0.2.27 → repoauditor-0.2.29}/.github/actions/release_impl/action.yml +0 -0
- {repoauditor-0.2.27 → repoauditor-0.2.29}/.github/pull_request_template.md +0 -0
- {repoauditor-0.2.27 → repoauditor-0.2.29}/.github/release_sources.yaml +0 -0
- {repoauditor-0.2.27 → repoauditor-0.2.29}/.github/workflows/CICD.yml +0 -0
- {repoauditor-0.2.27 → repoauditor-0.2.29}/.github/workflows/CICD_impl.yml +0 -0
- {repoauditor-0.2.27 → repoauditor-0.2.29}/.github/workflows/EndToEnd.yml +0 -0
- {repoauditor-0.2.27 → repoauditor-0.2.29}/.github/workflows/codeql.yml +0 -0
- {repoauditor-0.2.27 → repoauditor-0.2.29}/.gitignore +0 -0
- {repoauditor-0.2.27 → repoauditor-0.2.29}/.pre-commit-config.yaml +0 -0
- {repoauditor-0.2.27 → repoauditor-0.2.29}/.python-version +0 -0
- {repoauditor-0.2.27 → repoauditor-0.2.29}/CODE_OF_CONDUCT.md +0 -0
- {repoauditor-0.2.27 → repoauditor-0.2.29}/CONTRIBUTING.md +0 -0
- {repoauditor-0.2.27 → repoauditor-0.2.29}/DEVELOPMENT.md +0 -0
- {repoauditor-0.2.27 → repoauditor-0.2.29}/GOVERNANCE.md +0 -0
- {repoauditor-0.2.27 → repoauditor-0.2.29}/LICENSE +0 -0
- {repoauditor-0.2.27 → repoauditor-0.2.29}/MAINTAINERS.md +0 -0
- {repoauditor-0.2.27 → repoauditor-0.2.29}/README.md +0 -0
- {repoauditor-0.2.27 → repoauditor-0.2.29}/SECURITY.md +0 -0
- {repoauditor-0.2.27 → repoauditor-0.2.29}/minisign_key.pub +0 -0
- {repoauditor-0.2.27 → repoauditor-0.2.29}/src/AutoGitSemVer.yaml +0 -0
- {repoauditor-0.2.27 → repoauditor-0.2.29}/src/RepoAuditor/CommandLineProcessor.py +0 -0
- {repoauditor-0.2.27 → repoauditor-0.2.29}/src/RepoAuditor/Display.py +0 -0
- {repoauditor-0.2.27 → repoauditor-0.2.29}/src/RepoAuditor/EntryPoint.py +0 -0
- {repoauditor-0.2.27 → repoauditor-0.2.29}/src/RepoAuditor/ExecuteModules.py +0 -0
- {repoauditor-0.2.27 → repoauditor-0.2.29}/src/RepoAuditor/Impl/ParallelSequentialProcessor.py +0 -0
- {repoauditor-0.2.27 → repoauditor-0.2.29}/src/RepoAuditor/Impl/__init__.py +0 -0
- {repoauditor-0.2.27 → repoauditor-0.2.29}/src/RepoAuditor/Plugin.py +0 -0
- {repoauditor-0.2.27 → repoauditor-0.2.29}/src/RepoAuditor/Plugins/GitHub/ClassicBranchProtectionQuery.py +0 -0
- {repoauditor-0.2.27 → repoauditor-0.2.29}/src/RepoAuditor/Plugins/GitHub/ClassicBranchProtectionRequirements/AllowDeletions.py +0 -0
- {repoauditor-0.2.27 → repoauditor-0.2.29}/src/RepoAuditor/Plugins/GitHub/ClassicBranchProtectionRequirements/AllowForcePushes.py +0 -0
- {repoauditor-0.2.27 → repoauditor-0.2.29}/src/RepoAuditor/Plugins/GitHub/ClassicBranchProtectionRequirements/DismissStalePullRequestApprovals.py +0 -0
- {repoauditor-0.2.27 → repoauditor-0.2.29}/src/RepoAuditor/Plugins/GitHub/ClassicBranchProtectionRequirements/DoNotAllowBypassSettings.py +0 -0
- {repoauditor-0.2.27 → repoauditor-0.2.29}/src/RepoAuditor/Plugins/GitHub/ClassicBranchProtectionRequirements/EnsureStatusChecks.py +0 -0
- {repoauditor-0.2.27 → repoauditor-0.2.29}/src/RepoAuditor/Plugins/GitHub/ClassicBranchProtectionRequirements/Impl/ClassicEnableRequirementImpl.py +0 -0
- {repoauditor-0.2.27 → repoauditor-0.2.29}/src/RepoAuditor/Plugins/GitHub/ClassicBranchProtectionRequirements/Impl/ClassicValueRequirementImpl.py +0 -0
- {repoauditor-0.2.27 → repoauditor-0.2.29}/src/RepoAuditor/Plugins/GitHub/ClassicBranchProtectionRequirements/Impl/__init__.py +0 -0
- {repoauditor-0.2.27 → repoauditor-0.2.29}/src/RepoAuditor/Plugins/GitHub/ClassicBranchProtectionRequirements/RequireApprovalMostRecentPush.py +0 -0
- {repoauditor-0.2.27 → repoauditor-0.2.29}/src/RepoAuditor/Plugins/GitHub/ClassicBranchProtectionRequirements/RequireApprovals.py +0 -0
- {repoauditor-0.2.27 → repoauditor-0.2.29}/src/RepoAuditor/Plugins/GitHub/ClassicBranchProtectionRequirements/RequireCodeOwnerReview.py +0 -0
- {repoauditor-0.2.27 → repoauditor-0.2.29}/src/RepoAuditor/Plugins/GitHub/ClassicBranchProtectionRequirements/RequireConversationResolution.py +0 -0
- {repoauditor-0.2.27 → repoauditor-0.2.29}/src/RepoAuditor/Plugins/GitHub/ClassicBranchProtectionRequirements/RequireLinearHistory.py +0 -0
- {repoauditor-0.2.27 → repoauditor-0.2.29}/src/RepoAuditor/Plugins/GitHub/ClassicBranchProtectionRequirements/RequirePullRequests.py +0 -0
- {repoauditor-0.2.27 → repoauditor-0.2.29}/src/RepoAuditor/Plugins/GitHub/ClassicBranchProtectionRequirements/RequireSignedCommits.py +0 -0
- {repoauditor-0.2.27 → repoauditor-0.2.29}/src/RepoAuditor/Plugins/GitHub/ClassicBranchProtectionRequirements/RequireStatusChecksToPass.py +0 -0
- {repoauditor-0.2.27 → repoauditor-0.2.29}/src/RepoAuditor/Plugins/GitHub/ClassicBranchProtectionRequirements/RequireUpToDateBranches.py +0 -0
- {repoauditor-0.2.27 → repoauditor-0.2.29}/src/RepoAuditor/Plugins/GitHub/ClassicBranchProtectionRequirements/__init__.py +0 -0
- {repoauditor-0.2.27 → repoauditor-0.2.29}/src/RepoAuditor/Plugins/GitHub/DefaultBranchQuery.py +0 -0
- {repoauditor-0.2.27 → repoauditor-0.2.29}/src/RepoAuditor/Plugins/GitHub/DefaultBranchQueryRequirements/Protected.py +0 -0
- {repoauditor-0.2.27 → repoauditor-0.2.29}/src/RepoAuditor/Plugins/GitHub/DefaultBranchQueryRequirements/__init__.py +0 -0
- {repoauditor-0.2.27 → repoauditor-0.2.29}/src/RepoAuditor/Plugins/GitHub/Impl/Common.py +0 -0
- {repoauditor-0.2.27 → repoauditor-0.2.29}/src/RepoAuditor/Plugins/GitHub/Impl/EnableRequirementImpl.py +0 -0
- {repoauditor-0.2.27 → repoauditor-0.2.29}/src/RepoAuditor/Plugins/GitHub/Impl/ValueRequirementImpl.py +0 -0
- {repoauditor-0.2.27 → repoauditor-0.2.29}/src/RepoAuditor/Plugins/GitHub/Impl/__init__.py +0 -0
- {repoauditor-0.2.27 → repoauditor-0.2.29}/src/RepoAuditor/Plugins/GitHub/Module.py +0 -0
- {repoauditor-0.2.27 → repoauditor-0.2.29}/src/RepoAuditor/Plugins/GitHub/StandardQuery.py +0 -0
- {repoauditor-0.2.27 → repoauditor-0.2.29}/src/RepoAuditor/Plugins/GitHub/StandardQueryRequirements/AutoMerge.py +0 -0
- {repoauditor-0.2.27 → repoauditor-0.2.29}/src/RepoAuditor/Plugins/GitHub/StandardQueryRequirements/DefaultBranch.py +0 -0
- {repoauditor-0.2.27 → repoauditor-0.2.29}/src/RepoAuditor/Plugins/GitHub/StandardQueryRequirements/DeleteHeadBranches.py +0 -0
- {repoauditor-0.2.27 → repoauditor-0.2.29}/src/RepoAuditor/Plugins/GitHub/StandardQueryRequirements/DependabotSecurityUpdates.py +0 -0
- {repoauditor-0.2.27 → repoauditor-0.2.29}/src/RepoAuditor/Plugins/GitHub/StandardQueryRequirements/Description.py +0 -0
- {repoauditor-0.2.27 → repoauditor-0.2.29}/src/RepoAuditor/Plugins/GitHub/StandardQueryRequirements/Impl/StandardEnableRequirementImpl.py +0 -0
- {repoauditor-0.2.27 → repoauditor-0.2.29}/src/RepoAuditor/Plugins/GitHub/StandardQueryRequirements/Impl/StandardValueRequirementImpl.py +0 -0
- {repoauditor-0.2.27 → repoauditor-0.2.29}/src/RepoAuditor/Plugins/GitHub/StandardQueryRequirements/Impl/__init__.py +0 -0
- {repoauditor-0.2.27 → repoauditor-0.2.29}/src/RepoAuditor/Plugins/GitHub/StandardQueryRequirements/License.py +0 -0
- {repoauditor-0.2.27 → repoauditor-0.2.29}/src/RepoAuditor/Plugins/GitHub/StandardQueryRequirements/MergeCommit.py +0 -0
- {repoauditor-0.2.27 → repoauditor-0.2.29}/src/RepoAuditor/Plugins/GitHub/StandardQueryRequirements/MergeCommitMessage.py +0 -0
- {repoauditor-0.2.27 → repoauditor-0.2.29}/src/RepoAuditor/Plugins/GitHub/StandardQueryRequirements/Private.py +0 -0
- {repoauditor-0.2.27 → repoauditor-0.2.29}/src/RepoAuditor/Plugins/GitHub/StandardQueryRequirements/RebaseMergeCommit.py +0 -0
- {repoauditor-0.2.27 → repoauditor-0.2.29}/src/RepoAuditor/Plugins/GitHub/StandardQueryRequirements/SecretScanning.py +0 -0
- {repoauditor-0.2.27 → repoauditor-0.2.29}/src/RepoAuditor/Plugins/GitHub/StandardQueryRequirements/SecretScanningPushProtection.py +0 -0
- {repoauditor-0.2.27 → repoauditor-0.2.29}/src/RepoAuditor/Plugins/GitHub/StandardQueryRequirements/SquashCommitMerge.py +0 -0
- {repoauditor-0.2.27 → repoauditor-0.2.29}/src/RepoAuditor/Plugins/GitHub/StandardQueryRequirements/SquashMergeCommitMessage.py +0 -0
- {repoauditor-0.2.27 → repoauditor-0.2.29}/src/RepoAuditor/Plugins/GitHub/StandardQueryRequirements/SuggestUpdatingPullRequestBranches.py +0 -0
- {repoauditor-0.2.27 → repoauditor-0.2.29}/src/RepoAuditor/Plugins/GitHub/StandardQueryRequirements/SupportDiscussions.py +0 -0
- {repoauditor-0.2.27 → repoauditor-0.2.29}/src/RepoAuditor/Plugins/GitHub/StandardQueryRequirements/SupportIssues.py +0 -0
- {repoauditor-0.2.27 → repoauditor-0.2.29}/src/RepoAuditor/Plugins/GitHub/StandardQueryRequirements/SupportProjects.py +0 -0
- {repoauditor-0.2.27 → repoauditor-0.2.29}/src/RepoAuditor/Plugins/GitHub/StandardQueryRequirements/SupportWikis.py +0 -0
- {repoauditor-0.2.27 → repoauditor-0.2.29}/src/RepoAuditor/Plugins/GitHub/StandardQueryRequirements/TemplateRepository.py +0 -0
- {repoauditor-0.2.27 → repoauditor-0.2.29}/src/RepoAuditor/Plugins/GitHub/StandardQueryRequirements/WebCommitSignoff.py +0 -0
- {repoauditor-0.2.27 → repoauditor-0.2.29}/src/RepoAuditor/Plugins/GitHub/StandardQueryRequirements/__init__.py +0 -0
- {repoauditor-0.2.27 → repoauditor-0.2.29}/src/RepoAuditor/Plugins/GitHub/__init__.py +0 -0
- {repoauditor-0.2.27 → repoauditor-0.2.29}/src/RepoAuditor/Plugins/GitHubBase/Module.py +0 -0
- {repoauditor-0.2.27 → repoauditor-0.2.29}/src/RepoAuditor/Plugins/GitHubBase/__init__.py +0 -0
- {repoauditor-0.2.27 → repoauditor-0.2.29}/src/RepoAuditor/Plugins/GitHubCustomization/Impl/__init__.py +0 -0
- {repoauditor-0.2.27 → repoauditor-0.2.29}/src/RepoAuditor/Plugins/GitHubCustomization/Requirements/__init__.py +0 -0
- {repoauditor-0.2.27 → repoauditor-0.2.29}/src/RepoAuditor/Plugins/GitHubCustomization/__init__.py +0 -0
- {repoauditor-0.2.27 → repoauditor-0.2.29}/src/RepoAuditor/Plugins/GitHubCustomizationPlugin.py +0 -0
- {repoauditor-0.2.27 → repoauditor-0.2.29}/src/RepoAuditor/Plugins/GitHubPlugin.py +0 -0
- {repoauditor-0.2.27/src/RepoAuditor/Plugins/GitHubRulesets/Requirements → repoauditor-0.2.29/src/RepoAuditor/Plugins/GitHubRulesets/Impl}/__init__.py +0 -0
- {repoauditor-0.2.27/src/RepoAuditor/Plugins/GitHubRulesets → repoauditor-0.2.29/src/RepoAuditor/Plugins/GitHubRulesets/Requirements}/__init__.py +0 -0
- {repoauditor-0.2.27/src/RepoAuditor/Plugins → repoauditor-0.2.29/src/RepoAuditor/Plugins/GitHubRulesets}/__init__.py +0 -0
- /repoauditor-0.2.27/src/RepoAuditor/py.typed → /repoauditor-0.2.29/src/RepoAuditor/Plugins/__init__.py +0 -0
- {repoauditor-0.2.27 → repoauditor-0.2.29}/src/RepoAuditor/Requirement.py +0 -0
- {repoauditor-0.2.27 → repoauditor-0.2.29}/tests/CommandLineProcessor_UnitTest.py +0 -0
- {repoauditor-0.2.27 → repoauditor-0.2.29}/tests/EntryPoint_UnitTest.py +0 -0
- {repoauditor-0.2.27 → repoauditor-0.2.29}/tests/ExecuteModules_UnitTest.py +0 -0
- {repoauditor-0.2.27 → repoauditor-0.2.29}/tests/Module_UnitTest.py +0 -0
- {repoauditor-0.2.27 → repoauditor-0.2.29}/tests/Plugin_UnitTest.py +0 -0
- {repoauditor-0.2.27 → repoauditor-0.2.29}/tests/Plugins/GitHubCustomization_UnitTest.py +0 -0
- {repoauditor-0.2.27 → repoauditor-0.2.29}/tests/Plugins/GitHubModule_UnitTest.py +0 -0
- {repoauditor-0.2.27 → repoauditor-0.2.29}/tests/Plugins/GitHub_EndToEndTest.py +0 -0
- {repoauditor-0.2.27 → repoauditor-0.2.29}/tests/Plugins/__snapshots__/GitHub_EndToEndTest.ambr +0 -0
- {repoauditor-0.2.27 → repoauditor-0.2.29}/tests/Plugins/utilities.py +0 -0
- {repoauditor-0.2.27 → repoauditor-0.2.29}/tests/Query_UnitTest.py +0 -0
- {repoauditor-0.2.27 → repoauditor-0.2.29}/tests/Requirement_UnitTest.py +0 -0
- {repoauditor-0.2.27 → repoauditor-0.2.29}/tests/__snapshots__/ExecuteModules_UnitTest.ambr +0 -0
- {repoauditor-0.2.27 → repoauditor-0.2.29}/uv.lock +0 -0
|
@@ -39,7 +39,7 @@ repo_auditor = "RepoAuditor:EntryPoint.app"
|
|
|
39
39
|
[project.entry-points.RepoAuditor]
|
|
40
40
|
GitHubPlugin = "RepoAuditor.Plugins.GitHubPlugin"
|
|
41
41
|
GitHubCustomizationPlugin = "RepoAuditor.Plugins.GitHubCustomizationPlugin"
|
|
42
|
-
GitHubRulesetPlugin="RepoAuditor.Plugins.
|
|
42
|
+
GitHubRulesetPlugin="RepoAuditor.Plugins.GitHubRulesetsPlugin"
|
|
43
43
|
|
|
44
44
|
[build-system]
|
|
45
45
|
requires = ["hatchling"]
|
|
@@ -7,6 +7,8 @@
|
|
|
7
7
|
"""Contains the CustomizationQuery object."""
|
|
8
8
|
|
|
9
9
|
from typing import Any, Optional
|
|
10
|
+
from tempfile import TemporaryDirectory
|
|
11
|
+
from git import Repo
|
|
10
12
|
|
|
11
13
|
from dbrownell_Common.Types import override # type: ignore[import-untyped]
|
|
12
14
|
|
|
@@ -40,12 +42,22 @@ class CustomizationQuery(Query):
|
|
|
40
42
|
self,
|
|
41
43
|
module_data: dict[str, Any],
|
|
42
44
|
) -> Optional[dict[str, Any]]:
|
|
43
|
-
"""Get the data
|
|
44
|
-
response = module_data["session"].get("")
|
|
45
|
+
"""Get the repo data."""
|
|
45
46
|
|
|
46
|
-
|
|
47
|
-
|
|
47
|
+
# Clone the GitHub repository to a temp directory
|
|
48
|
+
github_url = module_data["url"]
|
|
49
|
+
branch = module_data.get("branch", "main")
|
|
50
|
+
temp_repo_dir = TemporaryDirectory()
|
|
51
|
+
Repo.clone_from(github_url, temp_repo_dir.name, branch=branch)
|
|
48
52
|
|
|
49
|
-
|
|
53
|
+
# Record the path and the temp directory for later cleanup
|
|
54
|
+
module_data["repo_dir"] = temp_repo_dir
|
|
50
55
|
|
|
51
56
|
return module_data
|
|
57
|
+
|
|
58
|
+
@override
|
|
59
|
+
def Cleanup(self, module_data: dict[str, Any]) -> None:
|
|
60
|
+
"""Clean up the cloned repository."""
|
|
61
|
+
repo_dir = module_data["repo_dir"]
|
|
62
|
+
repo_dir.cleanup()
|
|
63
|
+
del module_data
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
# -------------------------------------------------------------------------------
|
|
7
7
|
"""Contains the ExistsRequirementImpl object."""
|
|
8
8
|
|
|
9
|
+
from pathlib import Path
|
|
9
10
|
from typing import Any
|
|
10
11
|
from collections.abc import Sequence
|
|
11
12
|
|
|
@@ -69,28 +70,23 @@ class ExistsRequirementImpl(Requirement):
|
|
|
69
70
|
) -> Requirement.EvaluateImplResult:
|
|
70
71
|
if requirement_args[self.dynamic_arg_name]:
|
|
71
72
|
for location in self.possible_locations:
|
|
72
|
-
#
|
|
73
|
-
|
|
73
|
+
# Get full file path in temporary repo directory and check if it exists
|
|
74
|
+
# This checks both upper case and lower case variants
|
|
75
|
+
full_file_path = Path(query_data["repo_dir"].name) / Path(location)
|
|
74
76
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
# If response is a list, we have a directory
|
|
79
|
-
if isinstance(response_json, list):
|
|
80
|
-
for file in response_json:
|
|
81
|
-
# Check if there are any template files (.md or .yml)
|
|
82
|
-
if ".md" in file["path"] or ".yml" in file["path"]:
|
|
83
|
-
return Requirement.EvaluateImplResult(
|
|
84
|
-
EvaluateResult.Success,
|
|
85
|
-
f"File {self.github_file} found in directory {location}",
|
|
86
|
-
)
|
|
87
|
-
|
|
88
|
-
# If response is a dict, we have a single file
|
|
89
|
-
elif isinstance(response_json, dict):
|
|
77
|
+
if full_file_path.exists():
|
|
78
|
+
# If full_file_path is a directory, check if it isn't empty
|
|
79
|
+
if full_file_path.is_dir() and any(full_file_path.iterdir()):
|
|
90
80
|
return Requirement.EvaluateImplResult(
|
|
91
|
-
EvaluateResult.Success,
|
|
81
|
+
EvaluateResult.Success,
|
|
82
|
+
f"File found in {self.github_file} directory of the repository",
|
|
92
83
|
)
|
|
93
84
|
|
|
85
|
+
return Requirement.EvaluateImplResult(
|
|
86
|
+
EvaluateResult.Success,
|
|
87
|
+
f"{self.github_file} found in repository",
|
|
88
|
+
)
|
|
89
|
+
|
|
94
90
|
return Requirement.EvaluateImplResult(
|
|
95
91
|
EvaluateResult.Error,
|
|
96
92
|
f"No {self.github_file} file found.",
|
{repoauditor-0.2.27 → repoauditor-0.2.29}/src/RepoAuditor/Plugins/GitHubCustomization/Module.py
RENAMED
|
@@ -6,9 +6,6 @@
|
|
|
6
6
|
# -------------------------------------------------------------------------------
|
|
7
7
|
"""Contains the GitHubCustomizationModule object."""
|
|
8
8
|
|
|
9
|
-
from typing import Any
|
|
10
|
-
from dbrownell_Common.Types import override
|
|
11
|
-
|
|
12
9
|
from RepoAuditor.Module import ExecutionStyle
|
|
13
10
|
from RepoAuditor.Plugins.GitHubBase.Module import GitHubBaseModule
|
|
14
11
|
from RepoAuditor.Plugins.GitHubCustomization.CustomizationQuery import CustomizationQuery
|
|
@@ -27,8 +24,3 @@ class GitHubCustomizationModule(GitHubBaseModule):
|
|
|
27
24
|
],
|
|
28
25
|
requires_explicit_include=True,
|
|
29
26
|
)
|
|
30
|
-
|
|
31
|
-
@override
|
|
32
|
-
def Cleanup(self, dynamic_args: dict[str, Any]) -> None:
|
|
33
|
-
"""Clean up any resources created during execution."""
|
|
34
|
-
# No resources to clean up in the minimal implementation
|
|
@@ -20,14 +20,9 @@ class CodeOwners(ExistsRequirementImpl):
|
|
|
20
20
|
"exists",
|
|
21
21
|
"CODEOWNERS",
|
|
22
22
|
[
|
|
23
|
-
# Upper case variants
|
|
24
23
|
".github/CODEOWNERS",
|
|
25
24
|
"docs/CODEOWNERS",
|
|
26
25
|
"CODEOWNERS",
|
|
27
|
-
# Lower case variants
|
|
28
|
-
".github/codeowners",
|
|
29
|
-
"docs/codeowners",
|
|
30
|
-
"codeowners",
|
|
31
26
|
],
|
|
32
27
|
textwrap.dedent(
|
|
33
28
|
"""\
|
|
@@ -20,14 +20,9 @@ class Contributing(ExistsRequirementImpl):
|
|
|
20
20
|
"exists",
|
|
21
21
|
"CONTRIBUTING",
|
|
22
22
|
[
|
|
23
|
-
# Upper case variants
|
|
24
23
|
".github/CONTRIBUTING.md",
|
|
25
24
|
"docs/CONTRIBUTING.md",
|
|
26
25
|
"CONTRIBUTING.md",
|
|
27
|
-
# Lower case variants
|
|
28
|
-
".github/contributing.md",
|
|
29
|
-
"docs/contributing.md",
|
|
30
|
-
"contributing.md",
|
|
31
26
|
],
|
|
32
27
|
textwrap.dedent(
|
|
33
28
|
"""\
|
|
@@ -21,12 +21,8 @@ class IssueTemplates(ExistsRequirementImpl):
|
|
|
21
21
|
".github/ISSUE_TEMPLATE.md",
|
|
22
22
|
"docs/ISSUE_TEMPLATE.md",
|
|
23
23
|
"ISSUE_TEMPLATE.md",
|
|
24
|
-
"docs/issue_template.md",
|
|
25
|
-
".github/issue_template.md",
|
|
26
|
-
"issue_template.md",
|
|
27
24
|
# Directories
|
|
28
25
|
".github/ISSUE_TEMPLATE",
|
|
29
|
-
".github/issue_template",
|
|
30
26
|
],
|
|
31
27
|
"Add issue templates to your repository in the .github/ISSUE_TEMPLATE directory.",
|
|
32
28
|
"Issue templates help contributors create high-quality issues by providing a structured format.",
|
|
@@ -18,17 +18,11 @@ class PullRequestTemplate(ExistsRequirementImpl):
|
|
|
18
18
|
"exists",
|
|
19
19
|
"PULL_REQUESTS_TEMPLATE",
|
|
20
20
|
[
|
|
21
|
-
# Upper case variants
|
|
22
21
|
".github/PULL_REQUEST_TEMPLATE.md",
|
|
23
22
|
"docs/PULL_REQUEST_TEMPLATE.md",
|
|
24
23
|
"PULL_REQUEST_TEMPLATE.md",
|
|
25
|
-
# Lower case variants
|
|
26
|
-
".github/pull_request_template.md",
|
|
27
|
-
"docs/pull_request_template.md",
|
|
28
|
-
"pull_request_template.md",
|
|
29
24
|
# Directory with multiple templates
|
|
30
25
|
".github/PULL_REQUEST_TEMPLATE",
|
|
31
|
-
".github/pull_request_template",
|
|
32
26
|
],
|
|
33
27
|
"Create a pull request template file in one of these locations: .github/PULL_REQUEST_TEMPLATE.md, .github/pull_request_template.md, docs/PULL_REQUEST_TEMPLATE.md, or PULL_REQUEST_TEMPLATE.md",
|
|
34
28
|
"Pull request templates help standardize code contributions and expedite the review process by ensuring consistent PR format.",
|
|
@@ -20,14 +20,9 @@ class SecurityPolicy(ExistsRequirementImpl):
|
|
|
20
20
|
"exists",
|
|
21
21
|
"SECURITY",
|
|
22
22
|
[
|
|
23
|
-
# Upper case variants
|
|
24
23
|
".github/SECURITY.md",
|
|
25
24
|
"docs/SECURITY.md",
|
|
26
25
|
"SECURITY.md",
|
|
27
|
-
# Lower case variants
|
|
28
|
-
".github/security.md",
|
|
29
|
-
"docs/security.md",
|
|
30
|
-
"security.md",
|
|
31
26
|
],
|
|
32
27
|
textwrap.dedent(
|
|
33
28
|
"""\
|
repoauditor-0.2.29/src/RepoAuditor/Plugins/GitHubRulesets/Impl/EnableRulesetRequirementImpl.py
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
# -------------------------------------------------------------------------------
|
|
2
|
+
# |
|
|
3
|
+
# | Copyright (c) 2024 Scientific Software Engineering Center at Georgia Tech
|
|
4
|
+
# | Distributed under the MIT License.
|
|
5
|
+
# |
|
|
6
|
+
# -------------------------------------------------------------------------------
|
|
7
|
+
"""Contains the EnableRequirementImpl object."""
|
|
8
|
+
|
|
9
|
+
from typing import Any, Optional
|
|
10
|
+
from collections.abc import Callable
|
|
11
|
+
|
|
12
|
+
from dbrownell_Common.Types import override # type: ignore[import-untyped]
|
|
13
|
+
|
|
14
|
+
from RepoAuditor.Requirement import EvaluateResult, Requirement
|
|
15
|
+
from RepoAuditor.Plugins.GitHub.Impl.EnableRequirementImpl import EnableRequirementImpl
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
# ----------------------------------------------------------------------
|
|
19
|
+
class EnableRulesetRequirementImpl(EnableRequirementImpl):
|
|
20
|
+
"""Object that implements ruleset settings that can be enabled/disabled."""
|
|
21
|
+
|
|
22
|
+
# ----------------------------------------------------------------------
|
|
23
|
+
def __init__(
|
|
24
|
+
self,
|
|
25
|
+
name: str,
|
|
26
|
+
default_value: bool, # noqa: FBT001
|
|
27
|
+
dynamic_arg_name: str,
|
|
28
|
+
github_ruleset_type: str,
|
|
29
|
+
github_ruleset_value: str,
|
|
30
|
+
get_configuration_value_func: Callable[[dict[str, Any]], Optional[bool]],
|
|
31
|
+
resolution: str,
|
|
32
|
+
rationale: str,
|
|
33
|
+
subject: Optional[str] = None,
|
|
34
|
+
*,
|
|
35
|
+
requires_explicit_include: bool = False,
|
|
36
|
+
unset_set_terminology: tuple[str, str] = ("unchecked", "checked"),
|
|
37
|
+
missing_value_is_warning: bool = True,
|
|
38
|
+
) -> None:
|
|
39
|
+
super().__init__(
|
|
40
|
+
name=name,
|
|
41
|
+
default_value=default_value,
|
|
42
|
+
dynamic_arg_name=dynamic_arg_name,
|
|
43
|
+
github_settings_value=github_ruleset_value,
|
|
44
|
+
get_configuration_value_func=get_configuration_value_func,
|
|
45
|
+
resolution=resolution,
|
|
46
|
+
rationale=rationale,
|
|
47
|
+
subject=subject,
|
|
48
|
+
requires_explicit_include=requires_explicit_include,
|
|
49
|
+
unset_set_terminology=unset_set_terminology,
|
|
50
|
+
missing_value_is_warning=missing_value_is_warning,
|
|
51
|
+
)
|
|
52
|
+
|
|
53
|
+
self.github_ruleset_type = github_ruleset_type
|
|
54
|
+
|
|
55
|
+
# ----------------------------------------------------------------------
|
|
56
|
+
@override
|
|
57
|
+
def _EvaluateImpl(
|
|
58
|
+
self,
|
|
59
|
+
query_data: dict[str, Any],
|
|
60
|
+
requirement_args: dict[str, Any],
|
|
61
|
+
) -> Requirement.EvaluateImplResult:
|
|
62
|
+
if requirement_args[self.dynamic_arg_name]:
|
|
63
|
+
# Get the rules for the specified branch
|
|
64
|
+
rules = query_data.get("rules", [])
|
|
65
|
+
|
|
66
|
+
for rule in rules:
|
|
67
|
+
if self.get_configuration_value_func(rule):
|
|
68
|
+
# Get the ruleset associated with the rule
|
|
69
|
+
ruleset = rule["ruleset"]
|
|
70
|
+
return self.EvaluateImplResult(
|
|
71
|
+
EvaluateResult.Success,
|
|
72
|
+
f"Ruleset '{ruleset['name']}' enforces {self.github_ruleset_type}",
|
|
73
|
+
)
|
|
74
|
+
|
|
75
|
+
return self.EvaluateImplResult(
|
|
76
|
+
EvaluateResult.Error,
|
|
77
|
+
f"No active branch ruleset requiring {self.github_ruleset_type} found",
|
|
78
|
+
provide_resolution=True,
|
|
79
|
+
provide_rationale=True,
|
|
80
|
+
)
|
|
81
|
+
|
|
82
|
+
# Requirement flag not set so DoesNotApply
|
|
83
|
+
return Requirement.EvaluateImplResult(EvaluateResult.DoesNotApply, None)
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# -------------------------------------------------------------------------------
|
|
2
|
+
# |
|
|
3
|
+
# | Copyright (c) 2024 Scientific Software Engineering Center at Georgia Tech
|
|
4
|
+
# | Distributed under the MIT License.
|
|
5
|
+
# |
|
|
6
|
+
# -------------------------------------------------------------------------------
|
|
7
|
+
"""Contains the GitHubRulesetModule object."""
|
|
8
|
+
|
|
9
|
+
from RepoAuditor.Module import ExecutionStyle
|
|
10
|
+
from RepoAuditor.Plugins.GitHubBase.Module import GitHubBaseModule
|
|
11
|
+
from RepoAuditor.Plugins.GitHubRulesets.RulesetQuery import RulesetQuery
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class GitHubRulesetsModule(GitHubBaseModule):
|
|
15
|
+
"""Module that validates GitHub repository rulesets."""
|
|
16
|
+
|
|
17
|
+
def __init__(self) -> None:
|
|
18
|
+
super().__init__(
|
|
19
|
+
"GitHubRulesets",
|
|
20
|
+
"Validates GitHub repository rulesets.",
|
|
21
|
+
ExecutionStyle.Parallel,
|
|
22
|
+
[
|
|
23
|
+
RulesetQuery(),
|
|
24
|
+
],
|
|
25
|
+
requires_explicit_include=True,
|
|
26
|
+
)
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# -------------------------------------------------------------------------------
|
|
2
|
+
# |
|
|
3
|
+
# | Copyright (c) 2024 Scientific Software Engineering Center at Georgia Tech
|
|
4
|
+
# | Distributed under the MIT License.
|
|
5
|
+
# |
|
|
6
|
+
# -------------------------------------------------------------------------------
|
|
7
|
+
"""Contains the RequirePullRequests object."""
|
|
8
|
+
|
|
9
|
+
from RepoAuditor.Plugins.GitHubRulesets.Impl.EnableRulesetRequirementImpl import EnableRulesetRequirementImpl
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class RequirePullRequests(EnableRulesetRequirementImpl):
|
|
13
|
+
"""Require pull requests before merging to default branch."""
|
|
14
|
+
|
|
15
|
+
def __init__(self) -> None:
|
|
16
|
+
super().__init__(
|
|
17
|
+
name="RequirePullRequests",
|
|
18
|
+
default_value=False,
|
|
19
|
+
dynamic_arg_name="true",
|
|
20
|
+
github_ruleset_type="Pull Requests",
|
|
21
|
+
github_ruleset_value="pull_request",
|
|
22
|
+
get_configuration_value_func=lambda rule: rule.get("type", "") == "pull_request",
|
|
23
|
+
resolution="Enable pull request requirements in repository rulesets",
|
|
24
|
+
rationale="Pull request reviews help maintain code quality and collaboration",
|
|
25
|
+
)
|
repoauditor-0.2.29/src/RepoAuditor/Plugins/GitHubRulesets/Requirements/RequireSignedCommits.py
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# -------------------------------------------------------------------------------
|
|
2
|
+
# |
|
|
3
|
+
# | Copyright (c) 2024 Scientific Software Engineering Center at Georgia Tech
|
|
4
|
+
# | Distributed under the MIT License.
|
|
5
|
+
# |
|
|
6
|
+
# -------------------------------------------------------------------------------
|
|
7
|
+
"""Contains the RequireSignedCommits object."""
|
|
8
|
+
|
|
9
|
+
from RepoAuditor.Plugins.GitHubRulesets.Impl.EnableRulesetRequirementImpl import EnableRulesetRequirementImpl
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class RequireSignedCommits(EnableRulesetRequirementImpl):
|
|
13
|
+
"""Require signed commits."""
|
|
14
|
+
|
|
15
|
+
def __init__(self) -> None:
|
|
16
|
+
super().__init__(
|
|
17
|
+
name="RequireSignedCommits",
|
|
18
|
+
default_value=False,
|
|
19
|
+
dynamic_arg_name="true",
|
|
20
|
+
github_ruleset_type="Signed Commits",
|
|
21
|
+
github_ruleset_value="required_signatures",
|
|
22
|
+
get_configuration_value_func=lambda rule: rule.get("type", "") == "required_signatures",
|
|
23
|
+
resolution="Enable commit signing requirement in repository rulesets",
|
|
24
|
+
rationale="Signed commits ensure commit authenticity",
|
|
25
|
+
)
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# -------------------------------------------------------------------------------
|
|
2
|
+
# |
|
|
3
|
+
# | Copyright (c) 2024 Scientific Software Engineering Center at Georgia Tech
|
|
4
|
+
# | Distributed under the MIT License.
|
|
5
|
+
# |
|
|
6
|
+
# -------------------------------------------------------------------------------
|
|
7
|
+
"""Contains the RequireStatusChecks object."""
|
|
8
|
+
|
|
9
|
+
from RepoAuditor.Plugins.GitHubRulesets.Impl.EnableRulesetRequirementImpl import EnableRulesetRequirementImpl
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class RequireStatusChecks(EnableRulesetRequirementImpl):
|
|
13
|
+
"""Require status checks to pass before merging."""
|
|
14
|
+
|
|
15
|
+
def __init__(self) -> None:
|
|
16
|
+
super().__init__(
|
|
17
|
+
name="RequireStatusChecks",
|
|
18
|
+
default_value=False,
|
|
19
|
+
dynamic_arg_name="true",
|
|
20
|
+
github_ruleset_type="Status Checks",
|
|
21
|
+
github_ruleset_value="required_status_checks",
|
|
22
|
+
get_configuration_value_func=lambda rule: rule.get("type", "") == "required_status_checks",
|
|
23
|
+
resolution="Configure required status checks in repository rulesets",
|
|
24
|
+
rationale="Status checks ensure code quality and compatibility",
|
|
25
|
+
)
|
{repoauditor-0.2.27 → repoauditor-0.2.29}/src/RepoAuditor/Plugins/GitHubRulesets/RulesetQuery.py
RENAMED
|
@@ -45,9 +45,30 @@ class RulesetQuery(Query):
|
|
|
45
45
|
data, or None if an error occurs.
|
|
46
46
|
|
|
47
47
|
"""
|
|
48
|
-
|
|
49
|
-
|
|
48
|
+
branch = module_data.get("branch")
|
|
49
|
+
if branch is None:
|
|
50
|
+
# Get the default branch name
|
|
51
|
+
response = module_data["session"].get("")
|
|
52
|
+
|
|
53
|
+
response.raise_for_status()
|
|
54
|
+
response = response.json()
|
|
55
|
+
|
|
56
|
+
branch = response["default_branch"]
|
|
57
|
+
|
|
58
|
+
# Fetch ruleset data for a specific branch.
|
|
59
|
+
# This only returns active rules on the branch
|
|
60
|
+
rules_response = module_data["session"].get(f"rules/branches/{branch}")
|
|
61
|
+
|
|
62
|
+
rules_response.raise_for_status()
|
|
50
63
|
|
|
51
64
|
# Add ruleset data to module_data
|
|
52
|
-
module_data["
|
|
65
|
+
module_data["rules"] = rules_response.json()
|
|
66
|
+
|
|
67
|
+
# Also get the associated ruleset for each rule
|
|
68
|
+
for rule in module_data["rules"]:
|
|
69
|
+
ruleset_respone = module_data["session"].get(f"rulesets/{rule['ruleset_id']}")
|
|
70
|
+
ruleset_respone.raise_for_status()
|
|
71
|
+
ruleset = ruleset_respone.json()
|
|
72
|
+
rule["ruleset"] = ruleset
|
|
73
|
+
|
|
53
74
|
return module_data
|
|
@@ -11,10 +11,10 @@ import pluggy
|
|
|
11
11
|
from RepoAuditor import APP_NAME
|
|
12
12
|
from RepoAuditor.Module import Module
|
|
13
13
|
|
|
14
|
-
from RepoAuditor.Plugins.GitHubRulesets.Module import
|
|
14
|
+
from RepoAuditor.Plugins.GitHubRulesets.Module import GitHubRulesetsModule
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
@pluggy.HookimplMarker(APP_NAME)
|
|
18
18
|
def GetModule() -> Module:
|
|
19
19
|
"""Return GitHubRulesetModule Module."""
|
|
20
|
-
return
|
|
20
|
+
return GitHubRulesetsModule()
|
|
@@ -129,6 +129,14 @@ class Query(ABC):
|
|
|
129
129
|
max_num_threads=max_num_threads,
|
|
130
130
|
)
|
|
131
131
|
|
|
132
|
+
# ----------------------------------------------------------------------
|
|
133
|
+
def Cleanup(
|
|
134
|
+
self,
|
|
135
|
+
module_data: dict[str, Any],
|
|
136
|
+
) -> None:
|
|
137
|
+
"""Clean up any resources created during execution."""
|
|
138
|
+
del module_data
|
|
139
|
+
|
|
132
140
|
|
|
133
141
|
# ----------------------------------------------------------------------
|
|
134
142
|
class StatusInfo:
|
|
@@ -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.29"
|
|
File without changes
|
|
@@ -36,11 +36,18 @@ class TestCustomization:
|
|
|
36
36
|
|
|
37
37
|
def test_NoCodeOwners(self, pat_args, snapshot):
|
|
38
38
|
"""Test if a CODEOWNERS file does not exist in the repository."""
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
39
|
+
result = CliRunner().invoke(
|
|
40
|
+
app,
|
|
41
|
+
pat_args
|
|
42
|
+
+ [
|
|
43
|
+
"--GitHubCustomization-CodeOwners-exists",
|
|
44
|
+
"--GitHubCustomization-branch",
|
|
45
|
+
"test-GitHubCustomization",
|
|
46
|
+
],
|
|
47
|
+
)
|
|
48
|
+
|
|
49
|
+
assert result.exit_code == -1, result.output
|
|
50
|
+
assert ScrubDurationGithuburlAndSpaces(result.stdout) == snapshot
|
|
44
51
|
|
|
45
52
|
def test_Contributing(self, pat_args, snapshot):
|
|
46
53
|
"""Test if a CONTRIBUTING.md file exists in the repository."""
|
|
@@ -49,6 +56,21 @@ class TestCustomization:
|
|
|
49
56
|
assert result.exit_code == 0, result.output
|
|
50
57
|
assert ScrubDurationGithuburlAndSpaces(result.stdout) == snapshot
|
|
51
58
|
|
|
59
|
+
def test_NoContributing(self, pat_args, snapshot):
|
|
60
|
+
"""Test if a CONTRIBUTING file does not exist in the repository."""
|
|
61
|
+
result = CliRunner().invoke(
|
|
62
|
+
app,
|
|
63
|
+
pat_args
|
|
64
|
+
+ [
|
|
65
|
+
"--GitHubCustomization-Contributing-exists",
|
|
66
|
+
"--GitHubCustomization-branch",
|
|
67
|
+
"test-GitHubCustomization",
|
|
68
|
+
],
|
|
69
|
+
)
|
|
70
|
+
|
|
71
|
+
assert result.exit_code == -1, result.output
|
|
72
|
+
assert ScrubDurationGithuburlAndSpaces(result.stdout) == snapshot
|
|
73
|
+
|
|
52
74
|
def test_IssueTemplate(self, pat_args, snapshot):
|
|
53
75
|
"""Test if an Issue template file (e.g. ISSUE_TEMPLATE.md) exists in the repository."""
|
|
54
76
|
result = CliRunner().invoke(app, pat_args + ["--GitHubCustomization-IssueTemplates-exists"])
|
|
@@ -56,6 +78,21 @@ class TestCustomization:
|
|
|
56
78
|
assert result.exit_code == 0, result.output
|
|
57
79
|
assert ScrubDurationGithuburlAndSpaces(result.stdout) == snapshot
|
|
58
80
|
|
|
81
|
+
def test_NoIssueTemplate(self, pat_args, snapshot):
|
|
82
|
+
"""Test if no Issue template file exists in the repository."""
|
|
83
|
+
result = CliRunner().invoke(
|
|
84
|
+
app,
|
|
85
|
+
pat_args
|
|
86
|
+
+ [
|
|
87
|
+
"--GitHubCustomization-IssueTemplates-exists",
|
|
88
|
+
"--GitHubCustomization-branch",
|
|
89
|
+
"test-GitHubCustomization",
|
|
90
|
+
],
|
|
91
|
+
)
|
|
92
|
+
|
|
93
|
+
assert result.exit_code == -1, result.output
|
|
94
|
+
assert ScrubDurationGithuburlAndSpaces(result.stdout) == snapshot
|
|
95
|
+
|
|
59
96
|
def test_PullRequestTemplate(self, pat_args, snapshot):
|
|
60
97
|
"""Test if a Pull Request template file (e.g. PULL_REQUEST_TEMPLATE.md) exists in the repository."""
|
|
61
98
|
result = CliRunner().invoke(app, pat_args + ["--GitHubCustomization-PullRequestTemplate-exists"])
|
|
@@ -63,6 +100,21 @@ class TestCustomization:
|
|
|
63
100
|
assert result.exit_code == 0, result.output
|
|
64
101
|
assert ScrubDurationGithuburlAndSpaces(result.stdout) == snapshot
|
|
65
102
|
|
|
103
|
+
def test_NoPullRequestTemplate(self, pat_args, snapshot):
|
|
104
|
+
"""Test if no Pull Request template file exists in the repository."""
|
|
105
|
+
result = CliRunner().invoke(
|
|
106
|
+
app,
|
|
107
|
+
pat_args
|
|
108
|
+
+ [
|
|
109
|
+
"--GitHubCustomization-PullRequestTemplate-exists",
|
|
110
|
+
"--GitHubCustomization-branch",
|
|
111
|
+
"test-GitHubCustomization",
|
|
112
|
+
],
|
|
113
|
+
)
|
|
114
|
+
|
|
115
|
+
assert result.exit_code == -1, result.output
|
|
116
|
+
assert ScrubDurationGithuburlAndSpaces(result.stdout) == snapshot
|
|
117
|
+
|
|
66
118
|
def test_SecurityPolicy(self, pat_args, snapshot):
|
|
67
119
|
"""Test if a Security policy file (e.g. SECURITY.md) exists in the repository."""
|
|
68
120
|
result = CliRunner().invoke(app, pat_args + ["--GitHubCustomization-SecurityPolicy-exists"])
|
|
@@ -70,6 +122,21 @@ class TestCustomization:
|
|
|
70
122
|
assert result.exit_code == 0, result.output
|
|
71
123
|
assert ScrubDurationGithuburlAndSpaces(result.stdout) == snapshot
|
|
72
124
|
|
|
125
|
+
def test_NoSecurityPolicy(self, pat_args, snapshot):
|
|
126
|
+
"""Test if no Security policy file exists in the repository."""
|
|
127
|
+
result = CliRunner().invoke(
|
|
128
|
+
app,
|
|
129
|
+
pat_args
|
|
130
|
+
+ [
|
|
131
|
+
"--GitHubCustomization-SecurityPolicy-exists",
|
|
132
|
+
"--GitHubCustomization-branch",
|
|
133
|
+
"test-GitHubCustomization",
|
|
134
|
+
],
|
|
135
|
+
)
|
|
136
|
+
|
|
137
|
+
assert result.exit_code == -1, result.output
|
|
138
|
+
assert ScrubDurationGithuburlAndSpaces(result.stdout) == snapshot
|
|
139
|
+
|
|
73
140
|
|
|
74
141
|
# ----------------------------------------------------------------------
|
|
75
142
|
# ----------------------------------------------------------------------
|