### Implement Custom Unit Test Engine in PHP Source: https://context7.com/phorgeit/arcanist/llms.txt Extends ArcanistUnitTestEngine to integrate custom testing frameworks. This example demonstrates running pytest for Python files, mapping source files to test files, and handling test results. ```php getPaths(); // Find test files based on modified paths $test_files = $this->findTestFiles($paths); foreach ($test_files as $test_file) { $result = new ArcanistUnitTestResult(); $result->setName($test_file); $start_time = microtime(true); // Execute test $future = new ExecFuture('python -m pytest %s --tb=short', $test_file); list($err, $stdout, $stderr) = $future->resolve(); $result->setDuration(microtime(true) - $start_time); if ($err === 0) { $result->setResult(ArcanistUnitTestResult::RESULT_PASS); } else { $result->setResult(ArcanistUnitTestResult::RESULT_FAIL); $result->setUserData($stdout . $stderr); } $results[] = $result; } return $results; } private function findTestFiles(array $paths) { $test_files = array(); foreach ($paths as $path) { // Map source files to test files if (preg_match('/^src omino(.*)\\.py$/', $path, $matches)) { $test_file = 'tests/test_' . $matches[1] . '.py'; if (file_exists($test_file)) { $test_files[] = $test_file; } } } return array_unique($test_files); } protected function supportsRunAllTests() { return true; } } ``` -------------------------------- ### Implement Custom Linter in PHP Source: https://context7.com/phorgeit/arcanist/llms.txt Extends ArcanistExternalLinter to create custom linters for integrating external tools. This example shows a custom Python linter, defining its name, description, binary, and parsing logic for JSON output. ```php setPath($path); $message->setLine($result['line']); $message->setCode($result['code']); $message->setName($result['name']); $message->setDescription($result['message']); $message->setSeverity( ArcanistLintSeverity::SEVERITY_WARNING ); $messages[] = $message; } return $messages; } } ``` -------------------------------- ### Authenticate and Inspect with arc Source: https://context7.com/phorgeit/arcanist/llms.txt Commands for managing server authentication certificates and inspecting the current working copy's relationship with Phorge revisions. ```bash arc install-certificate arc install-certificate https://phorge.example.com/ arc which arc which HEAD~3 arc which --show-base arc which --any-status arc which --head feature-branch ``` -------------------------------- ### Manage Files with arc upload and download Source: https://context7.com/phorgeit/arcanist/llms.txt Facilitates transferring files between the local filesystem and Phorge storage. Includes options for temporary storage, JSON output, and custom filenames. ```bash arc upload document.pdf arc upload image1.png image2.png image3.png arc upload --browse screenshot.png arc upload --temporary debug-log.txt arc upload --json large-file.zip arc download F123 arc download F123 --as downloaded-file.pdf arc download 123 ``` -------------------------------- ### PHP ConduitClient API Calls Source: https://context7.com/phorgeit/arcanist/llms.txt Demonstrates how to use the ConduitClient class in PHP to make synchronous and asynchronous API calls to Phorge. It covers setting authentication, making calls, handling results, setting timeouts, and paginating through results. ```php setConduitToken('api-xxxxxxxxxxxxxxxx'); // Make synchronous API call $result = $client->callMethodSynchronous( 'differential.revision.search', array( 'constraints' => array( 'authorPHIDs' => array('PHID-USER-xxxxx'), 'statuses' => array('needs-review', 'accepted'), ), 'limit' => 10, ) ); foreach ($result['data'] as $revision) { echo "D{$revision['id']}: {$revision['fields']['title']}\n"; } // Make asynchronous API call $future = $client->callMethod( 'maniphest.search', array( 'constraints' => array('assigned' => array('PHID-USER-xxxxx')), ) ); // Do other work... // Resolve the future when needed $tasks = $future->resolve(); // Set request timeout $client->setTimeout(60.0); // Query with pagination $after = null; do { $params = array( 'constraints' => array('statuses' => array('open')), 'limit' => 100, ); if ($after) { $params['after'] = $after; } $result = $client->callMethodSynchronous('maniphest.search', $params); foreach ($result['data'] as $task) { processTask($task); } $after = idx($result['cursor'], 'after'); } while ($after); ``` -------------------------------- ### Configure Arcanist Linting Rules (.arclint) Source: https://context7.com/phorgeit/arcanist/llms.txt The .arclint file specifies linting rules and linters for a project. It supports various linters like chmod, filename, json, merge-conflict, spelling, text, phpcs, flake8, and jshint, with options for inclusion patterns and severity levels. ```json { "exclude": [ "(^externals/)", "(^vendor/)" ], "linters": { "chmod": { "type": "chmod" }, "filename": { "type": "filename" }, "json": { "type": "json", "include": [ "(\\.json$)" ] }, "merge-conflict": { "type": "merge-conflict" }, "spelling": { "type": "spelling" }, "text": { "type": "text", "severity": { "3": "advice" } }, "phpcs": { "type": "phpcs", "include": "(\\.php$)", "phpcs.standard": "PSR2" }, "flake8": { "type": "flake8", "include": "(\\.py$)" }, "jshint": { "type": "jshint", "include": "(\\.js$)" } } } ``` -------------------------------- ### Manage Arcanist Configuration (arc set-config, arc get-config) Source: https://context7.com/phorgeit/arcanist/llms.txt Commands to manage Arcanist configuration settings at user or project levels. 'arc set-config' modifies settings, while 'arc get-config' retrieves them. Options include setting editors, lint engines, default reviewers, and viewing verbose configuration details. ```bash # Set a user-level configuration arcc set-config -- editor vim # Set a local (project) configuration arcc set-config --local -- lint.engine CustomLintEngine # Set default reviewers arcc set-config -- arc.default-reviewers user1,user2 # Get all configuration values arcc get-config # Get a specific configuration value arcc get-config -- editor # Get verbose configuration info arcc get-config --verbose -- lint.engine ``` -------------------------------- ### PHP Class Definition and Instantiation Source: https://github.com/phorgeit/arcanist/blob/master/src/lexer/__tests__/php/case-insensitive.txt This snippet defines a PHP class 'C' that extends 'stdClass' and implements interface 'I'. It also shows how to instantiate the class and perform an instance check within a try-catch block. ```PHP changes.patch arc export --unified > changes.diff arc export --arcbundle changes.bundle arc export --revision D12345 --git arc export --diff 54321 --unified arc export HEAD~3..HEAD --git arc export --encoding ISO-8859-1 --unified ``` -------------------------------- ### Parse HTML Tag to JSON Source: https://github.com/phorgeit/arcanist/blob/master/src/parser/html/__tests__/data/attributes-basic.txt Converts a string representation of an HTML tag into a structured JSON object. It handles boolean attributes and key-value pairs effectively. ```json [ { "tag": "a", "attributes": { "b": "1", "c": true, "d": "e" }, "children": [] } ] ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.