time/timeutil/time_range.go
Function ParseTimeRangeInterval
has 70 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func ParseTimeRangeInterval(s string) (TimeRange, error) {
s1 := strings.ToUpper(strings.TrimSpace(s))
m := rxParseTimeRange.FindStringSubmatch(s1)
if len(m) == 0 {
return TimeRange{}, fmt.Errorf("cannot parse time range rx (%s)", s)
Consider simplifying this complex logical expression. Open
Open
if (incStart && needle.Before(rangeStart)) ||
(needle.Before(rangeStart) || needle.Equal(rangeStart)) ||
(incEnd && needle.After(rangeEnd)) ||
(needle.After(rangeEnd) || needle.Equal(rangeEnd)) {
Consider simplifying this complex logical expression. Open
Open
if t.Before(tr.Min) || t.After(tr.Max) ||
(!inclusiveMin && t.Equal(tr.Min)) ||
(!inclusiveMax && t.Equal(tr.Max)) {
Method TimeRange.IntersectionDuration
has 5 return statements (exceeds 4 allowed). Open
Open
func (tr *TimeRange) IntersectionDuration(tr2 TimeRange) time.Duration {
tr.Normalize()
tr2.Normalize()
if tr2.Min.After(tr.Max) || tr2.Max.Before(tr.Min) {
// No overlap
Function ParseTimeRangeInterval
has 5 return statements (exceeds 4 allowed). Open
Open
func ParseTimeRangeInterval(s string) (TimeRange, error) {
s1 := strings.ToUpper(strings.TrimSpace(s))
m := rxParseTimeRange.FindStringSubmatch(s1)
if len(m) == 0 {
return TimeRange{}, fmt.Errorf("cannot parse time range rx (%s)", s)