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

Turn InfoField into a trait (big refactoring) #755

Merged
merged 23 commits into from
Sep 6, 2022
Merged

Conversation

o2sh
Copy link
Owner

@o2sh o2sh commented Aug 27, 2022

This PR introduces the InfoField trait which is implemented by all info lines.

Each implementation of InfoField lives in its own file and encapsulates its logic for formatting and data fetching. As a result, info/mod.rs and repo.rs (renamed to git.rs) are now considerably smaller.

Additional improvements:

  • Repo and InfoFieldOff structs were removed
  • Better Serialization to JSON and YAML
  • Increased test coverage ( codecov -->codecov)

@o2sh o2sh changed the title Turn InfoField into a trait Turn InfoField into a trait (big refactoring) Sep 3, 2022
Copy link
Collaborator

@spenserblack spenserblack left a comment

Choose a reason for hiding this comment

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

LGTM!

Just had one thought.

Comment on lines 66 to 69
InfoFieldValue {
r#type: InfoType::Dependencies,
value: self.dependencies.to_string(),
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

I wonder if .type should be an associated constant, and the return type of value simplified to just a String?

Copy link
Owner Author

@o2sh o2sh Sep 5, 2022

Choose a reason for hiding this comment

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

Very nice! Thanks for the hint, it simplifies things even more 46d67de

I also removed the InfoFieldValueGetter trait

@o2sh o2sh merged commit 066be27 into main Sep 6, 2022
@o2sh o2sh deleted the chore/refacto-info-fields branch September 6, 2022 10:12
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.

None yet

2 participants