D7915: Highlighting indexer: check existence of referenced context names
Dominik Haumann
noreply at phabricator.kde.org
Thu Sep 21 14:51:17 UTC 2017
dhaumann created this revision.
dhaumann added reviewers: Framework: Syntax Highlighting, cullmann.
Restricted Application added a project: Frameworks.
Restricted Application added a subscriber: Frameworks.
REVISION SUMMARY
This patch extends the highlighting indexer by collecting a list of all used and all existing context names.
If the used context names are NOT a subset of the existing context names, then we obviously reference an invalid non-existent context.
As test, I changed a rule in abc.xml to switch to context "Barbara", which does not exist. The checker now complains like this:
katehighlightingindexer(10738)/(default) {anonymous}::ContextChecker::check: "/home/dh/kde/kf5/src/frameworks/syntax-highlighting/data/syntax/abc.xml" Reference of non-existing contexts: QSet("Barbara")
It seems all our highlighting files are consistent, which is good. So we don't directly gain anything from this patch apart from catching context errors at compile-time instead of run-time.
This idea can be extended: For instance, we could also check the itemData names with the referenced attributes.
Comments?
TEST PLAN
make install
make test
REPOSITORY
R216 Syntax Highlighting
REVISION DETAIL
https://phabricator.kde.org/D7915
AFFECTED FILES
src/indexer/katehighlightingindexer.cpp
To: dhaumann, #framework_syntax_highlighting, cullmann
Cc: #frameworks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20170921/8c4c3164/attachment-0001.html>
More information about the Kde-frameworks-devel
mailing list