Skip to content

Standardize map lookup pattern in ElementDB - #8660

Merged
timosachsenberg merged 2 commits into
developfrom
copilot/apply-dry-principle
Jan 15, 2026
Merged

timosachsenberg merged 2 commits into
developfrom
copilot/apply-dry-principle

Conversation

Copilot AI commented Jan 14, 2026 •

Copy link
Copy Markdown
Contributor

The ElementDB::hasElement methods used inconsistent patterns for checking map membership: .count() == 1 in one overload and .find() != .end() in another.

Changes

  • Replaced .count() == 1 with .find() != .end() in hasElement(const string& name) (line 82)
  • Both hasElement overloads now use the same pattern, consistent with all other map lookups in the file (lines 57, 63, 73, 87, 628, 663)

Before:

bool ElementDB::hasElement(const string& name) const
{
  return (names_.count(name) == 1) || (symbols_.count(name) == 1);
}

After:

bool ElementDB::hasElement(const string& name) const
{
  return (names_.find(name) != names_.end()) || (symbols_.find(name) != symbols_.end());
}
Original prompt

apply DRY


💡 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.

@coderabbitai

coderabbitai Bot commented Jan 14, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


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

Copilot AI changed the title [WIP] Refactor code to apply DRY principle Standardize map lookup pattern in ElementDB Jan 14, 2026
Copilot AI requested a review from timosachsenberg January 14, 2026 20:12
@timosachsenberg
timosachsenberg marked this pull request as ready for review January 14, 2026 20:16
@timosachsenberg
timosachsenberg enabled auto-merge (squash) January 14, 2026 20:42
@timosachsenberg
timosachsenberg merged commit 39ed132 into develop Jan 15, 2026
@timosachsenberg
timosachsenberg deleted the copilot/apply-dry-principle branch January 15, 2026 05:58
claude Bot pushed a commit that referenced this pull request Jan 18, 2026
Added 19 missing PRs to OpenMS 3.6.0 changelog:

PyOpenMS:
- #8530: Build system modernization with py-build-cmake
- #8633: SpectrumNativeIDParser wrapper
- #8655: Arrow/Parquet export with DataFrame methods (BREAKING: method renames)
- #8661: Build dependency docs
- #8664: Biosaur2Algorithm wrap-inherits
- #8668: wrap-doc documentation
- #8674: Docstring validation tests

TOPP tools:
- #8643: FileInfo FASTA stats
- #8650: FileConverter MSP support
- #8649: PeakPickerHiRes parameter

OpenMS Library:
- #8633: SpectrumNativeIDParser class
- #8655: ArrowExport helper
- #8651, #8656, #8659, #8660, #8662: Performance optimizations

Fixes:
- #8645: DataArray handling in filters
- #8672: Test file correction
- #8678: UniqueIdGenerator seed collision fix

Build System:
- #8675, #8676: Claude CI workflows

Also reorganized misplaced entries from lines 122-129.

Co-authored-by: Timo Sachsenberg <[email protected]>
timosachsenberg added a commit that referenced this pull request Jan 18, 2026
* Add comprehensive changelog for OpenMS 3.6.0

Includes changes from 96 merged PRs since version 3.5.0:

- General: macOS Intel discontinued, Ubuntu 24.04, notarization in CI
- Dependencies: Autowrap >= 0.26.0, Eigen minimum 3.4.0
- PyOpenMS: Pythonic methods (__len__, __str__, __repr__, __hash__),
  DataFrame support, new wrappers, string handling improvements
- TOPP tools: MapAligner spectra transformation, FileInfo improvements,
  IsobaricWorkflow fixes, SageAdapter thread handling
- OpenMS Library: PeakFileOptions, ParamIterator, SpectrumAnnotator
- Breaking changes: Matrix<T> Eigen decoupling, API renames, FileWatcher move
- Bug fixes: NucleicAcidSearchEngine, LogConfigHandler, decoy generation
- Documentation: Targeted Quantitation, parameter annotations, AGENTS.md
- Build: macOS notarization, Parquet support, pytest fixtures

Co-Authored-By: Claude Opus 4.5 <[email protected]>

* Add missing changelog entries for recently merged PRs

Added 19 missing PRs to OpenMS 3.6.0 changelog:

PyOpenMS:
- #8530: Build system modernization with py-build-cmake
- #8633: SpectrumNativeIDParser wrapper
- #8655: Arrow/Parquet export with DataFrame methods (BREAKING: method renames)
- #8661: Build dependency docs
- #8664: Biosaur2Algorithm wrap-inherits
- #8668: wrap-doc documentation
- #8674: Docstring validation tests

TOPP tools:
- #8643: FileInfo FASTA stats
- #8650: FileConverter MSP support
- #8649: PeakPickerHiRes parameter

OpenMS Library:
- #8633: SpectrumNativeIDParser class
- #8655: ArrowExport helper
- #8651, #8656, #8659, #8660, #8662: Performance optimizations

Fixes:
- #8645: DataArray handling in filters
- #8672: Test file correction
- #8678: UniqueIdGenerator seed collision fix

Build System:
- #8675, #8676: Claude CI workflows

Also reorganized misplaced entries from lines 122-129.

Co-authored-by: Timo Sachsenberg <[email protected]>

---------

Co-authored-by: Claude Opus 4.5 <[email protected]>
Co-authored-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com>
Co-authored-by: Timo Sachsenberg <[email protected]>
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.

2 participants