aboutsummaryrefslogtreecommitdiffstats
path: root/tests/phan
Commit message (Collapse)AuthorAgeFilesLines
...
* Remove PhanParamReqAfterOpt from blacklistErik Bernhardson2018-06-091-2/+0
| | | | Change-Id: I569656068c9034f7325312afcce837e2712b4f29
* Remove renamed .inc files from phan configUmherirrender2018-05-311-2/+0
| | | | | | Follow-Up: Ic441087702376b1ca0e70554c71cdf7ecad908af (for userOptions.inc) Follow-Up: I999f5842625c752f01c1eb4b012431c4a24ce7ce (for importImages.inc) Change-Id: I3e1c694f61960e9e4b50a7855927d039e93928fb
* Enable a bunch of disabled phan checks that are no longer failingKunal Mehta2018-05-171-12/+0
| | | | Change-Id: I471bffa8a4aa20d22e7e1830a2b01fce3e099d9e
* Enable "PhanTypeInvalidRightOperand" phan checksKunal Mehta2018-05-171-2/+0
| | | | | | | | | | HTMLFormField subclasses triggered false positives when phan incorrectly thought that $this->mOptions was only a boolean. ReplacementArray $this->data was defined as possibly being boolean, but in reality that never happened. Change-Id: I06bae9c9952366ff7927df37373b146d570f4a02
* Enable "PhanUndeclaredVariable" phan checkKunal Mehta2018-05-171-2/+0
| | | | | | | All of the instances of it have been fixed. This would have prevented T194899 from happening in the first place. Change-Id: I19357ffc858022d3b89a040eafe9047f83df1c88
* Remove empty skins folder from phan configUmherirrender2018-05-061-3/+0
| | | | | | Similar to extensions folder there is nothing to do Change-Id: I5bd9a8f70fb020325c892f04e3eac7a3e46d772a
* phan: Provide stub for wikidiff2_inline_diff()Kunal Mehta2018-04-141-0/+10
| | | | | | Needed by MobileFrontend Change-Id: I5c6dfae873b5292f26652631943d42de08df49b3
* Allow PHPUnit 6 optionally in require-devReedy2018-04-122-0/+15
| | | | | | | | | | | MediaWiki uses a back-compat layer to preserve most of the PHPUnit 4 runtime, so existing tests will continue to run fine with minimal modification. Once PHP < 7.0 support is dropped, we can drop PHPUnit 4 support, and adapt tests to use PHPUnit 6 features directly. Bug: T177132 Depends-On: I884b240307e3fcad253aa64eeae9944ed4eb7d50 Change-Id: I497712c7693d137be197a69873baa58383ce9646
* Phan: resolve and reenable PhanAccessMethodProtectedMax Semenik2018-01-231-2/+0
| | | | Change-Id: I2bd7c787012f4f54600f3289d9d0d725f87788bc
* Move BaseDump into includes/export/Chad Horohoe2018-01-081-1/+0
| | | | | | | There's no reason for this to have to live in Maintenance land. It's generally useful and lets us avoid some random require/include calls Change-Id: I60419c7f9fc52313905053bbeb3aa81666c9160c
* build: Updating mediawiki/mediawiki-codesniffer to 15.0.0Umherirrender2018-01-015-5/+5
| | | | | | | | | | | | | Clean up use of @codingStandardsIgnore - @codingStandardsIgnoreFile -> phpcs:ignoreFile - @codingStandardsIgnoreLine -> phpcs:ignore - @codingStandardsIgnoreStart -> phpcs:disable - @codingStandardsIgnoreEnd -> phpcs:enable For phpcs:disable always the necessary sniffs are provided. Some start/end pairs are changed to line ignore Change-Id: I92ef235849bcc349c69e53504e664a155dd162c8
* Update for Phan 0.10.1Max Semenik2017-11-071-0/+36
| | | | Change-Id: Id292944b80eb0c81956b203ce95bb0def3b4b0a3
* build: Updating mediawiki/mediawiki-codesniffer to 13.0.0Umherirrender2017-09-251-2/+0
| | | | Change-Id: Ia24dbf015f2b4781683ca980a460d0ac3e85674e
* Merge "Introduce config var for moved-paragraph-detection threshold"jenkins-bot2017-07-181-1/+2
|\
| * Introduce config var for moved-paragraph-detection thresholdTobias Gritschacher2017-07-181-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This introduces a configuration variable for the bailout threshold for the moved-paragraph-detection in wikidiff2. This allows to rollout a new version of wikidiff2 that supports detecting changes in moved paragraphs without changing behaviour of all wikis in production as the default value of the setting (0) will leave the new feature disabled. Compatibility with older versions of wikidiff2 is retained by checking for the version number of wikidiff2 and calling the method without the 4th parameter if the version is < 0.3.0. Bug: T166571 Change-Id: Ic01054354a4fbba410e58c9873edcbde797f883d
* | Update phan issues & estimated countsaddshore2017-06-301-14/+14
|/ | | | | | | | Since the last update there is a total of 550 less issues. 744 removed and 194 added in various places. (roughly) Change-Id: I0431773973c146e1492de72d869f6d33de4084e8
* Drop in replacement of eval.php based on psyshAntoine Musso2017-02-131-4/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | eval.php is meant to eval() commands in MediaWiki global scope. We had at least a couple attempts to move it to a regular Maintenance script. As noted on the revert commit b475e930 r54839, using a Maintenance script drop us in the callee function scope instead of the global scope which is a hard requirement. http://psysh.org/ is a Read-Eval-Print-Loop with color highlight, modern code and more. Add maintenance/shell.php script as MediaWikiShell class. Passing command from stdin is supported. Execution is forked for graceful handling of PHP fatal errors. Colors!! Support the undocumented '-d' arguments from eval.php: 0 set $wgDebugLogFile to stdout. Eval.php used /dev/stdout, make it php://stdout in the new script. 1 additionally set DBO_DEBUG on all the database load balancer servers PHP globals have to be whitelisted which is not supported out of the box by Psy. Upon request, the author of PsySh, Justin Hileman, kindly provided a pass to inject globals (with the exceptions of super globals). He agreed for code reuse: https://github.com/bobthecow/psysh/issues/353 The code was added to maintenance/CodeCleanerGlobalsPass.inc Note that this is not a perfect simulation of global scope (but pretty close): variables declared in the shell which did not exist before won't be global unless the 'global' keword is used. Example usage: $ php maintenance/shell.php >>> $wgFullyInitialised => true >>> $hashar = User::newFromName( 'hashar' ) => User {#274 +mId: null, +mName: "Hashar", ... >>> ls --long --all $h <descriptive output of all object properties/methods> Bug: T117661 Signed-off-by: Justin Hileman <justin@justinhileman.info> Signed-off-by: Gergő Tisza <tgr.huwiki@gmail.com> Change-Id: I3d6d42e138d3cc4a0aaafdd7f5f97cb17d8b8cb3
* PHAN: Add tideways stubaddshore2017-01-302-0/+13
| | | | | | Used in Xhprof Change-Id: I9f208bbaa0799d194dbef61cad851995020a5d17
* PHAN: load stubs from phpstorm-stubs libraryaddshore2017-01-302-4/+18
| | | | | | | | | | | Also add a single small stub for the Memcached class constructor that is slightly wrong in the phpstorm stubs library. jetbrains/phpstorm-stubs has been added to packagist via: https://github.com/JetBrains/phpstorm-stubs/pull/149 Change-Id: I1bca7390d1dc24c38d65c1c8968f356326ff4636
* Merge "PHAN: conditionally load stubs"jenkins-bot2017-01-232-18/+22
|\
| * PHAN: conditionally load stubsaddshore2017-01-232-18/+22
| | | | | | | | Change-Id: I6f78c573468a393d82927d614df5bceda86a9e9c
* | Un-blacklist PhanUndeclaredVariableErik Bernhardson2017-01-181-3/+1
|/ | | | | | | | | | Undeclared variables are a very common error type that we want to catch as often as possible. To avoid needing to refactor a variety of global level code (mostly in old-style maintenance scripts) this ignores undeclared variables in global scope. This is still a good improvement over what was happening previously. Change-Id: I50b41d571724244552074b9408abbdf6160aca59
* Remove trailing empty lines in PHPFomafix2017-01-161-1/+0
| | | | | | | Performed using find . -name \*.php -exec sed -i -e :a -e '/./,$!d;/^\n*$/{$d;N;};/\n$/ba' {} \; Change-Id: I5d0627f94c73690cf3a8a453539c22c760c2aa60
* phan: Don't hardcode 'php7.0' binaryaddshore2017-01-111-1/+7
| | | | | | | | This isn't available on all systems, e.g. Fedora just uses "php". People with multiple versions of PHP installed can use an alternatives system or something to make sure PHP 7 is used. Change-Id: I03ef7c2d4223ade32f7a89c3a88706ae8c6e8156
* Fixed typo in commentWMDE-Fisch2017-01-041-1/+1
| | | | Change-Id: I58dba2018a20c34537222ba7711a39c75855be52
* Merge "Remove unused static methods in LanguageConverter subclasses"jenkins-bot2017-01-031-1/+1
|\
| * Remove unused static methods in LanguageConverter subclassesLeszek Manicki2017-01-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | It seems LanguageConverter::parseManualRule was removed by 69dbeb97f15b65dd5773852d76c3bc93caefc862 (2008), and LanguageConverter::parserConvert by c568220e610177114e71973375514d33871d6345 (2010), so it seems safe and reasonable to remove their implementations from few remaining language-specific Converter classes. Change-Id: I7092f5c8856723fabd2b1f99944451344feb5711
* | Do not try to change directory when running Phan tests with no paramsLeszek Manicki2017-01-031-1/+1
|/ | | | | | | | | | When running tests with: PHAN=/path/to/phan/phan /path/to/mediawiki-core/tests/phan/bin/phan the script changes to the home dir (does "cd" with no param), which results in git error message (unless the home dir happens to be a git repository). Change-Id: Ib11e419fb5cca51ceaed0e9c7c86ae9c5c4ae0f2
* Allow PHAN location to be read from PATHaddshore2016-12-231-4/+11
| | | | Change-Id: I4ea64eab12f299a13559178c80fe6797d07a5f85
* Merge "Remove unused Phan exception"jenkins-bot2016-12-191-2/+0
|\
| * Remove unused Phan exceptionMax Semenik2016-12-181-2/+0
| | | | | | | | Change-Id: Ib578336abfed02c8dce9ccb47ab22220ddcee856
* | Merge "Adjust phan script to run sub-projects"jenkins-bot2016-12-171-11/+40
|\ \
| * | Adjust phan script to run sub-projectsErik Bernhardson2016-12-161-11/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Rather than duplicating the phan and postprocess-phan.php scripts into extensions, this allows passing the path to the extension (or skin, or whichever) to the phan script and it will run the analysis for that project. Individual projects will need a tests/phan/config.php file that defines how the analysis will run in their project. Bug: T153040 Change-Id: I58ad44f6a8769088e87d5d6cf1079e633c082f88
* | | Fix type annotationMax Semenik2016-12-161-2/+0
| |/ |/| | | | | Change-Id: I8996a7617c4723c9c4ff8f91d0f3767c9e67dd28
* | Decrease the number of 'function says it should return something' errorsMax Semenik2016-12-151-1/+1
| | | | | | | | Change-Id: Ib5115fe5bbaa67d8a6e54cc3ba1ba7020e239e11
* | Fix type annotationsMax Semenik2016-12-151-2/+0
| | | | | | | | Change-Id: Ib72c98358b2f0b3b73b6f105adea47346373d46d
* | Fix two instances of calling function with too few argsErik Bernhardson2016-12-151-2/+0
| | | | | | | | | | | | | | | | | | | | At one point SearchIndexFieldDefinition was updated to require the engine to be passed in, but it seems that update was missed here. BackupDumper::loadPlugin() requires the second argument, set it to the empty string to keep current behaviour. Change-Id: Ifbd8fc4870ff63b2d338f8bb4d251d7a3477b989
* | Correct DatabaseSqlite::unionQueries annotationErik Bernhardson2016-12-151-2/+0
|/ | | | | | | The annotation was claiming string, but it's very obvious from the usage the it should be string[]. Change-Id: I99849a338971590ca68dfb175b2458ad5ebc0df2
* Merge "Fix parameter type docs"jenkins-bot2016-12-141-2/+0
|\
| * Fix parameter type docsLeszek Manicki2016-12-141-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | Changes: - uses int instead of number as param and return value type, - uses stdClass instead of stdObject - fixes ResourceLoaderClientHtml constructor's $target param type: it is string|null, not an array (previously misspelled as "aray") - changes the type of references to XML parser in XMP lib to resource instead of not existing XMLParser Change-Id: I98c363ebc6658d1f4dcabad97a9a92f3fcd7ea8c
* | Merge "Document type of LogEntry::isPatrollable property"jenkins-bot2016-12-141-2/+0
|\|
| * Document type of LogEntry::isPatrollable propertyLeszek Manicki2016-12-141-2/+0
| | | | | | | | Change-Id: I557b92f25f15f57123af329c79ef1752025aedf3
* | Fix assigning void return value to a variableLeszek Manicki2016-12-141-2/+0
|/ | | | Change-Id: I1e675d121938c5b6b7f8165681c645154e3a70d0
* Add script to support per-line @suppress annotations in PhanErik Bernhardson2016-12-133-3/+150
| | | | | | | | | | | | | Adds the functionality of per-line @suppress annotations. Phan already supports per-class or per-method annotations, but does not have any per-line support due to the PHP AST only returning comments that are class/property/method level docblocks. This is a bit of a hack, but get's the job done. Removes the PhanTypeInvalidLeftOperand issue from blacklist and suppresses it to demonstrate the supression works as expected. Change-Id: I5066b3b431fb69175a711ee366e95f31c7c47639
* Adjust phan to allow for making progress strengthening analysisErik Bernhardson2016-12-131-10/+72
| | | | | | | | | | | | With phan set to only report critical errors it will be quite hard to cleanup the code base to the point where we are running stronger analysis. Instead of setting minimimum severity to critical, set minimum severity to low and suppress all existing issues. This will allow developers to choose an issue type from the list, fix it, and update the config.php to report on the issue in the future. Change-Id: I2771a4ff37f43cca215b939ed7d82f137d72cea6
* Use the phan exit code directlyErik Bernhardson2016-12-081-3/+3
| | | | Change-Id: Ic99e334576e350d11c57ac4b74085c99313401c4
* Use 1 processes instead of 4 for phanErik Bernhardson2016-12-081-2/+2
| | | | | | | | | | Running against mediawiki core phan needs around 1GB of memory per process. >4GB is too excessive for a default setting. Instead set the default to 1 process and add the ability for users to select more processes on the command line. Bug: T132636 Change-Id: I3d9fa462916fba519fe6d7f1916f881eefb6a942
* Add configuration for running etsy/phan against coreErik Bernhardson2016-12-077-0/+608
Adds the necessary configuration and stubs for phan static analysis to run against mediawiki core. A variety of fixes have been applied to core recently such with this current configuration we are completely passing, except for one issue with a bug in Phan (https://github.com/etsy/phan/issues/286) In it's current configuration Phan will detect fatal errors trying to access non existant classes, undefined method calls, and other errors. The analysis can be expanded as we cleanup more of the codebase. This is in preparation for working on getting the CI to run phan as part of the review process. I have found phan to be usefull in CirrusSearch (although with stricter config) for catching bugs and I think it could help in core as well. We arn't too far from being able to disable `null_casts_as_any_type`, there are only a few classes that need adjusting. Lots more work needs to be done to reduce `minimum_severity` from 10 to 5 (normal) or 0 (low). Change-Id: Iafd55b1380f37d7b0d195eed081f8042166690e8