1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-30 04:39:00 +01:00
Commit Graph

66 Commits

Author SHA1 Message Date
Matt Brown
63953d5676
4.x - refactor unused variable detection
This turns unused variable detection into an explicit control-flow problem, where before we had a more simplistic mark-and-sweep algorithm
2021-01-29 11:39:44 +01:00
orklah
e3e5a55907
unused use statements (#4228) 2021-01-29 11:39:42 +01:00
orklah
db45ff1ba4
More return types (#4173)
* add native return types

* redundant phpdoc
2021-01-29 11:38:57 +01:00
orklah
61512da144
add native return types (#4116)
* add native return types

* remove redundant phpdoc
2021-01-29 11:38:53 +01:00
Brown
e585955c96
Use immutable data structures for clause calculations 2021-01-29 11:38:45 +01:00
Bruce Weirdan
dabfb16e34
Test parallelization (#4045)
* Run tests in random order

Being able to run tests in any order is a pre-requisite for being able
to run them in parallel.

* Reset type coverage between tests, fix affected tests

* Reset parser and lexer between test runs and on php version change

Previously lexer was reset, but parser kept the reference to the old
one, and reference to the parser was kept by StatementsProvider. This
resulted in order-dependent tests - if the parser was first initialized
with phpVersion set to 7.4 then arrow functions worked fine, but were
failing when the parser was initially constructed with settings for 7.3

This can be demonstrated on current master by upgrading to
nikic/php-parser:4.9 and running:

```
vendor/bin/phpunit --no-coverage --filter="inferredArgArrowFunction" tests/ClosureTest.php
```

Now all tests using PHP 7.4 features must set the PHP version
accordingly.

* Marked more tests using 7.4 syntax

* Reset newline-between-annotation flag between tests

* Resolve real paths before passing them to checkPaths

When checkPaths is called from psalm.php the paths are resolved, so we
just mimicking SUT behaviour here.

* Restore newline-between-annotations in DocCommentTest

* Tweak Appveyor caches

* Tweak TravisCI caches

* Tweak CircleCI caches

* Run tests in parallel

Use `vendor/bin/paratest` instead of `vendor/bin/phpunit`

* Use default paratest runner on Windows

WrapperRunner is not supported on Windows.

* TRAVIS_TAG could be empty

* Restore appveyor conditional caching
2021-01-29 11:38:04 +01:00
Brown
17558a5c0e Fix #3676 - add multiline output for TaintedInput issues 2020-06-30 13:17:51 -04:00
Brown
1cc53f1172 Fix tests 2020-05-14 23:22:49 -04:00
Anthony Rainer
6f36f33630
Added new language server options and functionality. (#3161)
* Added new language server options and functionality.

Added new extended diagnostic code information to the language server.
 -- It must be enabled via a command line switch.
Added telemetry data for language server initialization and operation.
Added verbose log messages for language server.
 -- It must be enabled via a command line switch.

* fixed phpcs issues

* fixed failing tests

* changed the language server reported error code to be the help link

Co-authored-by: Anthony Rainer <0@0ze.ro>
2020-04-17 00:47:18 -04:00
Brown
001f064bd4 Don’t modify contents of IssueBuffer in baseline before caching 2020-03-31 23:38:58 -04:00
Matthew Brown
4e07dfebaa Make link part of IssueData so it’s available to all consumers 2020-03-19 16:22:43 -04:00
Ben Dusinberre
732cffc82c Update test for info level change 2020-03-08 20:18:35 -05:00
Ben Dusinberre
15ea7bf357 Remove the rest of the invalid attributes 2020-03-08 20:18:35 -05:00
Ben Dusinberre
783dbfae9c Remove duplicate testsuite element 2020-03-08 20:18:35 -05:00
Ben Dusinberre
ef1d2e5436 Validate junit output against xsd 2020-03-08 20:18:35 -05:00
Matthew Brown
6a4e7931e6 Fix tests to add new property 2020-02-17 16:43:50 -05:00
Matthew Brown
6d088f2396 Even more commas 2020-02-16 18:43:54 -05:00
Matthew Brown
196a0a5c4e Replace issue data array with object 2020-02-16 18:24:40 -05:00
Bruce Weirdan
a23dd9f97d Fixed vimeo/psalm#2792 2020-02-11 22:21:54 -05:00
Matthew Brown
d7b99148be Add support for JUnit report type
Fixes #2485
2019-12-19 20:18:09 +00:00
lhchavez
216f991b0c Normalize stringified type names (#2239)
This change makes stringified types more normalized. Concretely it sorts
all union types, reconciled types, and sorts the keys within object-like
types.
2019-10-17 01:14:33 -04:00
Barney Laurance
ea83068deb Allow resolving directories from config file location (continued) (#1910)
* Extract function getPsalmHelpText() from psalm.php

* Extract initialiseConfig from psalm.php

* Add -c as valid short option for psalter and psalm-refactor

* Use initialiseConfig in psalter, psalm-refactor and psalm-language-server as well as psalm

* Rely on psalm --alter resolving directory from config file in test

* Remove erronous condition for config file path

This code was based on me wrongly thinking that the config file location
was seprated from the argument name with a space instead of an equals
sign

* Use config dir as current dir in psalm and psalm-refactor, as with psalter and psalm-language-server

* Remove redundant duplicated code

* Refactor: move calls to \Psalm\Config::setComposerClassLoader inside initialiseConfig

* PHPCS fix

* Extract function get_path_to_config from command scripts

* Refactor - extract functions from \Psalm\Config::loadFromXML

* Refactor - reduce verbosity of config loading code

* Allow running e2e tests on windows

* Fix testCompactReport on Windows

* convert line endings to make testCompactReport pass on Windows
2019-07-07 08:55:53 -04:00
Matthew Brown
da42be175f Apply PHPCS fixes
Fixes #1880
2019-07-05 16:27:53 -04:00
Matthew Brown
df3d7e1d2c Make line endings mostly all the same 2019-07-03 16:58:27 -04:00
LeSuisse
f29826b958 Fully qualify constants and function calls (#1849)
This should give a small performance boost.
Part of #1837.

The change is enforced via phpcs and can be autofixed
with phpcbf.
2019-06-26 16:52:29 -04:00
Matthew Lewinski
ac0a9d1514 Add a 'sonarqube' report type (#1808)
This JSON report is suitable for import into either SonarCloud or
SonarQube as Generic Issue Data (also known as an External Issue
Report).

https://docs.sonarqube.org/latest/analysis/generic-issue/
2019-06-17 21:17:09 -04:00
Brown
e3c9dbf2c0 Fix #1617 and fix #1773 - properly filter out info in reports 2019-06-13 11:06:01 -04:00
Matthew Brown
b5cbc84351 Fix #1617 - add option to only show errors in reports 2019-06-09 12:37:28 -04:00
Ilija Tovilo
5a14e4b1cf Progress bar (#1709)
* Revert "Revert "Implement better progress""

This reverts commit 4302596654.

* Revert "Revert "Implement dots progress bar""

This reverts commit e41733d789.

* Revert "Revert "Switch to VoidProgress by default""

This reverts commit 304ffeb0a3.

* Revert "Revert "Pass success flag to progress""

This reverts commit 62a690ee4e.

* Improve socket communication

* Use an underscore

* Add means to disable progress

* Add extra newline before progress bar
2019-05-30 10:30:41 -04:00
Matthew Brown
4302596654 Revert "Implement better progress"
This reverts commit 042070d0fd.
2019-05-27 13:07:02 -04:00
Ilija Tovilo
042070d0fd Implement better progress 2019-05-26 23:18:48 -04:00
Brown
0bd4dbcbc4 Bump to PHP 7.1
Fixes #1650
2019-05-16 18:36:36 -04:00
Brown
111abf82da Fix #1616 - allow Psalm to output checkstyle format 2019-05-08 14:26:52 -04:00
Matthew Brown
bd48ba858e Add @SignpostMarv’s fixes for Windows tests 2019-03-31 19:08:55 -04:00
Matthew Brown
c772914910 Add some formatting 2019-03-23 14:27:54 -04:00
Matthew Brown
c800fb9282 Fix #1437 - use correct return type line for error 2019-03-07 23:19:17 -05:00
Bruce Weirdan
8408effe57 Dropped unused uses 2019-02-17 13:17:45 -05:00
SignpostMarv
5c49dfd746 adding PHP_EOL to tests that fail under windows 2019-02-06 14:29:10 -05:00
Jon Ursenbach
e6a1369d08 Adding a PHP 7.0-friendly return annotation to a test. 2018-12-09 17:34:47 -05:00
Jon Ursenbach
c6a8b53a4d Refactoring output formats and creating a new "compact" format.
The new compact format generates your report within a table
structure that is similar to PHPCS.

Resolves #967
2018-12-09 17:34:47 -05:00
Brown
110ca66692 Namespace test providers under Internal cc @TysonAndre 2018-11-12 11:20:59 -05:00
Matthew Brown
4d79b61e93 Change _checker to _analyzer 2018-11-12 11:20:59 -05:00
Matthew Brown
4688b25fd9 Move internal classes to own namespace 2018-11-12 11:20:59 -05:00
Brown
d0bd10d143 Improve provider architecture, upping test coverage 2018-09-30 11:34:51 -04:00
Radosław Kowalewski
15c1a82d8c Few fixes to make tests pass on windows
* changed / to DIRECTORY_SEPARATOR in expected messages
* cahnged most occurences PHP_EOL to "\n" in tests and src
* added output buffering in test to avoid marking test as risky
2018-04-12 22:41:13 -04:00
Matthew Brown
17b27b31e8 Fix erroneous input/output lines 2018-03-29 10:26:26 -04:00
Matthew Brown
956972b4a4 Fix #539 - evaluate global variable usage 2018-02-25 10:43:54 -05:00
Matt Brown
5471b89391 Make array coercion an error 2018-02-21 18:59:31 -05:00
Matthew Brown
a99e89495b Add end line/column data for LSP support 2018-02-19 18:16:09 -05:00
Matthew Brown
81fd016120 Fix #193 - allow caching of storages 2018-02-19 00:27:39 -05:00