Skip to content

Validate parser names against the parsers that exist - #1395

Merged
AdrianAtZyte merged 5 commits into
scrapinghub:masterfrom
AdrianAtZyte:parser-names
Oct 20, 2026
Merged

AdrianAtZyte merged 5 commits into
scrapinghub:masterfrom
AdrianAtZyte:parser-names

Conversation

@AdrianAtZyte

@AdrianAtZyte AdrianAtZyte commented Sep 22, 2026 •

Copy link
Copy Markdown
Member

Fixes #798.

@codspeed

codspeed Bot commented Sep 22, 2026 •

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 9 untouched benchmarks


Comparing AdrianAtZyte:parser-names (ad35594) with master (28baed8)

Open in CodSpeed

@AdrianAtZyte
AdrianAtZyte marked this pull request as ready for review September 22, 2026 22:20
@codecov

codecov Bot commented Sep 22, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.98%. Comparing base (eb27abd) to head (ad35594).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1395      +/-   ##
==========================================
+ Coverage   98.97%   98.98%   +0.01%     
==========================================
  Files         239      239              
  Lines        3610     3759     +149     
==========================================
+ Hits         3573     3721     +148     
- Misses         37       38       +1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@serhii73 serhii73 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Code review (claude code-review, at 70ff64f). No correctness issue found in the validation itself.

Non-blocking notes:

  • The registry stores method names as strings and resolves them with getattr. A renamed _try_* method would pass _check_parsers and only fail with AttributeError when a date reaches that parser. A test asserting every registered name resolves to an attribute (and that every name in default_parsers is registered) would catch that in CI.
  • _check_parsers imports dateparser.date from inside the function, which hides a conf -> date cycle. The list of valid names could live next to default_parsers in dateparser_data/settings.py so both modules import it.
  • default_parsers is still hand-maintained and not tied to the registry.
  • The error message joins an unordered set; sorted(unknown_parsers) would make it deterministic.

@AdrianAtZyte AdrianAtZyte reopened this Oct 20, 2026
@AdrianAtZyte
AdrianAtZyte merged commit a785d6f into scrapinghub:master Oct 20, 2026
33 of 34 checks passed
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.

We can't get a list of the existing parsers (only the default_parsers)

2 participants