check-code-quality
You are performing static code quality analysis on the Scopy package: `$ARGUMENTS`
You are creating a JavaScript API class for a Scopy plugin so it can be controlled from test automation scripts.
> /plugin marketplace add analogdevicesinc/scopy > /plugin install scopy_dev_plugin@scopy-plugins
How it fires
How this command gets triggered: by you, by Claude, or both.
/create-apiContext preview
What this command does when you run it.
You are creating a JavaScript API class for a Scopy plugin so it can be controlled from test automation scripts.
You are creating a JavaScript API class for a Scopy plugin so it can be controlled from test automation scripts.
**Plugin:** `$ARGUMENTS`
Use the Read tool to check if a port state file exists:
Locate the plugin's source files by checking these paths in priority order:
**If state file exists**, use it as the inventory: extract the plugin class name, namespace, tool list IDs, and section/attribute inventory.
**If no state file**, discover directly:
**Also read the tool implementation** (`<plugin>.cpp` in `src/`) to catalogue every IIOWidget's conversion setup. For each widget, note:
Also check if an API already exists (use the Glob tool to search for `*_api.h` in the plugin's package dir). If found, switch to **Update Mode** (see below).
When an API class already exists, do NOT stop. Instead:
1. **Read all existing API files** (header + source) and the plugin header/source. 2. **Run all A1–A7 checks** from the `api-quality-checks` skill against the existing code (same as `/validate-api`). 3. **Check for missing coverage**: Compare every IIOWidget discovered in Step 1 against the existing API methods. Flag any widgets that lack getter/setter pairs. 4. **Present a fix plan** listing:
5. **AUTO-APPROVE and proceed** — apply all fixes to the existing API files:
6. Continue to **Step 4: Validate** below to confirm all checks pass after fixes.
Do NOT regenerate the API from scratch — fix the existing code in place.
After reading the plugin header, source, and instrument classes, present:
1. **API pattern chosen** (Pattern A: tool-based, Pattern B: IIOWidgetGroup-based, or both) 2. **Complete method list** grouped by instrument/category:
For each getter/setter pair, also document a **conversion row**: | Method | IIO unit | API unit | Getter conversion | Setter conversion | 3. **Missing Functionality Report** — things that CAN'T be exposed without base-class changes 4. **Files to create/modify**:
**Wait for user approval before writing any code.**
Follow the API patterns described in the `scopy-api-patterns` knowledge skill:
`IIOWidget::writeAsync()` writes directly to the IIO data strategy — it does **NOT** apply `m_UItoDS`. Similarly, `read().first` returns the raw IIO value, not the UI-displayed value. Getters and setters MUST replicate the conversion logic from `setDataToUIConversion` / `setUItoDataConversion` lambdas found in the tool class.
**Frequency (Hz ↔ MHz):**
// Getter: divide raw Hz string by 1e6
QString getXxx() {
QString raw = readFromWidget(key);
if(raw.isEmpty()) return raw;
return QString::number(raw.toDouble() / 1e6, 'f', 3);
}
// Setter: multiply MHz value by 1e6 before writing
void setXxx(const QString &val) {
writeToWidget(key, QString::number(val.toDouble() * 1e6, 'f', 0));
}**IIO unit suffix (e.g. " dB" appended by IIO driver to hardwaregain):**
// Getter: strip the trailing suffix before returning
QString getXxx() {
QString raw = readFromWidget(key);
int idx = raw.indexOf(" dB");
if(idx != -1) raw = raw.left(idx).trimmed();
return raw;
}
// Setter: write numeric string only (IIO accepts without suffix)
void setXxx(const QString &val) { writeToWidget(key, val); }**dBFS ↔ linear scale (e.g. IIO stores 0.5 linear, UI shows 6 dBFS):**
#include <cmath>
// Getter: linear → dBFS (round to nearest integer)
QString getXxx() {
QString raw = readFromWidget(key);
if(raw.isEmpty())You are performing static code quality analysis on the Scopy package: `$ARGUMENTS`
**Recommended model:** Opus — this command performs deep codebase exploration and multi-step reasoning to produce high-quality…
You are creating JavaScript automated test scripts for a Scopy plugin, mapping RST manual test cases to API calls.
You are creating Sphinx RST documentation for a Scopy plugin user guide.
You are creating Sphinx RST test case documentation for a Scopy plugin, following the established test documentation format.
You are creating JavaScript unit test scripts for a Scopy plugin that test every IIOWidget attribute via…