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

removed json dependency #497

Merged
merged 1 commit into from
Oct 1, 2021
Merged

removed json dependency #497

merged 1 commit into from
Oct 1, 2021

Conversation

sneedcat
Copy link
Contributor

@sneedcat sneedcat commented Oct 1, 2021

removed json dependencies and updated some other dependencies

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.

and updated some other dependencies

It's good to keep dependencies up-to-date, but we use dependabot (e.g. #488), so we don't really need to manually update dependencies 🙂

⚠️ Warning: long rant ahead

I believe it is generally best to keep unrelated changes out of a commit/PR. One of the uses of commits is to find which change introduced a bug (I trust that this PR doesn't introduce any bugs, though 😄 ). There are several ways to find the commit that introduced a bug, like git bisect (this is a very cool tool that sadly flies under the radar of many git users, I highly recommend looking it up). But when unrelated changes are included in a commit, it becomes more difficult to find exactly what's wrong.
Let's say, for example, that this PR did introduce a bug, and it was caused by updating regex. If we did a git bisect and found commit eed3ccd, this is the diff that we would see.

- git2 = {version = "0.13.22", default-features = false}
+ git2 = {version = "0.13.23", default-features = false}
image = "0.23.14"
- json = "0.12.4"
- regex = "1.4.6"
+ regex = "1.5.4"

Looking at that diff, it isn't immediately obvious which change introduced a bug. But if you split this into 3 commits, remove json, update regex, and update git2, this is the diff that we would see.

- regex = "1.4.6"
+ regex = "1.5.4"

As a general rule that I use personally, if I have to use "and" to describe a commit (e.g. "removed json and updated other dependencies"), it might be worth separating into multiple commits. Don't take this rule too strictly, though.

tl;dr I would recommend just removing the json dependency, and leaving git2 and regex alone.

Comment on lines +84 to +88
let parsed: serde_json::Value = serde_json::from_str(contents)?;
match &parsed["dependencies"].as_object() {
Some(val) => Ok(val.len()),
None => Ok(0),
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

👍 Thanks for this! I agree that using the existing dependency is better than adding a new dependency

revert update dependencies
@sneedcat
Copy link
Contributor Author

sneedcat commented Oct 1, 2021

I believe it is generally best to keep unrelated changes out of a commit/PR. One of the uses of commits is to find which change introduced a bug (I trust that this PR doesn't introduce any bugs, though 😄 ). There are several ways to find the commit that introduced a bug, like git bisect (this is a very cool tool that sadly flies under the radar of many git users, I highly recommend looking it up). But when unrelated changes are included in a commit, it becomes more difficult to find exactly what's wrong. Let's say, for example, that this PR did introduce a bug, and it was caused by updating regex. If we did a git bisect and found commit eed3ccd, this is the diff that we would see.

Sorry for taking up your time and thanks for the advice, I'll keep it in mind in the future. I reversed the dependency update and left only the removal of the json dependency.

@spenserblack
Copy link
Collaborator

Sorry for taking up your time

Don't worry about it, I chose to write that long rant when I could've just written the tl;dr. Sorry for taking up your time by making you read all that 🤣

@o2sh o2sh merged commit 94a100a into o2sh:main Oct 1, 2021
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