pkg/fetch/fetch.go
Function FeedItems
has a Cognitive Complexity of 47 (exceeds 20 allowed). Consider refactoring. Open
Open
func FeedItems(fetcher FetcherFunc, fetchURL, contentType string, body io.Reader) ([]microsub.Item, error) {
log.Printf("ProcessContent %s\n", fetchURL)
log.Println("Found " + contentType)
items := []microsub.Item{}
- Read upRead up
- Create a ticketCreate a ticket
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 FeedItems
has 102 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func FeedItems(fetcher FetcherFunc, fetchURL, contentType string, body io.Reader) ([]microsub.Item, error) {
log.Printf("ProcessContent %s\n", fetchURL)
log.Println("Found " + contentType)
items := []microsub.Item{}
- Create a ticketCreate a ticket
Function FeedHeader
has 67 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func FeedHeader(fetcher FetcherFunc, fetchURL, contentType string, body io.Reader) (microsub.Feed, error) {
log.Printf("ProcessContent %s\n", fetchURL)
log.Println("Found " + contentType)
feed := microsub.Feed{}
- Create a ticketCreate a ticket
Function FeedHeader
has a Cognitive Complexity of 26 (exceeds 20 allowed). Consider refactoring. Open
Open
func FeedHeader(fetcher FetcherFunc, fetchURL, contentType string, body io.Reader) (microsub.Feed, error) {
log.Printf("ProcessContent %s\n", fetchURL)
log.Println("Found " + contentType)
feed := microsub.Feed{}
- Read upRead up
- Create a ticketCreate a ticket
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
Avoid deeply nested control flow statements. Open
Open
if len(item.Content.HTML) == 0 {
item.Content.HTML = feedItem.Summary
}
- Create a ticketCreate a ticket
Function FeedHeader
has 5 return statements (exceeds 4 allowed). Open
Open
func FeedHeader(fetcher FetcherFunc, fetchURL, contentType string, body io.Reader) (microsub.Feed, error) {
log.Printf("ProcessContent %s\n", fetchURL)
log.Println("Found " + contentType)
feed := microsub.Feed{}
- Create a ticketCreate a ticket
Function FeedItems
has 5 return statements (exceeds 4 allowed). Open
Open
func FeedItems(fetcher FetcherFunc, fetchURL, contentType string, body io.Reader) ([]microsub.Item, error) {
log.Printf("ProcessContent %s\n", fetchURL)
log.Println("Found " + contentType)
items := []microsub.Item{}
- Create a ticketCreate a ticket