Addition of Saving and Loading of Filter Presets#4755
Addition of Saving and Loading of Filter Presets#4755feyruzb wants to merge 36 commits intoEricsson:masterfrom
Conversation
There was a problem hiding this comment.
Overall good work, I've found only minor issues (even nitpicks) which can be fixed in no time. Please check the TODOs and comments with question marks and make them clear for the future. What I'm missing are the tests for the new functions. Please check them and write tests in the corresponding unit test folders.
web/api/completly-rebuild-thrift.sh
Outdated
| export PATH="$HOME/codechecker/build/CodeChecker/bin:$PATH" | ||
|
|
||
| echo "CodeChecker rebuild completed successfully!" | ||
| echo "You can now use CodeChecker commands." No newline at end of file |
There was a problem hiding this comment.
Add a new line to the end of the file, git can complain about missing new lines at the end of any text files.
web/api/report_server.thrift
Outdated
| // if the id is -1 a new preset filter is created | ||
| // the filter preset name must be unique. | ||
| // An error must be thrown if another preset exists with the same name. | ||
| // The encoding of the name must be unicode. (whitespaces allowed?) |
There was a problem hiding this comment.
In this line, "whitespaces allowed?" suggests me that this part is not yet complete. Please decide if either allowed or not and edit the comment accordingly.
| // Filter grouping api calls. | ||
| //============================================ | ||
|
|
||
| // Stores the given FilterPreset with the given id |
There was a problem hiding this comment.
I got a few questions / remarks regarding this part:
- Does it check the id of the incoming FilterPreset to decide if it exists or not? If so, please modify the first line accordingly (e.g. "If
thea preset exists with the given id, it overwrites the name, and all preset values.") - Fix the second line to match the first: "If the preset does not exist yet, it creates it with the given id.".
- The line "if the id is -1 a new preset filter is created" is confusing so if I add -1 as an id, it forcibly creates the filter? And if so, what will be the actual id after creation?
- Please make all new sentences start with a capital letter and finish with a dot.
web/api/report_server.thrift
Outdated
| FilterPreset getFilterPreset(1: i64 id) | ||
| throws (1: codechecker_api_shared.RequestFailed requestError); | ||
|
|
||
| // Removes the filterpreset with the given id |
There was a problem hiding this comment.
It should be written as "FilterPreset" to be uniform to the other comments.
| description=description)) | ||
| return results | ||
|
|
||
| # Stores the given FilterPreset with the given id |
There was a problem hiding this comment.
I suggest you do the same modifications I've suggested above for the same comment.
| if preset is None: | ||
| return None | ||
|
|
||
| # convert ORM to dict for ReportFilter |
There was a problem hiding this comment.
| # convert ORM to dict for ReportFilter | |
| # Convert ORM to dict for ReportFilter |
| if not token: | ||
| return "" | ||
|
|
||
| # special case for formatting confirmed bug. IN UI for some reason |
There was a problem hiding this comment.
| # special case for formatting confirmed bug. IN UI for some reason | |
| # Special case for formatting confirmed bug. IN UI for some reason |
| session.add(preset_entry) | ||
| session.commit() | ||
| return int(preset_entry.id) | ||
| return -1 |
There was a problem hiding this comment.
Not a terrible thing but some linters may complain about using magic numbers. You could create a const for it either here or in a global file (there might be already a file for status and error codes in codechecker) which you could use as a return value. E.g. FILTER_PRESET_ERROR = -1 or similar.
| Delete preset from products list based on preset_id. | ||
| """ | ||
| self.__require_admin() | ||
| LOG.info("deleting filter preset by id") |
There was a problem hiding this comment.
| LOG.info("deleting filter preset by id") | |
| LOG.info("Deleting filter preset by ID") |
| Returns the FilterPreset identified by id. | ||
| """ | ||
| self.__require_view() | ||
| LOG.info("Returning filter Preset by id") |
There was a problem hiding this comment.
| LOG.info("Returning filter Preset by id") | |
| LOG.info("Returning filter Preset by ID") |
|
One more thing which I've missed: Besides the unit tests, please also write functional tests, for the API too. |
3383a3f to
a738d47
Compare
e9bf3e3 to
024a4a2
Compare
024a4a2 to
08900d2
Compare
ab9bbd4 to
288e2e7
Compare
8a0ecce to
4560dd2
Compare
c8dfa22 to
29fa58a
Compare
29fa58a to
009748f
Compare
This PR adds a filter preset feature to CodeChecker. Users can now create, name, save, and reapply filter configurations for analysis results. Changes touch the Thrift API, server, CLI, frontend, database, and docs.
Filter Preset Feature
Thrift API
Server
Database
CLI
Frontend
Versioning
Docs
Tests