Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor validators #204

Merged
merged 6 commits into from
Jun 12, 2024
Merged

Refactor validators #204

merged 6 commits into from
Jun 12, 2024

Conversation

sfmig
Copy link
Contributor

@sfmig sfmig commented Jun 4, 2024

Description

Suggestion to split validators into two modules.

What is this PR

  • Bug fix
  • Addition of a new feature
  • Other

Why is this PR needed?
We are thinking of ways to make it easier for contributors to add support to new files. Since this is a part of the codebase that may be visited often by external contributors, it may be nice to make it accessible and readable.

What does this PR do?
Splits the validators into two modules:

  • movement.io.validators.datasets: holds the classes for validating data intended for a movement dataset.
  • movement.io.validators.files: holds the classes for validating files.

References

\

How has this PR been tested?

Tests pass locally and on CI.

Is this a breaking change?

No.

Does this PR require an update to the documentation?

I modified the API reference to show validators for files and datasets separately, but open to suggestions if something else is preferred.

image

Checklist:

  • The code has been tested locally
  • [ n/a ] Tests have been added to cover all new functionality
  • The documentation has been updated to reflect any changes
  • The code has been formatted with pre-commit

Copy link

codecov bot commented Jun 4, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.68%. Comparing base (cf0a6b1) to head (3217584).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #204   +/-   ##
=======================================
  Coverage   99.68%   99.68%           
=======================================
  Files          11       12    +1     
  Lines         639      643    +4     
=======================================
+ Hits          637      641    +4     
  Misses          2        2           

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

@sfmig sfmig mentioned this pull request Jun 4, 2024
5 tasks
@sfmig sfmig marked this pull request as ready for review June 4, 2024 17:23
@sfmig sfmig requested a review from a team June 4, 2024 17:23
Copy link
Member

@niksirbi niksirbi left a comment

Choose a reason for hiding this comment

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

This is a good call, but I'm slightly wary of over-nesting modules. What do you think about movement.io.file_validators.py and movement.io.dataset_validators.py?
Alternatively, we could keep your names but move the validators folder out of io (thought currently they are mainly used for I/O): so movement.validators.files and movement.validators.datasets.

movement/io/validators/datasets.py Outdated Show resolved Hide resolved
movement/io/validators/datasets.py Outdated Show resolved Hide resolved
@niksirbi
Copy link
Member

niksirbi commented Jun 6, 2024

Now that I've thought more about it, I think movement.validators.files and movement.validators.datasets makes more sense. We are likely to also use validators in non I/O context, e.g. before performing a computation that assumes a valid dataset of one sort or another.

Copy link

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

@sfmig sfmig enabled auto-merge June 12, 2024 11:46
@sfmig sfmig requested a review from niksirbi June 12, 2024 11:46
Copy link
Member

@niksirbi niksirbi left a comment

Choose a reason for hiding this comment

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

LGTM!

@sfmig sfmig added this pull request to the merge queue Jun 12, 2024
Merged via the queue into main with commit 0114b91 Jun 12, 2024
17 checks passed
@niksirbi niksirbi deleted the smg/refactor-validators branch June 12, 2024 11:49
@niksirbi niksirbi mentioned this pull request Jun 12, 2024
7 tasks
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.

3 participants