1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-11-21 22:32:41 +01:00

Catch more product names in "pht()", and replace newly matched Arcanist product names

Summary:
Ref T13658. The lint rule called "getStringLiteralValue()", which produces string literals for fewer nodes than "evalStatic()".

Switch to "evalStatic()", then fix new warnings.

Test Plan:
This test plan is non-exhaustive.

  - Ran "arc lint --everything --output summary" to generate new warnings.

Maniphest Tasks: T13658

Differential Revision: https://secure.phabricator.com/D21776
This commit is contained in:
epriestley 2022-04-25 12:49:46 -07:00
parent 93cf13cdb9
commit da206314cf
10 changed files with 42 additions and 43 deletions

View file

@ -125,8 +125,8 @@ class PhutilLibraryTestCase extends PhutilTestCase {
$failures[] = pht(
'Class "%s" implements method "%s" with the wrong visibility. '.
'The method has visibility "%s", but it is defined in parent '.
'"%s" with visibility "%s". In Phabricator, a method which '.
'overrides another must always have the same visibility.',
'"%s" with visibility "%s". A method which overrides another '.
'must always have the same visibility.',
$class_name,
$method_name,
$this->getVisibility($method),

View file

@ -7,11 +7,11 @@ final class ArcanistSettings extends Phobject {
'default' => array(
'type' => 'string',
'help' => pht(
'The URI of a Phabricator install to connect to by default, if '.
'%s is run in a project without a Phabricator URI or run outside '.
'The URI of a server to connect to by default, if '.
'%s is run in a project without a configured URI or run outside '.
'of a project.',
'arc'),
'example' => '"http://phabricator.example.com/"',
'example' => '"http://devtools.example.com/"',
),
'base' => array(
'type' => 'string',
@ -35,7 +35,7 @@ final class ArcanistSettings extends Phobject {
'type' => 'string',
'example' => '"X"',
'help' => pht(
'Associate the working copy with a specific Phabricator repository. '.
'Associate the working copy with a specific repository. '.
'Normally, %s can figure this association out on its own, but if '.
'your setup is unusual you can use this option to tell it what the '.
'desired value is.',
@ -44,10 +44,9 @@ final class ArcanistSettings extends Phobject {
'phabricator.uri' => array(
'type' => 'string',
'legacy' => 'conduit_uri',
'example' => '"https://phabricator.mycompany.com/"',
'example' => '"https://devtools.example.com/"',
'help' => pht(
'Associates this working copy with a specific installation of '.
'Phabricator.'),
'Associates this working copy with a specific server.'),
),
'lint.engine' => array(
'type' => 'string',
@ -96,8 +95,8 @@ final class ArcanistSettings extends Phobject {
'https.cabundle' => array(
'type' => 'string',
'help' => pht(
"Path to a custom CA bundle file to be used for arcanist's cURL ".
"calls. This is used primarily when your conduit endpoint is ".
"Path to a custom CA bundle file to be used for cURL calls. ".
"This is used primarily when your conduit endpoint is ".
"behind HTTPS signed by your organization's internal CA."),
'example' => 'support/yourca.pem',
),
@ -118,7 +117,7 @@ final class ArcanistSettings extends Phobject {
'Whether %s should permit the automatic stashing of changes in the '.
'working directory when requiring a clean working copy. This option '.
'should only be used when users understand how to restore their '.
'working directory from the local stash if an Arcanist operation '.
'working directory from the local stash if an operation '.
'causes an unrecoverable error.',
'arc'),
'default' => false,

View file

@ -139,10 +139,10 @@ final class ArcanistDifferentialCommitMessage extends Phobject {
throw new ArcanistUsageException(
pht(
'Invalid "Differential Revision" field in commit message. This field '.
'should have a revision identifier like "%s" or a Phabricator URI '.
'should have a revision identifier like "%s" or a server URI '.
'like "%s", but has "%s".',
'D123',
'https://phabricator.example.com/D123',
'https://devtools.example.com/D123',
$revision_value));
}

View file

@ -64,11 +64,11 @@ final class ArcanistCSharpLinter extends ArcanistLinter {
throw new Exception(
pht(
"In order to keep StyleCop integration with IDEs and other tools ".
"consistent with Arcanist results, you aren't permitted to ".
"consistent with lint results, you aren't permitted to ".
"disable StyleCop rules within '%s'. Instead configure the ".
"severity using the StyleCop settings dialog (usually accessible ".
"from within your IDE). StyleCop settings for your project will ".
"be used when linting for Arcanist.",
"be used when linting.",
'.arclint'));
}
}
@ -132,8 +132,8 @@ final class ArcanistCSharpLinter extends ArcanistLinter {
} else if ($ver > self::SUPPORTED_VERSION) {
throw new Exception(
pht(
'Arcanist does not support this version of %s (it is newer). '.
'You can try upgrading Arcanist with `%s`.',
'This version of %s is not supported (it is too new). '.
'You can try upgrading with `%s`.',
'cslint',
'arc upgrade'));
}

View file

@ -304,9 +304,9 @@ final class ArcanistPhutilLibraryLinter extends ArcanistLinter {
$details = pht(
"Common causes are:\n".
"\n".
" - Your copy of Arcanist is out of date.\n".
" - Your copy of %s is out of date.\n".
" This is the most common cause.\n".
" Update this copy of Arcanist:\n".
" Update this copy of %s:\n".
"\n".
" %s\n".
"\n".
@ -324,6 +324,8 @@ final class ArcanistPhutilLibraryLinter extends ArcanistLinter {
" - This symbol is defined in an external library.\n".
" Use \"@phutil-external-symbol\" to annotate it.\n".
" Use \"grep\" to find examples of usage.",
PlatformSymbols::getPlatformClientName(),
PlatformSymbols::getPlatformClientName(),
$arcanist_root);
$message = implode(

View file

@ -41,7 +41,7 @@ final class ArcanistProductNameLiteralXHPASTLinterRule
continue;
}
$literal_value = $identifier->getStringLiteralValue();
$literal_value = $identifier->evalStatic();
$matches = phutil_preg_match_all($search_pattern, $literal_value);
if (!$matches[0]) {

View file

@ -270,9 +270,9 @@ final class ArcanistRuntime {
$problems[] = sprintf(
'The build of PHP you are running was compiled with the configure '.
'flag "%s", which means it does not support the function "%s()". '.
'This function is required for Arcanist to run. Install a standard '.
'build of PHP or rebuild it without this flag. You may also be '.
'able to build or install the relevant extension separately.',
'This function is required for this software to run. Install a '.
'standard build of PHP or rebuild it without this flag. You may '.
'also be able to build or install the relevant extension separately.',
$which,
$fname);
continue;
@ -477,8 +477,8 @@ final class ArcanistRuntime {
$log->writeWarn(
pht('VERY META'),
pht(
'You are running one copy of Arcanist (at path "%s") against '.
'another copy of Arcanist (at path "%s"). Code in the current '.
'You are running one copy of this software (at path "%s") against '.
'another copy of this software (at path "%s"). Code in the current '.
'working directory will not be loaded or executed.',
$executing_directory,
$working_directory));
@ -519,10 +519,10 @@ final class ArcanistRuntime {
if (!isset($toolsets[$binary])) {
throw new PhutilArgumentUsageException(
pht(
'Arcanist toolset "%s" is unknown. The Arcanist binary should '.
'be executed so that "argv[0]" identifies a supported toolset. '.
'Rename the binary or install the library that provides the '.
'desired toolset. Current available toolsets: %s.',
'Toolset "%s" is unknown. The binary should be executed so that '.
'"argv[0]" identifies a supported toolset. Rename the binary or '.
'install the library that provides the desired toolset. Current '.
'available toolsets: %s.',
$binary,
implode(', ', array_keys($toolsets))));
}

View file

@ -170,16 +170,14 @@ final class PhutilUnitTestEngine extends ArcanistUnitTestEngine {
if (!$library_name) {
throw new Exception(
pht(
"Attempting to run unit tests on a libphutil library which has ".
"Attempting to run unit tests on a library which has ".
"not been loaded, at:\n\n".
" %s\n\n".
"This probably means one of two things:\n\n".
" - You may need to add this library to %s.\n".
" - You may be running tests on a copy of libphutil or ".
"arcanist using a different copy of libphutil or arcanist. ".
"This operation is not supported.\n",
$library_root,
'.arcconfig.'));
"Make sure this library is configured to load.\n\n".
"(In rare cases, this may be because you are attempting to run ".
"one copy of this software against a different copy of this ".
"software. This operation is not supported.)",
$library_root));
}
$path = Filesystem::resolvePath($path, $root);

View file

@ -890,8 +890,8 @@ EOTEXT
'revision_id' => $revision_id,
));
$prompt_message = pht(
' Note arcanist failed to load the commit message '.
'from differential for revision %s.',
' NOTE: Failed to load the commit message from Differential (for '.
'revision "%s".)',
"D{$revision_id}");
}

View file

@ -51,9 +51,9 @@ EOTEXT
if (!$is_git) {
throw new PhutilArgumentUsageException(
pht(
'The "arc upgrade" workflow uses "git pull" to upgrade, but '.
'the "arcanist/" directory (in "%s") is not a Git working '.
'copy. You must leave "arcanist/" as a Git working copy to '.
'The "upgrade" workflow uses "git pull" to upgrade, but '.
'the software directory (in "%s") is not a Git working '.
'copy. You must leave this directory as a Git working copy to '.
'use "arc upgrade".',
$root));
}