-
Notifications
You must be signed in to change notification settings - Fork 63
Do not validate for http:// URLs in elements and attributes that are … #2094
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Do not validate for http:// URLs in elements and attributes that are … #2094
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes seem to fix the issue for Atmel/Microchip, but not sure if this approach is a too generic.
I'd suggest the following:
/**
* @brief visitor callback for files found in PDSC description
* @param item RteItem file item
* @return VISIT_RESULT
*/
VISIT_RESULT CheckFilesVisitor::Visit(RteItem* item)
{
const string& tag = item->GetTag();
if(tag == "environment") {
return VISIT_RESULT::SKIP_CHILDREN;
}
m_checkFiles.CheckFile(item);
m_checkFiles.CheckUrls(item);
m_checkFiles.CheckDeprecated(item);
m_checkFiles.CheckDescription(item);
m_checkFiles.GatherIncPathVsAttrConfig(item);
m_checkFiles.CheckCSolutionEntries(item);
return VISIT_RESULT::CONTINUE_VISIT;
}
Please also change the test file to be more generic (no references to an existing vendor).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(comment merged, but cannot delete)
Specific environments should be ignored
tools/packchk/test/data/TestUrlHttps/TestVendor.TestUrlHttps.pdsc
Outdated
Show resolved
Hide resolved
Test Results 6 files 12 suites 11s ⏱️ Results for commit e631eed. ♻️ This comment has been updated with latest results. |
@thorstendb-ARM So this is not generic enough... A namespace can be declared at any level of the DOM, and thus there might be other url-like things... Now, maybe the more correct thing is to just not parse anything namespace-like into the RTE model? |
009d79f to
df40b60
Compare
tools/packchk/test/data/TestUrlHttps/TestVendor.TestUrlHttps.pdsc
Outdated
Show resolved
Hide resolved
The CMSIS Pack Description format does (currently) not use any namespaces. The extension point
The RTE Model is written as a generic library, it reads everything that is in the pdsc file and presents it to a consumer. |
|
The thing that still bugs me is, the checking of xmlns: attributes which are allowed to be on any element which will declare a namespace is still being validated and forced to be https, which is really not what the original check intended to verify... But just ignoring most environments works for me specifically so good enough for me 😉 |
…definitiely part of a different namespace Since the XML parser does not seem to have much support at all for namespaces, this fix is very ... raw in that it only looks for a namespace delimintor `:` and if we find that in a element, mark it as ok. If we find it in an attribute, do not check it. This fixes Open-CMSIS-Pack#2093 Make the test namespace generic
df40b60 to
abfeb20
Compare
edriouk
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good for me, thanks you for contribution
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2094 +/- ##
==========================================
- Coverage 65.37% 65.32% -0.06%
==========================================
Files 182 182
Lines 37096 37099 +3
Branches 21561 21562 +1
==========================================
- Hits 24252 24234 -18
- Misses 8458 8480 +22
+ Partials 4386 4385 -1
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
…definitely part of a different namespace
Since the XML parser does not seem to have much support at all for namespaces, this fix is very ... raw in that it only looks for a namespace delimiter
:and if we find that in an element, mark it as ok. If we find it in an attribute, do not check it.This fixes #2093