calendar.go ×9

Frontier kind: Code frontier

unlabeled · c_68f101ce6898

27 tests · 2286 LOC · 112 files · introduces 0 tests · 21 LOC · 1 file

Introduces — evidence that enters the hierarchy at this concept

Code
9 ranges21 lines · 1 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
333 ranges2286 lines · 112 files · Browse complete extent
All tests (intent)
27 testsBrowse complete intent

Neighbourhood graph

The orange circle is the focus. Violet and green circles are every ancestor and descendant, broader and narrower, at any distance; blue squares and pink diamonds are the introduced files and exact introduced tests of every visible concept, not only the focus's. Arrows point from broader to narrower concepts and bridge only concepts omitted from this view. Undirected links show source or test introduction. Concept and file size follows LOC; exact test nodes use test-count units.

Introduced files, introduced tests, and structurally relevant concept specialization

In the embedded map, ordinary wheel input scrolls the page; use the visible controls to zoom and drag to pan. Open the full-screen map for canvas navigation: wheel pans, Ctrl/Command plus wheel zooms, and arrow keys pan when this region is focused. On touch screens, open the full-screen map to pan or pinch. If JavaScript or WebGL is unavailable, use the native relationship evidence on this page.

Graph controls are ready.

Interactive rendering requires JavaScript and WebGL. Use the native relationship evidence on this page while the interactive map is unavailable.

Native relationship evidence

Every exact file and test below is linked only from the concept that introduces it.

Introduced tests

Every collected test enters the hierarchy at exactly one concept.

No tests are introduced at this concept. Its intent tests are introduced by other concepts.

Introduced code

Every collected source range enters the hierarchy at exactly one concept.

1 file ranked by introduced lines: 21 introduced LOC across 9 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

go.temporal.io/server/service/worker/scheduler/calendar.go 21 introduced LOC · 9 ranges

Open complete file

408 //
409 //revive:disable-next-line:cognitive-complexity
410 > func makeRange(s, field, def string, minVal, maxVal int, parseMode parseMode) ([]*schedulepb.Range, error) { calendar.go
411 > s = strings.TrimSpace(s)
412 > if s == "" {
413 s = def
414 }
415 > if s == "*" && parseMode == parseModeYear { calendar.go
416 return nil, nil // special case for year: all is represented as empty range list
417 }
418 > var ranges []*schedulepb.Range calendar.go
419 > for part := range strings.SplitSeq(s, ",") {
420 > var err error
421 > step := 1
422 > hasStep := false
423 > slashes := strings.Count(part, "/")
424 > if slashes > 1 {
425 // Inputs like "3/5/7" should yield the canonical "too many slashes" error
426 // (instead of a later strconv parse error) so tests get consistent results.
427 return nil, fmt.Errorf("%s has too many slashes", field)
428 }
429 > if slashes == 1 { calendar.go
430 // A single slash introduces an integer step.
431 skipParts := strings.SplitN(part, "/", 2)
445 }
446
447 > start, end := minVal, maxVal calendar.go
448 > if part != "*" {
449 if strings.Contains(part, "-") {
450 // Only a single dash is allowed to denote a range (e.g. "1-5").
485 // 0, and then turn the 7 into a 6 in whatever the original range was. If the original
486 // range was just 7-7, then we're done.
487 > if parseMode == parseModeDow && end == 7 { calendar.go
488 if (7-start)%step == 0 && (step > 1 || step == 1 && start > 1) {
489 ranges = append(ranges, &schedulepb.Range{Start: int32(0)})
494 end = 6
495 }
496 > if start == end { calendar.go
497 end = 0 // use default value so proto is smaller
498 }
499 > if step == 1 { calendar.go
500 > step = 0 // use default value so proto is smaller
501 > }
502 > ranges = append(ranges, &schedulepb.Range{Start: int32(start), End: int32(end), Step: int32(step)})
503 }
504 > return ranges, nil calendar.go
505 }
506