AP-5836 Improve API - rename StringValidatedByRegexp

replace existing usages

GitOrigin-RevId: 6b3d710a6cd2a1c4a074ac467dbbcf51bd12bc98
This commit is contained in:
Daniil.Bubnov
2023-11-20 11:59:56 +01:00
committed by intellij-monorepo-bot
parent 5a7c3f1402
commit c175720bac
16 changed files with 21 additions and 21 deletions

View File

@@ -20,7 +20,7 @@ public final class EAPUsageCollector extends ApplicationUsagesCollector {
private static final EventLogGroup GROUP = new EventLogGroup("user.advanced.info", 5);
private static final EventId1<BuildType> BUILD = GROUP.registerEvent("build", EventFields.Enum("value", BuildType.class));
private static final EnumEventField<LicenceType> LICENSE_VALUE = EventFields.Enum("value", LicenceType.class);
private static final StringEventField METADATA = EventFields.StringValidatedByRegexp("metadata", "license_metadata");
private static final StringEventField METADATA = EventFields.StringValidatedByRegexpReference("metadata", "license_metadata");
private static final EventField<String> LOGIN_HASH = EventFields.AnonymizedField("login_hash");
private static final BooleanEventField IS_JB_TEAM = EventFields.Boolean("is_jb_team");
private static final VarargEventId LICENSING = GROUP.registerVarargEvent("licencing", LICENSE_VALUE, METADATA, LOGIN_HASH, IS_JB_TEAM);

View File

@@ -5,7 +5,7 @@ import com.intellij.internal.statistic.beans.MetricEvent
import com.intellij.internal.statistic.eventLog.EventLogGroup
import com.intellij.internal.statistic.eventLog.events.EventFields
import com.intellij.internal.statistic.eventLog.events.EventFields.String
import com.intellij.internal.statistic.eventLog.events.EventFields.StringValidatedByRegexp
import com.intellij.internal.statistic.eventLog.events.EventFields.StringValidatedByRegexpReference
import com.intellij.internal.statistic.eventLog.events.EventFields.Version
import com.intellij.internal.statistic.service.fus.collectors.ApplicationUsagesCollector
import com.intellij.openapi.util.SystemInfo
@@ -39,13 +39,13 @@ internal class OsDataCollector : ApplicationUsagesCollector() {
private val GROUP = EventLogGroup("system.os", 16)
private val OS_NAME = String("name", OS_NAMES)
private val OS_LANG = String("locale", LOCALES)
private val OS_TZ = StringValidatedByRegexp("time_zone", "time_zone")
private val OS_TZ = StringValidatedByRegexpReference("time_zone", "time_zone")
private val OS_SHELL = String("shell", SHELLS)
private val OS = GROUP.registerVarargEvent("os.name", OS_NAME, Version, OS_LANG, OS_TZ, OS_SHELL)
@ApiStatus.ScheduledForRemoval(inVersion = "2024.1")
@Suppress("MissingDeprecatedAnnotationOnScheduledForRemovalApi", "ScheduledForRemovalWithVersion")
private val TIMEZONE = GROUP.registerEvent("os.timezone", StringValidatedByRegexp("value", "time_zone")) // backward compatibility
private val LINUX = GROUP.registerEvent("linux", String("distro", DISTROS), StringValidatedByRegexp("release", "version"), EventFields.Boolean("wsl"))
private val TIMEZONE = GROUP.registerEvent("os.timezone", StringValidatedByRegexpReference("value", "time_zone")) // backward compatibility
private val LINUX = GROUP.registerEvent("linux", String("distro", DISTROS), StringValidatedByRegexpReference("release", "version"), EventFields.Boolean("wsl"))
private val WINDOWS = GROUP.registerEvent("windows", EventFields.Long("build"))
override fun getGroup(): EventLogGroup = GROUP

View File

@@ -19,7 +19,7 @@ import com.intellij.testFramework.fixtures.BasePlatformTestCase
class EventSchemeBuilderTest : BasePlatformTestCase() {
fun `test generate string field validated by regexp`() {
doFieldTest(EventFields.StringValidatedByRegexp("count", "integer"), hashSetOf("{regexp#integer}"))
doFieldTest(EventFields.StringValidatedByRegexpReference("count", "integer"), hashSetOf("{regexp#integer}"))
}
fun `test generate string field validated by enum`() {

View File

@@ -107,7 +107,7 @@ internal class GradleSettingsCollector : ProjectUsagesCollector() {
private val DISTRIBUTION_TYPE = GROUP.registerEvent("distributionType",
EventFields.Enum("value", DistributionType::class.java) { it.name.lowercase() })
private val VERSION_FIELD = EventFields.StringValidatedByRegexp("value", "version")
private val VERSION_FIELD = EventFields.StringValidatedByRegexpReference("value", "version")
private val GRADLE_VERSION = GROUP.registerEvent("gradleVersion", VERSION_FIELD)
private val PREFERRED_TEST_RUNNER = GROUP.registerEvent("preferredTestRunner",
EventFields.Enum("value", TestRunner::class.java) { it.name.lowercase() })

View File

@@ -48,7 +48,7 @@ object KotlinJ2KOnboardingFUSCollector : CounterUsagesCollector() {
internal val pluginVersion = getPluginInfoById(KotlinIdePlugin.id).version
internal val buildSystemField = EventFields.Enum<KotlinJ2KOnboardingBuildSystem>("build_system")
internal val buildSystemVersionField = EventFields.StringValidatedByRegexp("build_system_version", "version")
internal val buildSystemVersionField = EventFields.StringValidatedByRegexpReference("build_system_version", "version")
internal val sessionIdField = EventFields.Int("onboarding_session_id")
internal val canAutoConfigureField = EventFields.Boolean("can_auto_configure")
internal val isAutoConfigurationField = EventFields.Boolean("is_auto_configuration")

View File

@@ -20,7 +20,7 @@ object KotlinLanguageFeaturesFUSCollector : CounterUsagesCollector() {
private val GROUP = EventLogGroup("kotlin.ide.inspections", 2)
val inspectionTypeField = EventFields.Enum<KotlinLanguageFeatureInspectionType>("inspection_type") { it.name.lowercase() }
val kotlinLanguageVersionField = EventFields.StringValidatedByRegexp("kotlin_language_version", "version_lang_api")
val kotlinLanguageVersionField = EventFields.StringValidatedByRegexpReference("kotlin_language_version", "version_lang_api")
val hasDeprecatedFeatureField = EventFields.Boolean("has_deprecated_feature")
val hasNewFeatureField = EventFields.Boolean("has_new_feature")

View File

@@ -12,8 +12,8 @@ object KotlinMigrationProjectFUSCollector : CounterUsagesCollector() {
private val GROUP = EventLogGroup("kotlin.ide.migrationTool", 3)
private val oldLanguageVersion = EventFields.StringValidatedByRegexp("old_language_version", "version_lang_api")
private val oldApiVersion = EventFields.StringValidatedByRegexp("old_api_version", "version_lang_api")
private val oldLanguageVersion = EventFields.StringValidatedByRegexpReference("old_language_version", "version_lang_api")
private val oldApiVersion = EventFields.StringValidatedByRegexpReference("old_api_version", "version_lang_api")
private val pluginInfo = EventFields.PluginInfo
private val notificationEvent = GROUP.registerVarargEvent(

View File

@@ -61,7 +61,7 @@ internal class ProjectConfigurationCollector : ProjectUsagesCollector() {
private val systemField = EventFields.String("system", listOf("JPS", "Maven", "Gradle", "unknown"))
private val platformField = EventFields.String("platform", composePlatformFields())
private val languageLevelField = EventFields.StringValidatedByRegexp("languageLevel", "version")
private val languageLevelField = EventFields.StringValidatedByRegexpReference("languageLevel", "version")
private val isMPPBuild = EventFields.Boolean("isMPP")
private val pluginInfoField = EventFields.PluginInfo

View File

@@ -45,7 +45,7 @@ object MavenDependencyInsertionCollector : CounterUsagesCollector() {
}
private val packageIdField = EventFields.StringValidatedByCustomRule(PACKAGE_ID, TopPackageIdValidationRule::class.java)
private val packageVersionField = EventFields.StringValidatedByRegexp(PACKAGE_VERSION, regexpRef = "version")
private val packageVersionField = EventFields.StringValidatedByRegexpReference(PACKAGE_VERSION, regexpRef = "version")
private val completionPrefixLengthField = EventFields.Int(COMPLETION_PREFIX_LENGTH)
private val selectedLookupIndexField = EventFields.Int(SELECTED_LOOKUP_INDEX)
private val buildSystemField = EventFields.Enum<BuildSystem>(BUILD_SYSTEM)

View File

@@ -128,7 +128,7 @@ class MavenSettingsCollector : ProjectUsagesCollector() {
private val SKIP_TESTS = GROUP.registerEvent("skipTests", EventFields.Enabled)
private val HAS_RUNNER_MAVEN_PROPERTIES = GROUP.registerEvent("hasRunnerMavenProperties", EventFields.Enabled)
private val VERSION_FIELD = EventFields.StringValidatedByRegexp("value", "version")
private val VERSION_FIELD = EventFields.StringValidatedByRegexpReference("value", "version")
private val CHECKSUM_POLICY = GROUP.registerEvent("checksumPolicy", EventFields.Enum("value",
MavenExecutionOptions.ChecksumPolicy::class.java) { it.name.lowercase() })

View File

@@ -48,8 +48,8 @@ class PackageSearchEventsLogger : CounterUsagesCollector() {
// FIELDS
private val buildSystemField = EventFields.Class(FUSGroupIds.MODULE_OPERATION_PROVIDER_CLASS)
private val packageIdField = EventFields.StringValidatedByCustomRule(FUSGroupIds.PACKAGE_ID, TopPackageIdValidationRule::class.java)
private val packageVersionField = EventFields.StringValidatedByRegexp(FUSGroupIds.PACKAGE_VERSION, regexpRef = "version")
private val packageFromVersionField = EventFields.StringValidatedByRegexp(FUSGroupIds.PACKAGE_FROM_VERSION, regexpRef = "version")
private val packageVersionField = EventFields.StringValidatedByRegexpReference(FUSGroupIds.PACKAGE_VERSION, regexpRef = "version")
private val packageFromVersionField = EventFields.StringValidatedByRegexpReference(FUSGroupIds.PACKAGE_FROM_VERSION, regexpRef = "version")
private val repositoryIdField = EventFields.Enum<FUSGroupIds.IndexedRepositories>(FUSGroupIds.REPOSITORY_ID)
private val repositoryUrlField = EventFields.String(FUSGroupIds.REPOSITORY_URL, allowedValues = FUSGroupIds.indexedRepositoryUrls)
private val repositoryUsesCustomUrlField = EventFields.Boolean(FUSGroupIds.REPOSITORY_USES_CUSTOM_URL)

View File

@@ -30,5 +30,5 @@ private class SvnStatisticsCollector : ProjectUsagesCollector() {
private val GROUP = EventLogGroup("svn.configuration", 2)
private val WORKING_COPY = GROUP.registerEvent("working.copy",
EventFields.StringValidatedByRegexp("format", "version"))
EventFields.StringValidatedByRegexpReference("format", "version"))
}

View File

@@ -29,7 +29,7 @@ object TerminalUsageTriggerCollector : CounterUsagesCollector() {
TERMINAL_COMMAND_HANDLER_FIELD,
RUN_ANYTHING_PROVIDER_FIELD)
private val localExecEvent = GROUP.registerEvent("local.exec",
EventFields.StringValidatedByRegexp("os-version", "version"),
EventFields.StringValidatedByRegexpReference("os-version", "version"),
EventFields.String("shell", KNOWN_SHELLS.toList()))
private val commandExecutedEvent = GROUP.registerEvent("terminal.command.executed",

View File

@@ -39,7 +39,7 @@ class PySdkToInstallCollector : CounterUsagesCollector() {
private val GROUP = EventLogGroup("python.sdk.install.events", 3)
private val versionField = EventFields.StringValidatedByRegexp("py_version", "version")
private val versionField = EventFields.StringValidatedByRegexpReference("py_version", "version")
private val osField = EventFields.Enum("os", OS::class.java)

View File

@@ -84,4 +84,4 @@ internal class PyPackageVersionUsagesCollector : ProjectUsagesCollector() {
}
val PACKAGE_FIELD = EventFields.StringValidatedByEnum("package", "python_packages")
val PACKAGE_VERSION_FIELD = EventFields.StringValidatedByRegexp("package_version", "version")
val PACKAGE_VERSION_FIELD = EventFields.StringValidatedByRegexpReference("package_version", "version")

View File

@@ -57,7 +57,7 @@ fun registerPythonSpecificEvent(group: EventLogGroup, eventId: String, vararg ex
*extraFields)
}
val PYTHON_VERSION = EventFields.StringValidatedByRegexp("python_version", "version")
val PYTHON_VERSION = EventFields.StringValidatedByRegexpReference("python_version", "version")
val PYTHON_IMPLEMENTATION = EventFields.String("python_implementation", listOf("PyPy", "Jython", "Python"))