Skip to content

add settings validation - #797

Merged
noviluni merged 6 commits into
scrapinghub:masterfrom
noviluni:add_settings_validation
Oct 27, 2020
Merged

noviluni merged 6 commits into
scrapinghub:masterfrom
noviluni:add_settings_validation

Conversation

@noviluni

@noviluni noviluni commented Sep 25, 2020 •

Copy link
Copy Markdown
Contributor

Adding settings validation in one single place. In that way, we can raise an error if there is misconfigurations and we ensure that the submitted settings are valid.

for: #796

It's not fully finished, as we need a way to get a list of the existing parsers.

I would prefer to get the "existing parsers" from another place (#798), but I think this can be refactored in the future.

@codecov

codecov Bot commented Sep 25, 2020 •

Copy link
Copy Markdown

Codecov Report

Merging #797 into master will increase coverage by 0.02%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #797      +/-   ##
==========================================
+ Coverage   98.22%   98.24%   +0.02%     
==========================================
  Files         231      231              
  Lines        2533     2569      +36     
==========================================
+ Hits         2488     2524      +36     
  Misses         45       45              
Impacted Files Coverage Δ
dateparser/conf.py 100.00% <100.00%> (ø)
dateparser/date.py 99.57% <100.00%> (-0.01%) ⬇️
dateparser/parser.py 98.99% <100.00%> (ø)
dateparser/freshness_date_parser.py 98.07% <0.00%> (+0.05%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b5e9bec...9a537a4. Read the comment docs.

@noviluni noviluni mentioned this pull request Sep 25, 2020
3 of 4 tasks
@noviluni noviluni added this to the v1.0.0 milestone Sep 25, 2020
@noviluni
noviluni marked this pull request as ready for review September 28, 2020 08:39
@noviluni
noviluni requested a review from Gallaecio September 28, 2020 08:40
Comment thread dateparser/conf.py Outdated

def _check_require_part(provided_list):
"""Returns `True` if the provided list of parts is valid"""
return not set(provided_list) - {'day', 'month', 'year'}

@noviluni noviluni Sep 29, 2020 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

should I check the length to avoid duplicated values?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think that would be great.

@noviluni
noviluni force-pushed the add_settings_validation branch from 8f71476 to aa916b5 Compare September 29, 2020 06:38
Comment thread dateparser/conf.py Outdated

def _check_require_part(provided_list):
"""Returns `True` if the provided list of parts is valid"""
return not set(provided_list) - {'day', 'month', 'year'}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think that would be great.

Comment thread dateparser/conf.py Resolved
Comment thread dateparser/conf.py Resolved
Comment thread dateparser/conf.py Resolved
Comment thread dateparser/conf.py Resolved
@noviluni

noviluni commented Oct 26, 2020 •

Copy link
Copy Markdown
Contributor Author

Hi @Gallaecio , I addressed all of your feedback, could you review it again?

Thank you!

@noviluni noviluni closed this Oct 26, 2020
@noviluni noviluni reopened this Oct 26, 2020
@noviluni

Copy link
Copy Markdown
Contributor Author

Note that this new behaviour will be documented in this PR: #722

@noviluni
noviluni merged commit 2908d21 into scrapinghub:master Oct 27, 2020
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.

2 participants