Skip to content

Refactor long method importDatabase() in OvidImporter #14132

@merlinymy

Description

@merlinymy

Is your suggestion for improvement related to a problem? Please describe.
The importDatabase() method in OvidImporter has grown into a long method that mixes multiple functionalities including record splitting, per-field parsing, regex handling for Source fields, and final cleanup. This makes it harder to understand, test, and maintain.

Describe the solution you'd like
I’d like to refactor importDatabase() by extracting several small private helper methods (parseSource(), parseField(), normalizeContributors(), and resolveEntryType()) while preserving all current behavior and public APIs. The goal is purely to improve readability and separation of concerns, not to change functionality.

Additional context
This refactoring proposal was discussed and approved on the JabRef Gitter channel.

Would you prefer helper methods like these to be annotated with @VisibleForTesting and have direct unit tests, or should testing rely solely on the existing integration-level coverage for OvidImporter? I understand there are different schools of thought on this and would like to follow JabRef’s convention.

Metadata

Metadata

Assignees

Labels

dev: code-qualityIssues related to code or architecture decisions📍 AssignedAssigned by assign-issue-action (or manually assigned)🔔 reminder-sent

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions