| Summary: | Non-functional exclusion filters for code analysis | ||
|---|---|---|---|
| Product: | [Tools] CDT | Reporter: | Dennis Schieferdecker <master_of_past_and_present> |
| Component: | cdt-codan | Assignee: | CDT Codan Inbox <cdt-codan-inbox> |
| Status: | NEW --- | QA Contact: | Elena Laskavaia <elaskavaia.cdt> |
| Severity: | normal | ||
| Priority: | P3 | CC: | cdtdoug, exnadler, freddie_chopin, gonzague.reydet, Jean-Christophe.Weill, malaperle, tobias_henkel, yevshif, zeratul976 |
| Version: | 8.0 | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Linux | ||
| See Also: |
https://git.eclipse.org/r/43344 https://git.eclipse.org/c/cdt/org.eclipse.cdt.git/commit/?id=5d2f7bcb56bc4d61a97e2c248d8c573540cc80a5 https://git.eclipse.org/r/43378 https://git.eclipse.org/c/cdt/org.eclipse.cdt.git/commit/?id=d755ace3ccfa19a7ca654df494b6704cf70aac34 |
||
| Whiteboard: | |||
|
Description
Dennis Schieferdecker
This is still true in Eclipse 4.4 (i.e. CDT 8.4.0) The problem lies in function org.eclipse.cdt.codan.core.param.FileScoreProblemPreferences.matchesFilter that receive file path with leading '/' (Unix's directory separator) and that the ui does not accept file pattern for exclusion beginning with '/'. (In reply to Jean-Christophe Weill from comment #1) > This is still true in Eclipse 4.4 (i.e. CDT 8.4.0) > > The problem lies in function > org.eclipse.cdt.codan.core.param.FileScoreProblemPreferences.matchesFilter > > that receive file path with leading '/' (Unix's directory separator) and > that the ui does not accept file pattern for exclusion beginning with '/'. And one (dirty) solution was to edit org.eclipse.cdt.codan.internal.ui.dialogs.ExclusionInclusionEntryDialog.java then I commented lignes 173 to 175 if (path.isAbsolute() ...) { } So this allows now absolute path and now Filters can match! I use filter like /**/src/foo.cpp instead of **/src/foo.cpp -- JC Seeing something as trivial failing to work properly on Linux, especially after 3 years from the first report is a bit sad ); If you really need it fixed, you are welcome to submit a path to CDT using a proper channel - gerrit reviews https://wiki.eclipse.org/CDT/contributing That's of course true, but I'd have to know java and Eclipse's internals to do so, and neither of these is the case here... New Gerrit change created: https://git.eclipse.org/r/43344 There were two mismatches between the pattern in the exclusion filter, and the resource path being tested against it:
- The first was relative to the workspace root, while the second
was relative to the filesystem root. I fixed this by making
the second relative to the workspace root as well, by using
IResource.getFullPath() instead of IResource.getLocation() to
obtain it.
- The resource path had a leading slash (i.e. was an absolute path,
even with my first change), while the pattern didn't (i.e. was a
relative path). I fixed this by calling makeRelative() on the
resource path, making it a relative path.
Great - I hope this change will make it to the next release! Thanks a lot! Gerrit change https://git.eclipse.org/r/43344 was merged to [master]. Commit: http://git.eclipse.org/c/cdt/org.eclipse.cdt.git/commit/?id=5d2f7bcb56bc4d61a97e2c248d8c573540cc80a5 New Gerrit change created: https://git.eclipse.org/r/43378 Gerrit change https://git.eclipse.org/r/43378 was merged to [master]. Commit: http://git.eclipse.org/c/cdt/org.eclipse.cdt.git/commit/?id=d755ace3ccfa19a7ca654df494b6704cf70aac34 |