Showing 159 of 159 total issues
Function UserToAbsolute
has 5 return statements (exceeds 4 allowed). Open
Open
func UserToAbsolute(file string) (string, error) {
file = strings.TrimSpace(file)
parts := strings.Split(file, string(os.PathSeparator))
if len(parts) == 0 {
return file, nil
Method String.UnmarshalJSON
has 5 return statements (exceeds 4 allowed). Open
Open
func (s *String) UnmarshalJSON(data []byte) error {
var a any
if err := json.Unmarshal(data, &a); err != nil {
panic(err)
Method MapStringInt.Sorted
has 5 return statements (exceeds 4 allowed). Open
Open
func (msi MapStringInt) Sorted(sortBy string) []Record {
sortBy = strings.ToLower(strings.TrimSpace(sortBy))
records := []Record{}
for name, count := range msi {
records = append(records, Record{Name: name, Value: count})
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 ReadImageHTTP
has 5 return statements (exceeds 4 allowed). Open
Open
func ReadImageHTTP(imageURL string) (image.Image, string, error) {
imageURL = strings.TrimSpace(imageURL)
if !urlutil.IsHTTP(imageURL, true, true) {
return nil, "", errors.New("url is not valid")
}
Function NumQuartersInt32
has 5 return statements (exceeds 4 allowed). Open
Open
func NumQuartersInt32(start, end int32) (int, error) {
start, end = mathutil.MinMaxInt32(start, end)
if !IsQuarterInt32(start) {
return -1, fmt.Errorf("quarterInt32 is not valid [%v] Must end in [1-4]", start)
}
Function BinFromDuration
has 5 return statements (exceeds 4 allowed). Open
Open
func BinFromDuration(d time.Duration) Bin {
// cycle through default bins with non-standard durations.
defBins := BinsDefault()
for i, bin := range defBins { // asc
if d == bin.Duration {
Function CreateFileWithLines
has 5 return statements (exceeds 4 allowed). Open
Open
func CreateFileWithLines(filename string, lines []string, lineSuffix string, useBuffer bool) error {
f, err := os.Create(filename)
if err != nil {
return err
}
Function IsType
has 5 return statements (exceeds 4 allowed). Open
Open
func IsType(mediaType, s string) bool {
mediaType = strings.ToLower(strings.TrimSpace(mediaType))
s = strings.ToLower(strings.TrimSpace(s))
if s == mediaType {
return true
Method Times.RangeUpper
has 5 return statements (exceeds 4 allowed). Open
Open
func (ts Times) RangeUpper(t time.Time, inclusive bool) (time.Time, error) {
if len(ts) == 0 {
return t, ErrEmptyTimeSlice
}
sortedTS := ts.Dedupe()
Function TokenMatchLeft
has 5 return statements (exceeds 4 allowed). Open
Open
func TokenMatchLeft(tokFilter, tok html.Token, attrValMatchinfo *stringsutil.MatchInfo) bool {
if tokFilter.Type != tok.Type {
return false
} else if tokFilter.DataAtom != tok.DataAtom {
return false
Function SplitBest
has 5 return statements (exceeds 4 allowed). Open
Open
func SplitBest(path string) (dir, file string, err error) {
isDir, err := IsDir(path)
if err != nil {
return "", "", err
} else if isDir {
Function StartEndDT6s
has 5 return statements (exceeds 4 allowed). Open
Open
func StartEndDT6s(dt6s []int32) (int32, int32) {
if len(dt6s) == 0 {
return -1, -1
}
Function ParseJSONPointer
has 5 return statements (exceeds 4 allowed). Open
Open
func ParseJSONPointer(s string) (JSONPointer, error) {
anchorSlash := "#/"
slash := "/"
ptr := JSONPointer{String: s}
if strings.Index(s, anchorSlash) == 0 {
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)
Function ParseCurrency
has 5 return statements (exceeds 4 allowed). Open
Open
func ParseCurrency(opts *ParseCurrencyOpts, s string) (string, float64, error) {
try := strings.TrimSpace(s)
if len(try) == 0 {
return "", 0, nil
}
Function newWriterExif
has 5 return statements (exceeds 4 allowed). Open
Open
func newWriterExif(w io.Writer, exif []byte) (io.Writer, error) {
// Adapted from the following under MIT license: https://github.com/jdeng/goheif/blob/a0d6a8b3e68f9d613abd9ae1db63c72ba33abd14/heic2jpg/main.go
// See more here: https://en.wikipedia.org/wiki/JPEG_File_Interchange_Format
// https://www.codeproject.com/Articles/47486/Understanding-and-Reading-Exif-Data
wExif := ioutil.NewSkipWriter(w, 2)
Method Times.RangeLower
has 5 return statements (exceeds 4 allowed). Open
Open
func (ts Times) RangeLower(t time.Time, inclusive bool) (time.Time, error) {
if len(ts) == 0 {
return t, ErrEmptyTimeSlice
}
sortedTS := ts.Dedupe()
Method Times.IsSorted
has 5 return statements (exceeds 4 allowed). Open
Open
func (ts Times) IsSorted(asc bool) bool {
deltas := ts.Deltas()
if len(deltas) == 0 {
return true
}
Function ModifyConnectionRequest
has 5 return statements (exceeds 4 allowed). Open
Open
func ModifyConnectionRequest(conn net.Conn, modRequest func(r *http.Request) error) error {
// Code adapted from: https://stackoverflow.com/a/76684845/1908967
if conn == nil {
return errors.New("net.Conn cannot be nil")
}