Skip to content

gp-import: creating groups of brackets for chord#33614

Merged
alexpavlov96 merged 1 commit into
musescore:mainfrom
alexpavlov96:gp_brackets_import
Jun 1, 2026
Merged

gp-import: creating groups of brackets for chord#33614
alexpavlov96 merged 1 commit into
musescore:mainfrom
alexpavlov96:gp_brackets_import

Conversation

@alexpavlov96
Copy link
Copy Markdown
Contributor

grouping notes by brackets during guitar pro import

Comment thread src/importexport/guitarpro/internal/utils.cpp
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 28, 2026

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: e3895573-8bec-4ab2-81ce-347b6c16d17c

📥 Commits

Reviewing files that changed from the base of the PR and between 1332ca6 and f785cf9.

📒 Files selected for processing (6)
  • src/importexport/guitarpro/internal/gtp/gpconverter.cpp
  • src/importexport/guitarpro/internal/importgtp-gp5.cpp
  • src/importexport/guitarpro/internal/utils.cpp
  • src/importexport/guitarpro/internal/utils.h
  • src/importexport/guitarpro/tests/data/ghost-note.gp-ref.mscx
  • src/importexport/guitarpro/tests/data/ghost-note.gpx-ref.mscx
✅ Files skipped from review due to trivial changes (2)
  • src/importexport/guitarpro/tests/data/ghost-note.gp-ref.mscx
  • src/importexport/guitarpro/internal/utils.h
🚧 Files skipped from review as they are similar to previous changes (4)
  • src/importexport/guitarpro/tests/data/ghost-note.gpx-ref.mscx
  • src/importexport/guitarpro/internal/utils.cpp
  • src/importexport/guitarpro/internal/gtp/gpconverter.cpp
  • src/importexport/guitarpro/internal/importgtp-gp5.cpp

📝 Walkthrough

Walkthrough

Adds createGhostNoteParenGroups(Chord*) to detect contiguous ghost-note runs and attach paired left/right parentheses via the engraving Factory, marks notes with HAS_PARENTHESES, and hides generated parentheses. Integrates this utility into GPConverter::convertNotes and GuitarPro5::readBeat (called after chord sorting). Updates GP/GPX test reference files to include hideGeneratedParentheses=1 on affected ghost Note elements.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The pull request description is minimal and lacks required template sections including issue resolution, motivation, CLA confirmation, and verification checklist. Expand description to include: issue number being resolved, detailed motivation for the changes, completed template checklist items, and confirmation of testing and compilation.
Docstring Coverage ⚠️ Warning Docstring coverage is 16.67% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title 'gp-import: creating groups of brackets for chord' accurately describes the main change: adding bracket grouping functionality for chords during Guitar Pro import.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/importexport/guitarpro/internal/importgtp-gp5.cpp`:
- Around line 390-394: cr may be nullptr after the note cleanup, so avoid
dereferencing it; change the block that currently does if (cr->isChord()) {
Chord* chord = toChord(cr); chord->sortNotes();
mu::iex::guitarpro::utils::createGhostNoteParenGroups(chord); } to first check
cr for null (e.g. if (cr && cr->isChord()) { ... }) or otherwise return/skip
when cr == nullptr so toChord(), chord->sortNotes(), and
createGhostNoteParenGroups() are only called on a valid Chord pointer.

In `@src/importexport/guitarpro/internal/utils.cpp`:
- Line 145: There is an extra blank line / codestyle violation in the insertion
around the function addParenthesesToNotes; run the project's uncrustify (or
code-style) script on src/importexport/guitarpro/internal/utils.cpp, fix the
blank-line/codestyle around the static void addParenthesesToNotes(Chord* ch,
const std::vector<Note*>& notes) block, and amend the commit so the file passes
checkcodestyle.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 5baeeb3a-f218-40a0-aab3-45424ed2d4ff

📥 Commits

Reviewing files that changed from the base of the PR and between 33b9d05 and b409255.

📒 Files selected for processing (6)
  • src/importexport/guitarpro/internal/gtp/gpconverter.cpp
  • src/importexport/guitarpro/internal/importgtp-gp5.cpp
  • src/importexport/guitarpro/internal/utils.cpp
  • src/importexport/guitarpro/internal/utils.h
  • src/importexport/guitarpro/tests/data/ghost-note.gp-ref.mscx
  • src/importexport/guitarpro/tests/data/ghost-note.gpx-ref.mscx

Comment thread src/importexport/guitarpro/internal/importgtp-gp5.cpp Outdated
Comment thread src/importexport/guitarpro/internal/utils.cpp
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/importexport/guitarpro/internal/utils.cpp`:
- Around line 146-157: The addParenthesesToNotes function currently always
appends a new NoteParenthesisInfo to a Chord, causing duplicate ghost-note
parentheses on reprocessing; modify addParenthesesToNotes (and the analogous
block used at lines 165-176) to first remove or skip any existing
NoteParenthesisInfo entries that were generated for the same set of Notes before
creating and adding a new one: fetch existing NoteParenthesisInfo objects from
the Chord (via ch->noteParenthesisInfo or equivalent accessor), compare their
note lists with the incoming notes (or mark generated entries with a flag),
remove matching/previously-generated entries from the chord (or return early if
already present), then create the two Parenthesis objects and add the new
NoteParenthesisInfo via ch->addNoteParenthesisInfo only when no duplicate
exists.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 72c76da2-b309-4544-8142-198fc3580ced

📥 Commits

Reviewing files that changed from the base of the PR and between b409255 and 1332ca6.

📒 Files selected for processing (6)
  • src/importexport/guitarpro/internal/gtp/gpconverter.cpp
  • src/importexport/guitarpro/internal/importgtp-gp5.cpp
  • src/importexport/guitarpro/internal/utils.cpp
  • src/importexport/guitarpro/internal/utils.h
  • src/importexport/guitarpro/tests/data/ghost-note.gp-ref.mscx
  • src/importexport/guitarpro/tests/data/ghost-note.gpx-ref.mscx
✅ Files skipped from review due to trivial changes (1)
  • src/importexport/guitarpro/tests/data/ghost-note.gp-ref.mscx
🚧 Files skipped from review as they are similar to previous changes (3)
  • src/importexport/guitarpro/internal/gtp/gpconverter.cpp
  • src/importexport/guitarpro/internal/importgtp-gp5.cpp
  • src/importexport/guitarpro/internal/utils.h

Comment thread src/importexport/guitarpro/internal/utils.cpp
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 28, 2026

Actionable comments posted: 0

@ingvarskagg ingvarskagg self-requested a review May 29, 2026 17:54
@alexpavlov96 alexpavlov96 merged commit 9686d5c into musescore:main Jun 1, 2026
14 checks passed
@alexpavlov96 alexpavlov96 deleted the gp_brackets_import branch June 1, 2026 23:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants