Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 24, 2025

Remove-me-section

  • Notify reviewers about the pull request
  • Keep only necessary sections below for the review

Generic request

  • PR name follows the pattern #1234 – issue name
  • branch name does not contain '#'
  • base branch (master or release/xx) is correct
  • PR is linked with the issue
  • task status changed to "Code review"
  • code follows product standards
  • regression tests updated

For release/xx branch

  • backmerge to master (or newer release/xx) branch is created

Optional

  • unit-tests written
  • documentation updated

Backmerge request

  • PR name follows the pattern Backmerge: #1234 – issue name
  • PR is linked with the issue
  • base branch (master or release/xx) is correct
  • code contains only backmerge changes

Bump request

  • PR name follows the pattern Bump version to ...
  • add brackets [ ] for 'skip ci' and put it into the body
  • milestone is linked to PR
  • all tickets are closed inside the relevant milestone

query_molecule.cpp exceeded the size threshold and concentrated multiple responsibilities. This refactor splits it into focused translation units while preserving behavior.

  • Changes

    • Moved node/atom/bond implementations, cloning, merging, and constraint logic into query_molecule_nodes.cpp.
    • Moved query atom/bond parsing helpers, SMARTS list handling, and bond-type derivation into query_molecule_parsing.cpp.
    • Trimmed query_molecule.cpp to orchestrate higher-level query molecule logic and includes.
    • Applied repository clang-format and enforced include order guards on the new translation units.
  • Example

// Previously in query_molecule.cpp, now in query_molecule_parsing.cpp
bool QueryMolecule::_isAtomOrListAndProps(Atom* p_query_atom,
                                          std::vector<std::unique_ptr<Atom>>& list,
                                          bool& neg,
                                          std::map<int, std::unique_ptr<Atom>>& properties);
Original prompt

This section details on the original issue you should resolve

<issue_title>query_molecule.cpp has 2,740 lines of code, which is greater than 2,000 authorized. Split it into smaller files</issue_title>
<issue_description>Problem:
core/indigo-core/molecule/src/query_molecule.cpp has 2,740 lines of code, which is greater than 2,000 authorized. Split it into smaller files.

Why is this an issue?
A source file that grows too much tends to aggregate too many responsibilities and inevitably becomes harder to understand and therefore to maintain. Above a specific threshold, it is strongly advised to refactor it into smaller pieces of code which focus on well defined tasks. Those smaller files will not only be easier to understand but also probably easier to test.

Problem locations:
core/indigo-core/molecule/src/query_molecule.cpp</issue_description>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI self-assigned this Dec 24, 2025
Co-authored-by: AlexeyGirin <26869421+AlexeyGirin@users.noreply.github.com>
Copilot AI changed the title [WIP] Refactor query_molecule.cpp into smaller files Split query_molecule implementation into smaller translation units Dec 24, 2025
Copilot AI requested a review from AlexeyGirin December 24, 2025 07:11
@AlexeyGirin AlexeyGirin changed the title Split query_molecule implementation into smaller translation units #3416 query_molecule.cpp has 2,740 lines of code, which is greater than 2,000 authorized. Split it into smaller files Dec 24, 2025
@AlexeyGirin AlexeyGirin changed the title #3416 query_molecule.cpp has 2,740 lines of code, which is greater than 2,000 authorized. Split it into smaller files #3416 query_molecule.cpp has 2,740 lines of code, which is greater than 2,000 authorized. Split it into smaller files Dec 24, 2025
@AlexeyGirin AlexeyGirin marked this pull request as ready for review December 24, 2025 07:16
@AlexeyGirin
Copy link
Collaborator

@copilot you did changes in right direction but we need them to be clang formatted.
Please correct

Co-authored-by: AlexeyGirin <26869421+AlexeyGirin@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Dec 24, 2025

@copilot you did changes in right direction but we need them to be clang formatted.
Please correct

Formatted the new query_molecule sources with the repo clang-format and kept the main header first (commit 9cb6b39).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

query_molecule.cpp has 2,740 lines of code, which is greater than 2,000 authorized. Split it into smaller files

2 participants