mirror of
https://github.com/danog/psalm.git
synced 2025-01-22 05:41:20 +01:00
Switch from --cache-results to --diff-methods flag
This commit is contained in:
parent
de8dccf6d2
commit
afebefba19
@ -22,6 +22,6 @@ Psalm has a couple of command-line options that will result in faster builds:
|
||||
|
||||
- `--threads=[n]` to run Psalm’s analysis in a number of threads
|
||||
- `--diff` which only checks files you’ve updated (and their dependents).
|
||||
- `--cache-results` which remembers Psalm’s output when scanning particular methods.
|
||||
- `--diff-methods` which remembers Psalm’s output when scanning particular methods.
|
||||
|
||||
Running them together (e.g. `--threads=8 --diff --cache-results`) will result in the fastest possible Psalm run.
|
||||
Running them together (e.g. `--threads=8 --diff --diff-methods`) will result in the fastest possible Psalm run.
|
||||
|
@ -138,7 +138,7 @@ class ProjectChecker
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
public $cache_results = false;
|
||||
public $diff_methods = false;
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
|
@ -277,7 +277,7 @@ class Analyzer
|
||||
$project_checker->file_reference_provider->setCorrectMethods($this->correct_methods);
|
||||
$project_checker->file_reference_provider->updateReferenceCache($project_checker->codebase, $scanned_files);
|
||||
|
||||
if ($project_checker->cache_results) {
|
||||
if ($project_checker->diff_methods) {
|
||||
$project_checker->codebase->statements_provider->resetDiffs();
|
||||
}
|
||||
|
||||
@ -293,7 +293,7 @@ class Analyzer
|
||||
*/
|
||||
public function loadCachedResults(ProjectChecker $project_checker)
|
||||
{
|
||||
if ($project_checker->cache_results
|
||||
if ($project_checker->diff_methods
|
||||
&& !$project_checker->codebase->collect_references
|
||||
) {
|
||||
$this->correct_methods = $project_checker->file_reference_provider->getCorrectMethods();
|
||||
|
@ -41,7 +41,7 @@ $valid_long_options = [
|
||||
'threads:',
|
||||
'use-ini-defaults',
|
||||
'version',
|
||||
'cache-results',
|
||||
'diff-methods',
|
||||
];
|
||||
|
||||
$args = array_slice($argv, 1);
|
||||
@ -148,8 +148,8 @@ Options:
|
||||
--diff
|
||||
Runs Psalm in diff mode, only checking files that have changed (and their dependents)
|
||||
|
||||
--cache-results
|
||||
Cache results of analysis for faster runs
|
||||
--diff-methods
|
||||
Only checks methods that have changed (and their dependents)
|
||||
|
||||
--output-format=console
|
||||
Changes the output format. Possible values: console, emacs, json, pylint, xml
|
||||
@ -414,7 +414,7 @@ $project_checker = new ProjectChecker(
|
||||
!isset($options['show-snippet']) || $options['show-snippet'] !== "false"
|
||||
);
|
||||
|
||||
$project_checker->cache_results = isset($options['cache-results']);
|
||||
$project_checker->diff_methods = isset($options['diff-methods']);
|
||||
|
||||
$start_time = (float) microtime(true);
|
||||
|
||||
|
@ -62,7 +62,7 @@ class FileUpdateTest extends TestCase
|
||||
$this->markTestSkipped('Skipped due to a bug.');
|
||||
}
|
||||
|
||||
$this->project_checker->cache_results = true;
|
||||
$this->project_checker->diff_methods = true;
|
||||
|
||||
$codebase = $this->project_checker->getCodebase();
|
||||
|
||||
@ -120,7 +120,7 @@ class FileUpdateTest extends TestCase
|
||||
string $error_message,
|
||||
array $error_levels = []
|
||||
) {
|
||||
$this->project_checker->cache_results = true;
|
||||
$this->project_checker->diff_methods = true;
|
||||
|
||||
$codebase = $this->project_checker->getCodebase();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user