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.
Test Setup Failed
Pull Request — master (#1)
by Victor Hugo
01:16
created

devto.NewConfig   A

Complexity

Conditions 3

Size

Total Lines 9
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 3
eloc 7
dl 0
loc 9
rs 10
c 0
b 0
f 0
nop 2
1
package devto
2
3
import "errors"
4
5
//Confugration errors
6
var (
7
	ErrMissingRequiredParameter = errors.New("a required parameter is missing")
8
)
9
10
//Config contains the elements required to initialize a
11
// devto client.
12
type Config struct {
13
	BaseHTTPClient httpClient
14
	APIKey         string
15
	InsecureOnly   bool
16
}
17
18
//NewConfig build a devto configuration instance with the
19
//required parameters.
20
//
21
//It takes a boolean (p) as first parameter to indicate if
22
//you need access to endpoints which require authentication,
23
//and a API key as second paramenter, if p is set to true and
24
//you don't provide an API key, it will return an error.
25
func NewConfig(p bool, k string) (c *Config, err error) {
26
	if p == true && k == "" {
27
		return nil, ErrMissingRequiredParameter
28
	}
29
30
	return &Config{
31
		InsecureOnly: !p,
32
		APIKey:       k,
33
	}, nil
34
}
35