blob: 2c40e04370b8e7301c82b1f9745eeae2c9d0ef23 [file] [log] [blame]
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
package main
import (
"regexp"
"go.chromium.org/luci/common/data/stringset"
)
var (
pythonVersionRegex = regexp.MustCompile("^\\d\\.\\d{1,2}.\\d{1,2}$")
gitVersionRegex = regexp.MustCompile("^\\d\\.\\d{1,2}.\\d{1,2}$")
knownCommands = stringset.NewFromSlice(
"gclient config",
"gclient diff",
"gclient fetch",
"gclient flatten",
"gclient getdep",
"gclient grep",
"gclient help",
"gclient metrics",
"gclient pack",
"gclient recurse",
"gclient revert",
"gclient revinfo",
"gclient root",
"gclient runhooks",
"gclient setdep",
"gclient status",
"gclient sync",
"gclient validate",
"gclient verify",
"git cache exists",
"git cache fetch",
"git cache populate",
"git cache unlock",
"git cache update-bootstrap",
"git cl archive",
"git cl baseurl",
"git cl checkout",
"git cl comments",
"git cl config",
"git cl creds-check",
"git cl commit",
"git cl description",
"git cl diff",
"git cl format",
"git cl help",
"git cl issue",
"git cl land",
"git cl lint",
"git cl owners",
"git cl patch",
"git cl presubmit",
"git cl set-close",
"git cl set-commit",
"git cl split",
"git cl status",
"git cl tree",
"git cl try",
"git cl try-results",
"git cl upload",
"git cl upstream",
"git cl web",
"git nav-downstream",
"git reparent-branch",
)
knownArguments = stringset.NewFromSlice(
"actual",
"add_owners_to",
"all",
"auto_rebase",
"batch",
"bot",
"branch",
"break_locks",
"break_repo_locks",
"bucket",
"bug",
"buildbucket_host",
"bypass_hooks",
"bypass_watchlists",
"cache_dir",
"category",
"cc",
"clang_format",
"clear",
"clobber",
"color",
"comment",
"comment_file",
"commit",
"config_filename",
"cq_dry_run",
"custom_vars",
"date_order",
"delete_unversioned_trees",
"dependencies",
"deps_file",
"deps_os",
"depth",
"description_file",
"diff",
"display",
"dry_run",
"edit_description",
"enable_auto_submit",
"enable_metrics",
"fast",
"field",
"filter",
"fixed",
"force",
"full",
"gc_aggressive",
"getdep_revisions",
"git_completion_helper",
"hashtags",
"head",
"ignore",
"ignore_current",
"ignore_dep_type",
"ignore_locks",
"ignore_self",
"issue",
"jobs",
"js",
"json",
"json_file",
"lock_timeout",
"maxjobs",
"merge",
"message",
"message_file",
"name",
"new_description",
"newbranch",
"no_add_changeid",
"no_autocc",
"no_bootstrap",
"no_branch_color",
"no_clang_format",
"no_color",
"no_fetch_tags",
"no_history",
"no_nag_max",
"no_progress",
"no_python",
"no_squash",
"nocommit",
"nohooks",
"noprehooks",
"notags",
"null",
"output_config_file",
"output_deps",
"output_deps_files",
"output_json",
"parallel",
"patch_refs",
"patchset",
"pattern",
"pin_all_deps",
"prepend_dir",
"preserve_tryjobs",
"presubmit",
"print_master",
"private",
"process_all_deps",
"project",
"properties",
"prune",
"publish",
"pull",
"push_options",
"python",
"quiet",
"readable",
"realm",
"reapply",
"rebase_patch_ref",
"ref",
"reset",
"reset_fetch_config",
"reset_patch_ref",
"resultdb",
"retry_failed",
"reverse",
"reviewers",
"revision",
"revisions",
"scm",
"send_mail",
"set_bot_commit",
"setdep_revisions",
"shallow",
"show_all",
"skip_populate",
"skip_title",
"snapshot",
"spec",
"squash",
"stat",
"target_branch",
"tbrs",
"timeout",
"title",
"topic",
"unmanaged",
"upload",
"upstream",
"use_commit_queue",
"vars",
"verbose",
"with_branch_heads",
"with_tags",
)
knownProjectURLs = stringset.NewFromSlice(
"https://chrome-internal.googlesource.com/chrome/ios_internal",
"https://chrome-internal.googlesource.com/infra/infra_internal",
"https://chromium.googlesource.com/breakpad/breakpad",
"https://chromium.googlesource.com/chromium/src",
"https://chromium.googlesource.com/chromium/tools/depot_tools",
"https://chromium.googlesource.com/crashpad/crashpad",
"https://chromium.googlesource.com/external/gyp",
"https://chromium.googlesource.com/external/naclports",
"https://chromium.googlesource.com/infra/goma/client",
"https://chromium.googlesource.com/infra/infra",
"https://chromium.googlesource.com/native_client/",
"https://chromium.googlesource.com/syzygy",
"https://chromium.googlesource.com/v8/v8",
"https://dart.googlesource.com/sdk",
"https://pdfium.googlesource.com/pdfium",
"https://skia.googlesource.com/buildbot",
"https://skia.googlesource.com/skia",
"https://webrtc.googlesource.com/src",
)
knownOSs = stringset.NewFromSlice(
"android",
"fuchsia",
"ios",
"linux",
"mac",
"win",
)
knownArchs = stringset.NewFromSlice(
"AMD64",
"arm",
"arm64",
"ia32",
"mips",
"ppc",
"s390",
"x64",
"x86",
)
knownHTTPHosts = stringset.NewFromSlice(
"chrome-internal-review.googlesource.com",
"chromium-review.googlesource.com",
"dart-review.googlesource.com",
"eu1-mirror-chromium-review.googlesource.com",
"pdfium-review.googlesource.com",
"skia-review.googlesource.com",
"us1-mirror-chromium-review.googlesource.com",
"us2-mirror-chromium-review.googlesource.com",
"us3-mirror-chromium-review.googlesource.com",
"webrtc-review.googlesource.com",
)
knownHTTPMethods = stringset.NewFromSlice(
"DELETE",
"GET",
"PATCH",
"POST",
"PUT",
)
knownHTTPPaths = stringset.NewFromSlice(
"accounts",
"changes",
"changes/abandon",
"changes/comments",
"changes/detail",
"changes/edit",
"changes/message",
"changes/restore",
"changes/reviewers",
"changes/revisions/commit",
"changes/revisions/review",
"changes/submit",
"projects/branches",
)
knownHTTPArguments = stringset.NewFromSlice(
"ALL_REVISIONS",
"CURRENT_COMMIT",
"CURRENT_REVISION",
"DETAILED_ACCOUNTS",
"LABELS",
)
knownSubCommands = stringset.NewFromSlice(
"git push",
"presubmit",
)
knownSubCommandArguments = stringset.NewFromSlice(
"cc",
"hashtag",
"l=Auto-Submit+1",
"l=Code-Review+1",
"l=Code-Review+2",
"l=Commit-Queue+1",
"l=Commit-Queue+2",
"label",
"m",
"notify=ALL",
"notify=NONE",
"private",
"r",
"ready",
"topic",
"wip",
)
)