KSP-CKAN/NetKAN#9190 revealed two things about the ModAnalyzer:
If it can't figure out any tags, it does this:
tags: []
This is undesirable because it suppresses the warning about tags, so a reviewer might think everything is fine when actually we need to add tags.
kOS scripts use the filename extension .ks, which we could detect and handle
Changes
Now if there are no tags, we don't set the tags property, so reviewers will see the warning
Now if any filename in a mod ends with .ks, we add config and control to tags (since 95% of kOS scripts will be autopilot stuff), and we add kOS to depends.
To make this work:
A base class ModAspect is added that holds tags and dependencies for an aspect and can apply them
CfgAspect is now refactored to inherit from ModAspect
New class FilenameAspect is similar to CfgAspect but calls analyzer.pattern_matches_any_filename instead of analyzer.pattern_matches_any_cfg
ModAnalyzer.pattern_matches_any_filename is created to check whether the given regex matches any of the filenames in the ZIP
If KSP-CKAN/NetKAN#9190 was resubmitted with these changes, the tags and depends would be set automatically.
I'll probably self-review this as with most ModAnalyzer stuff.
Motivation
KSP-CKAN/NetKAN#9190 revealed two things about the
ModAnalyzer
:This is undesirable because it suppresses the warning about tags, so a reviewer might think everything is fine when actually we need to add tags.
.ks
, which we could detect and handleChanges
tags
property, so reviewers will see the warning.ks
, we addconfig
andcontrol
totags
(since 95% of kOS scripts will be autopilot stuff), and we addkOS
todepends
. To make this work:ModAspect
is added that holds tags and dependencies for an aspect and can apply themCfgAspect
is now refactored to inherit fromModAspect
FilenameAspect
is similar toCfgAspect
but callsanalyzer.pattern_matches_any_filename
instead ofanalyzer.pattern_matches_any_cfg
ModAnalyzer.pattern_matches_any_filename
is created to check whether the given regex matches any of the filenames in the ZIPIf KSP-CKAN/NetKAN#9190 was resubmitted with these changes, the tags and depends would be set automatically.
I'll probably self-review this as with most
ModAnalyzer
stuff.