Difference between revisions of "PHPStan/configuration"

From Freephile Wiki
Jump to navigation Jump to search
(look at one extension at a time)
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
Here is a configuration I used during a quality audit for the Meza project
+
Here is a configuration I used during a quality audit for a large installed base of extensions
 
{{Collapsible
 
{{Collapsible
 
| visible_text= sample configuration for testing many extensions
 
| visible_text= sample configuration for testing many extensions
Line 11: Line 11:
 
editorUrlTitle: '%%relFile%%:%%line%%'
 
editorUrlTitle: '%%relFile%%:%%line%%'
 
# phpVersion: 70400 # PHP 7.4
 
# phpVersion: 70400 # PHP 7.4
 +
## Target a particular PHP version for compliance (really only works if your analysis is running that version)
 
phpVersion: 80100 # PHP 8.1
 
phpVersion: 80100 # PHP 8.1
level: 9
+
level: 5
 
paths:
 
paths:
# - extensions/AbuseFilter
 
 
- extensions/Arrays #4 (unknown class ExtRegexFun)
 
- extensions/Arrays #4 (unknown class ExtRegexFun)
# - extensions/CategoryTree
 
# - extensions/CiteThisPage
 
# - extensions/CollapsibleVector #1
 
# - extensions/ConfirmEdit
 
# - extensions/ContributionScores
 
# - extensions/CreateUserPage
 
# - extensions/CSS
 
# - extensions/DataTransfer #18
 
# - extensions/DeleteBatch #9
 
# - extensions/DisplayTitle #26
 
# - extensions/FlexDiagrams #36
 
# - extensions/Gadgets
 
# - extensions/HeaderFooter
 
# - extensions/HeaderTabs #1
 
# - extensions/Html5mediator #2
 
# - extensions/Maps #35
 
# - extensions/Math # EMPTY
 
# - extensions/MediaFunctions #1
 
# - extensions/Mermaid
 
# - extensions/ModernTimeline #13
 
# - extensions/Network #1
 
# - extensions/Nuke # EMPTY
 
# - extensions/NumerAlpha # 26 Tests/phpunit/integration/NumerAlphaTest.php  Call to an undefined method NumerAlphaTest::assertEquals()
 
# - extensions/OATHAuth # EMPTY
 
# - extensions/OpenLayers # EMPTY (libs)
 
# - extensions/PdfHandler # EMPTY
 
# - extensions/PipeEscape
 
# - extensions/Poem # EMPTY
 
# - extensions/Renameuser # EMPTY
 
# - extensions/SecureLinkFixer # EMPTY
 
# - extensions/SemanticCompoundQueries #20
 
# - extensions/SemanticDependencyUpdater #2
 
# - extensions/SemanticDrilldown #29
 
# - extensions/SemanticExtraSpecialProperties #21
 
# - extensions/SemanticMediaWiki # Found 3758 errors Used memory: 1.55 GB
 
# but somehow includes/IdeAliases.php was deleted, probably doesn't make a difference
 
# I redeployed with SMW 4.1.3
 
# [ERROR] Found 3415 errors                                                                                             
 
# Used memory: 1.63 GB
 
# - extensions/SemanticResultFormats #884
 
# - extensions/SemanticScribunto #64
 
# - extensions/SimpleBatchUpload #2
 
# - extensions/SimpleMathJax
 
# - extensions/SpamBlacklist
 
# - extensions/SubpageFun #2
 
# - extensions/SubPageList #13
 
# - extensions/TalkRight
 
# - extensions/TitleBlacklist
 
# - extensions/Validator #2
 
# - extensions/VEForAll #2
 
# - extensions/WatchAnalytics #73
 
# - extensions/WhitelistPages
 
# - extensions/WhoIsWatching #41
 
# - extensions/WhosOnline #6
 
# - extensions/Widgets #2
 
# - extensions/Wiretap #6
 
# - extensions/YouTube #1
 
 
## THE 'GOOD' EXTENSIONS, aka they have .phan/config.php already
 
# - extensions/AdminLinks #
 
# - extensions/AdvancedSearch #42
 
# - extensions/Bootstrap #
 
# - extensions/CharInsert #
 
# - extensions/CirrusSearch #2,026
 
# - extensions/Cite #219
 
# - extensions/CodeEditor #
 
# - extensions/CodeMirror #22
 
# - extensions/CommentStreams #30
 
# - extensions/DismissableSiteNotice #
 
# - extensions/DynamicSidebar #
 
# - extensions/Echo #661
 
# - extensions/Elastica #6
 
# - extensions/ExternalData #26
 
# - extensions/Flow #897
 
# - extensions/Graph #
 
# - extensions/ImageMap #
 
# - extensions/InputBox #
 
# - extensions/Interwiki #
 
# - extensions/LabeledSectionTransclusion #
 
# - extensions/Lockdown #
 
# - extensions/MultimediaViewer #
 
# - extensions/MyVariables #
 
# - extensions/PageForms #148
 
# - extensions/PageImages #74
 
# - extensions/ParserFunctions #7
 
# - extensions/ReplaceText #4
 
# - extensions/RevisionSlider #
 
# - extensions/Scribunto #134
 
# - extensions/SyntaxHighlight_GeSHi #
 
# - extensions/TemplateData #35
 
# - extensions/TextExtracts #33
 
# - extensions/Thanks #171
 
# - extensions/UniversalLanguageSelector #14
 
# - extensions/Variables #
 
# - extensions/VisualEditor #28
 
# - extensions/WikiEditor #10
 
#4275 ERRORS in the 'Good' extensions
 
  
 
scanDirectories:
 
scanDirectories:
Line 132: Line 35:
 
# - '#.+ no value type specified in iterable type .+#'
 
# - '#.+ no value type specified in iterable type .+#'
 
- '#ExtRegexFun#'
 
- '#ExtRegexFun#'
# - '#Constant [a-zA-Z0-9\\_]+ not found#'
+
# - '#Constant [a-zA-Z0-9\\_]+ not found#'
 
</syntaxhighlight>
 
</syntaxhighlight>
 
}}
 
}}
 +
 +
PHPStan offers many '[https://phpstan.org/user-guide/output-format output formats]' (and you can write your own too). The 'raw' format is probably most like what you get from [[Phan]]

Latest revision as of 17:25, 23 February 2024

Here is a configuration I used during a quality audit for a large installed base of extensions

sample configuration for testing many extensions

parameters:
# should make regular 'table' output also include clickable links for VSCode
	editorUrl: 'vscode://file/%%file%%:%%line%%'
# should output a title to the link that you can copy/paste to your editor 
	editorUrlTitle: '%%relFile%%:%%line%%'
#	phpVersion: 70400 # PHP 7.4
## Target a particular PHP version for compliance (really only works if your analysis is running that version)
	phpVersion: 80100 # PHP 8.1
	level: 5
	paths:
	- extensions/Arrays #4 (unknown class ExtRegexFun)

	scanDirectories:
	- includes
	- languages
	- maintenance
	- mw-config
	- resources
	- vendor
	- tests/common
	- tests/parser
	- tests/phpunit/mocks
	excludePaths:
		analyse:
			- vendor
			- *Factory*
			- */lib/*
	ignoreErrors:
		# - '#.+ no value type specified in iterable type .+#'
		- '#ExtRegexFun#'
		# - '#Constant [a-zA-Z0-9\\_]+ not found#'


PHPStan offers many 'output formats' (and you can write your own too). The 'raw' format is probably most like what you get from Phan