Tools apicovered and apiunused
Description
Checks for coverage/usage of the go-gitlab package
Related to #547 (closed)
Fun weekend project for estimating our API coverage, relative to the go-gitlab API. I know it's a niche tool, which I don't mind removing from the codebase in the future.
Usage
- Run
make apicoveredto output a table summary. - Run
make apiunusedto output JSON detailing every type, func, method, and field found in the go-gitlab package that we do not use.
Example apicovered
make apicovered
Filename Coverage Lines
-------- -------- -----
event_parsing.go 0% 0/16
issue_links.go 0% 0/11
markdown.go 0% 0/8
pages.go 0% 0/2
plan_limits.go 0% 0/15
discussions.go 4% 3/63
geo_nodes.go 4% 8/195
settings.go 4% 7/172
sidekiq_metrics.go 4% 1/24
notifications.go 7% 2/26
epic_issues.go 8% 1/12
merge_requests.go 10% 16/154
time_stats.go 11% 1/9
boards.go 12% 4/32
group_boards.go 13% 4/30
validate.go 13% 2/15
issues.go 16% 20/118
project_managed_licenses.go 16% 2/12
search.go 16% 6/36
generic_packages.go 17% 5/28
jobs.go 17% 10/57
applications.go 18% 3/16
container_registry.go 18% 6/33
event_webhook_types.go 18% 37/203
pages_domains.go 18% 4/22
notes.go 19% 15/77
issues_statistics.go 20% 6/30
pipelines.go 20% 16/77
audit_events.go 21% 7/33
license.go 21% 6/28
award_emojis.go 23% 9/39
broadcast_messages.go 23% 4/17
environments.go 23% 5/21
todos.go 23% 14/60
commits.go 24% 27/111
deployments.go 25% 9/35
group_wikis.go 25% 4/16
license_templates.go 25% 5/20
repositories.go 25% 10/40
wikis.go 25% 4/16
group_milestones.go 26% 9/34
project_snippets.go 26% 4/15
types.go 27% 40/146
avatar.go 28% 2/7
ci_yml_templates.go 28% 2/7
gitignore_templates.go 28% 2/7
packages.go 28% 8/28
milestones.go 29% 9/31
releaselinks.go 29% 5/17
resource_state_events.go 30% 4/13
runners.go 30% 18/59
access_requests.go 31% 6/19
events.go 31% 11/35
protected_environments.go 31% 5/16
tags.go 32% 8/25
group_import_export.go 33% 3/9
merge_request_approvals.go 33% 24/72
namespaces.go 34% 10/29
epics.go 37% 20/53
event_systemhook_types.go 37% 13/35
releases.go 37% 13/35
topics.go 37% 6/16
gitlab.go 39% 48/123
invites.go 40% 8/20
resource_label_events.go 41% 10/24
snippets.go 44% 13/29
users.go 44% 65/147
feature_flags.go 45% 5/11
services.go 45% 66/145
system_hooks.go 45% 11/24
external_status_checks.go 46% 7/15
repository_submodules.go 47% 10/21
branches.go 48% 12/25
labels.go 48% 15/31
repository_files.go 48% 21/43
version.go 50% 3/6
project_import_export.go 51% 16/31
projects.go 58% 194/331
pipeline_triggers.go 60% 14/23
deploy_keys.go 61% 11/18
group_badges.go 61% 13/21
groups.go 62% 72/115
keys.go 62% 5/8
group_labels.go 64% 9/14
protected_tags.go 64% 9/14
group_hooks.go 65% 17/26
project_members.go 66% 10/15
project_mirror.go 66% 12/18
group_members.go 72% 27/37
project_badges.go 72% 13/18
custom_attributes.go 75% 12/16
freeze_periods.go 75% 12/16
pipeline_schedules.go 79% 27/34
deploy_tokens.go 80% 16/20
instance_variables.go 81% 13/16
group_variables.go 82% 14/17
protected_branches.go 83% 25/30
project_clusters.go 84% 32/38
instance_clusters.go 85% 17/20
group_clusters.go 87% 28/32
project_access_tokens.go 88% 16/18
project_variables.go 94% 16/17
client_options.go 100% 1/1
request_options.go 100% 1/1
--- --- ---
Total 34% 1451/4266
Example apiunused
make apiunused | jq '."projects.go".fields'
[
"NameRegexKeep",
"Image",
"ServiceDeskAddress",
"EmptyRepo",
"HTMLURL",
"Repository",
"AutocloseReferencedIssues",
"ForkedToProjectID",
"ActionName",
"UserName",
"After",
"IDBefore",
"ComplianceFrameworks",
"ProjectID",
"MergeRequestsAccessLevel",
"License",
"GitSSHURL",
"SharedMinAccessLevel",
"TargetTitle",
"ExternalAuthorizationClassificationLabel",
"RepositoryStorage",
"SuggestionCommitMessage",
"Filename",
"ContainerExpirationPolicyAttributes",
"ApproverGroupIDs",
"TargetType",
"ContainerRegistryAccessLevel",
"BuildsAccessLevel",
"Data",
"IssuesAccessLevel",
"NameRegex",
"NameRegexDelete",
"RequirementsAccessLevel",
"Cadence",
"WikiChecksumFailed",
"Avatar",
"LastActivityBefore",
"LastActivityAfter",
"TargetID",
"WikiAccessLevel",
"Topic",
"AutoCancelPendingPipelines",
"OperationsAccessLevel",
"SkipGroups",
"ForkedFromProjectID",
"AuthorID",
"ContainsHiddenGroups",
"CommitCount",
"RepositoryChecksumFailed",
"ReleasesEvents",
"SourceURL",
"CIDefaultGitDepth",
"CIForwardDeploymentEnabled",
"Markdown",
"Topics",
"LicenseURL",
"Before",
"SnippetsAccessLevel",
"EligibleApprovers",
"BuildTimeout",
"AutoDevopsDeployStrategy",
"ServiceDeskEnabled",
"Commits",
"StorageSize",
"BuildGitStrategy",
"AuthorUsername",
"ApproverGroups",
"LfsObjectsSize",
"TotalCommitsCount",
"Alt",
"NextRunAt",
"RepositoryAccessLevel",
"Approvers",
"ForkingAccessLevel",
"PrintingMergeRequestLinkEnabled",
"GitHTTPURL",
"RequirePasswordToApprove",
"OlderThan",
"RepositorySize",
"JobArtifactsSize",
"SharedVisiableOnly",
"RuleType",
"SSHURL",
"Nickname",
"IDAfter",
"KeepN",
"ApproverIDs",
"SearchNamespaces",
"HTTPURL",
"ShowDefaultAwardEmojis",
"Homepage",
"ContainerExpirationPolicy"
]
PR Checklist
-
Resource attributes match 1:1 the names and structure of the API resource in the GitLab API documentation. -
Examples are updated with: - A *.tf file for the resource/s with at least one usage example
- A *.sh file for the resource/s with an import example (if applicable)
-
New resources have at minimum a basic test with three steps: - Create the resource
- Update the attributes
- Import the resource
-
No new //lintignorecomments that came from copied code. Linter rules are meant to be enforced on new code.