Showing 20 of 25 total issues
Method MovieCommand.Execute
has a Cognitive Complexity of 48 (exceeds 20 allowed). Consider refactoring. Open
func (m *MovieCommand) Execute(args []string) error {
movie, err := m.getMovie()
if err != nil {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function ImportConfig
has a Cognitive Complexity of 46 (exceeds 20 allowed). Consider refactoring. Open
func ImportConfig() {
if _, err := os.Stat(configPath()); err == nil {
/*
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function ImportConfig
has 98 lines of code (exceeds 50 allowed). Consider refactoring. Open
func ImportConfig() {
if _, err := os.Stat(configPath()); err == nil {
/*
Method scanCommand.handleSeriesTorrents
has a Cognitive Complexity of 36 (exceeds 20 allowed). Consider refactoring. Open
func (cmd *scanCommand) handleSeriesTorrents(seriesTorrentsList []seriesTorrents) error {
for _, seriesTorrents := range seriesTorrentsList {
/*
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method MovieCommand.Execute
has 76 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (m *MovieCommand) Execute(args []string) error {
movie, err := m.getMovie()
if err != nil {
Method pirateBayScaper.search
has 73 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (s *pirateBayScaper) search(query string, timeout time.Duration) ([]Torrent, error) {
torrentsChannel := make(chan []Torrent)
errorChannel := make(chan error)
Method pirateBayScaper.search
has a Cognitive Complexity of 27 (exceeds 20 allowed). Consider refactoring. Open
func (s *pirateBayScaper) search(query string, timeout time.Duration) ([]Torrent, error) {
torrentsChannel := make(chan []Torrent)
errorChannel := make(chan error)
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method pirateBayScaper.ParseSearchPage
has 55 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (s *pirateBayScaper) ParseSearchPage(doc *goquery.Document) []Torrent {
var torrents []Torrent
doc.Find("#searchResult > tbody > tr").Each(func(i int, row *goquery.Selection) {
Method MirrorScraper.getTorrents
has 51 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (m *MirrorScraper) getTorrents(mirrors []Mirror, query string, trustSource bool) (*Mirror, []Torrent, error) {
type torrentResponse struct {
mirror *Mirror
torrents []Torrent
Method TVmazeToken.Search
has 7 return statements (exceeds 4 allowed). Open
func (tkn *TVmazeToken) Search(searchName string) ([]TVmazeSeries, error) {
var searchResults []TVmazeSeries
var searchResponse []struct {
Method SearchFilters.IsOk
has 7 return statements (exceeds 4 allowed). Open
func (f SearchFilters) IsOk(torrent *Torrent) bool {
maxSize, _ := f.MaxSizeKB()
minSize, _ := f.MinSizeKB()
Method addCommand.Execute
has 7 return statements (exceeds 4 allowed). Open
func (cmd *addCommand) Execute(args []string) error {
tvmazeToken, err := tvmazeLogin()
if err != nil {
Avoid deeply nested control flow statements. Open
} else if t, exists := trnts[Default]; exists && ok(t) {
torrent = t
}
Method MovieCommand.Execute
has 7 return statements (exceeds 4 allowed). Open
func (m *MovieCommand) Execute(args []string) error {
movie, err := m.getMovie()
if err != nil {
Avoid deeply nested control flow statements. Open
if topTorrent == nil {
log.Println("No torrent found")
} else {
log.Println(topTorrent.Title)
Method scanCommand.handleSeriesTorrents
has 6 return statements (exceeds 4 allowed). Open
func (cmd *scanCommand) handleSeriesTorrents(seriesTorrentsList []seriesTorrents) error {
for _, seriesTorrents := range seriesTorrentsList {
/*
Method UpdateCommand.Execute
has 6 return statements (exceeds 4 allowed). Open
func (cmd *UpdateCommand) Execute(args []string) error {
currentVersion, valid := parseVersion(Version)
if !valid && os.Getenv("GOIRATE_DEBUG") != "true" {
Function extractUploadTime
has 6 return statements (exceeds 4 allowed). Open
func extractUploadTime(description string) time.Time {
/*
First check the MM-DD HH:mm format
*/
Method pirateBayScaper.ParseSearchPage
has 5 return statements (exceeds 4 allowed). Open
func (s *pirateBayScaper) ParseSearchPage(doc *goquery.Document) []Torrent {
var torrents []Torrent
doc.Find("#searchResult > tbody > tr").Each(func(i int, row *goquery.Selection) {
Method scanCommand.scanSeries
has 5 return statements (exceeds 4 allowed). Open
func (cmd *scanCommand) scanSeries(tvmazeToken *series.TVmazeToken, ser *series.Series, torrentList *[]seriesTorrents) (bool, error) {
filters := cmd.GetFilters()
if ser.MinQuality != "" {