Skip to content

Refactored the Badges crate #675

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

Closed
wants to merge 3 commits into from
Closed

Conversation

Kixiron
Copy link
Member

@Kixiron Kixiron commented Apr 1, 2020

  • Updated dependencies
  • Transferred to the 2018 edition of Rust
  • Formatting
  • Un-ignored test and gitignored the file output by it (test.svg)

Copy link
Member

@jyn514 jyn514 left a comment

Choose a reason for hiding this comment

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

Thank you so much for the contribution! Everything in this refactor is good, but it tries to do too much at once. Please split this up into 2 PRs:

  1. Formatting and style changes (it looked like you ran clippy and rustfmt on badge alone which is fine)
  2. Updating the dependencies. We've been burned by this before, it should be separate so it's easy to revert if necessary.


[dependencies]
base64 = "0.9.0"
rusttype = "0.7"
Copy link
Member

Choose a reason for hiding this comment

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

Please do not update dependencies in a refactor PR. You can make a separate PR for this.

let mut file = File::create("test.svg").unwrap();
let options = BadgeOptions {
subject: "build".to_owned(),
status: "passing".to_owned(),
..BadgeOptions::default()
};
let badge = Badge::new(options).unwrap();

file.write_all(badge.to_svg().as_bytes()).unwrap();
Copy link
Member

Choose a reason for hiding this comment

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

I think a better idea might be to write the badge to memory instead of to disk. It would also be nice to compare it to a known good badge, but it would be fine even without.

@Kixiron Kixiron closed this Apr 1, 2020
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.

2 participants