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

added null checks to NewCarbonInterval #73

Merged
merged 4 commits into from
Jan 17, 2024

Conversation

ashwek
Copy link
Contributor

@ashwek ashwek commented Feb 20, 2022

package main

import "github.com/uniplaces/carbon"

func main() {
	carbon.NewCarbonInterval(nil, nil)
}

This simple code would panic because there are no null checks in NewCarbonInterval.

return nil, errors.New("The end date must be greater than the start date.")

According to Go Code Review Comments

Error strings should not be capitalized (unless beginning with proper nouns or acronyms) or end with punctuation, since they are usually printed following other context.

@rntdrts
Copy link
Contributor

rntdrts commented Apr 16, 2022

Hi @ashwek, thank you for contributing. Can you please add tests as well?

@codecov
Copy link

codecov bot commented Apr 28, 2022

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (ce063dd) 89.11% compared to head (981f9df) 89.45%.
Report is 10 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master      #73      +/-   ##
==========================================
+ Coverage   89.11%   89.45%   +0.34%     
==========================================
  Files           3        4       +1     
  Lines         634      645      +11     
==========================================
+ Hits          565      577      +12     
  Misses         44       44              
+ Partials       25       24       -1     

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

@ashwek
Copy link
Contributor Author

ashwek commented Jan 17, 2024

@rntdrts added test cases. Can you please review the changes

@rntdrts rntdrts merged commit cacaeb0 into uniplaces:master Jan 17, 2024
6 checks passed
@ashwek ashwek deleted the carbon-interval-null-checks branch January 17, 2024 05:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants