Conversation
Summary of ChangesHello @mr-tz, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces a significant refactoring to the way user settings are managed within the IDA Pro plugin for Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request updates the ida-settings API usage throughout the IDA plugin, replacing direct dictionary-style access with the new get_current_plugin_setting and set_current_plugin_setting functions. A helper function get_setting has been added to provide default values, which is a nice abstraction.
The changes are correct and also fix a bug in slot_settings where tuple unpacking was used incorrectly for assignment. I've suggested a small improvement in that same function to enhance readability and maintainability by unpacking the returned values into named variables before setting them.
Overall, this is a good refactoring that improves the code's consistency with the updated API.
mike-hunhoff
left a comment
There was a problem hiding this comment.
This looks reasonable to me, but I'm interested in hearing from @williballenthin if this is the intended use. I haven't had a chance to look into the recent changes to ida-settings.
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
williballenthin
left a comment
There was a problem hiding this comment.
as the API, yes exactly.
we'll also need to register the settings with the plugin, which allows:
- validation, and
- hcli to prompt during installation
unfortunately the only doc I have on this today is the example here: https://hcli.docs.hex-rays.com/reference/packaging-your-existing-plugin/, which is one of the reasons i hadn't proposed this PR yet 😉 that's ok though.
there's also the GUI settings manager now too, so perhaps capa could use that instead of its own settings dialog?
|
should we add this change before a new release or is it fine to adjust this afterwards as well? |
|
Would the plugin registration look like this? I guessed on the "integer" type. "settings": [
{
"key": "rule_path",
"type": "string",
"required": true,
"default": "",
"name": "rule path",
"documentation": "capa rules directory",
},
{
"key": "rulegen_author",
"type": "string",
"required": false,
"default": "<insert_author>",
"name": "rule author",
"documentation": "capa rule author",
},
{
"key": "rulegen_scope",
"type": "string",
"required": false,
"default": "function",
"name": "rule scope",
"documentation": "capa rule scope",
},
{
"key": "analyze",
"type": "integer",
"required": false,
"default": "0",
"name": "analysis option",
"documentation": "no auto analysis (0), auto analyze on plugin start and load cached results (1), auto analyze on plugin start and ask to load cached results (2)",
},
] |
I'd suggest that capa do a release before using the new ida-settings API, since it should work now with the legacy API. I think the ida-settings API should work, but given that I haven't even documented it yet, it's not fair to risk a capa release on it. If you want to push forward, thats ok, too, things should be fine, but I don't think it's any sort of rush. |
I think this looks pretty good, though for the analysis options, we could do something like: {
"key": "analyze",
"type": "string",
"required": false,
"default": "none",
"name": "auto-analysis",
"choices": ["none", "auto", "prompt"],
"documentation": "whether to analyze when first opening the plugin: 'never', 'auto', and 'prompt'",
}, |
Second, let's not rush this with the next capa release. |
closes #2736
currently untested (due some other local issues)
@williballenthin is this how envisioned this?
Checklist