GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Passed
Push — master ( 58c272...f83009 )
by Victor Hugo
01:04 queued 12s
created

pagination.parseURIAndReturnQueryParam   A

Complexity

Conditions 2

Size

Total Lines 9
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 2

Importance

Changes 0
Metric Value
cc 2
eloc 6
dl 0
loc 9
ccs 5
cts 5
cp 1
crap 2
rs 10
c 0
b 0
f 0
nop 2
1
package pagination
2
3
import (
4
	"net/url"
5
)
6
7
// ExtractFromQueryParam extracts the lastID from the given URI, which is assumed to be a URL with query parameters.
8
// It specifically looks for a query parameter named 'from' and returns its value as a string.
9
// If the URI cannot be parsed or the query parameter is not found, it returns an empty string and the encountered
10
// error.
11
func ExtractFromQueryParam(uri string) (lastID string, err error) {
12 1
	const from = "from"
13
14 1
	return parseURIAndReturnQueryParam(uri, from)
15
}
16
17
func parseURIAndReturnQueryParam(uri string, param string) (val string, err error) {
18 1
	u, err := url.Parse(uri)
19 1
	if err != nil {
20 1
		return "", err
21
	}
22
23 1
	v := u.Query().Get(param)
24
25 1
	return v, nil
26
}
27