Method ProcessVideo.startDownloadVideo
has a Cognitive Complexity of 39 (exceeds 20 allowed). Consider refactoring.
func (p *ProcessVideo) startDownloadVideo() {
logger := p.getLogger()
dirpath := p.LiveStatus.Video.UsersConfig.DownloadDir
func() {
Function arrangeTask
has a Cognitive Complexity of 36 (exceeds 20 allowed). Consider refactoring.
func arrangeTask() {
log.Printf("Arrange tasks...")
pm := initPluginManager()
status := make([]map[string]bool, len(config.Config.Module))
for i, module := range config.Config.Module {
Method ProcessVideo.startDownloadVideo
has 75 lines of code (exceeds 50 allowed). Consider refactoring.
func (p *ProcessVideo) startDownloadVideo() {
logger := p.getLogger()
dirpath := p.LiveStatus.Video.UsersConfig.DownloadDir
func() {
Function arrangeTask
has 61 lines of code (exceeds 50 allowed). Consider refactoring.
func arrangeTask() {
log.Printf("Arrange tasks...")
pm := initPluginManager()
status := make([]map[string]bool, len(config.Config.Module))
for i, module := range config.Config.Module {
Function HttpDoWithBufferEx
has 56 lines of code (exceeds 50 allowed). Consider refactoring.
func HttpDoWithBufferEx(ctx context.Context, client *http.Client, meth string, url string, header map[string]string, data []byte, buf *bytes.Buffer) (*bytes.Buffer, error) {
if client == nil {
client = &http.Client{}
}
var dataReader io.Reader
Function HttpDoWithBufferEx
has a Cognitive Complexity of 25 (exceeds 20 allowed). Consider refactoring.
func HttpDoWithBufferEx(ctx context.Context, client *http.Client, meth string, url string, header map[string]string, data []byte, buf *bytes.Buffer) (*bytes.Buffer, error) {
if client == nil {
client = &http.Client{}
}
var dataReader io.Reader
Method BilibiliPoller.getStatusUseFollow
has 51 lines of code (exceeds 50 allowed). Consider refactoring.
func (b *BilibiliPoller) getStatusUseFollow() error {
ctx := base.GetCtx("Bilibili")
if ctx == nil {
return nil
}
Function HttpDoWithBufferEx
has 7 arguments (exceeds 4 allowed). Consider refactoring.
func HttpDoWithBufferEx(ctx context.Context, client *http.Client, meth string, url string, header map[string]string, data []byte, buf *bytes.Buffer) (*bytes.Buffer, error) {
Function HttpDoWithBufferEx
has 7 return statements (exceeds 4 allowed).
func HttpDoWithBufferEx(ctx context.Context, client *http.Client, meth string, url string, header map[string]string, data []byte, buf *bytes.Buffer) (*bytes.Buffer, error) {
if client == nil {
client = &http.Client{}
}
var dataReader io.Reader
Method BilibiliPoller.getStatusUseFollow
has 5 return statements (exceeds 4 allowed).
func (b *BilibiliPoller) getStatusUseFollow() error {
ctx := base.GetCtx("Bilibili")
if ctx == nil {
return nil
}
Method Youtube.getVideoInfo
has 5 return statements (exceeds 4 allowed).
func (y *Youtube) getVideoInfo(ctx *base.MonitorCtx, baseHost string, channelId string) error {
url := baseHost + "/channel/" + channelId + "/live"
htmlBody, err := ctx.HttpGet(url, map[string]string{})
if err != nil {
return err