pstuifzand/ekster

View on GitHub
cmd/eksterd/micropub.go

Summary

Maintainability
A
3 hrs
Test Coverage

Method micropubHandler.ServeHTTP has 57 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func (h *micropubHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
    defer func() {
        err := r.Body.Close()
        if err != nil {
            log.Printf("could not close request body: %v", err)
Severity: Minor
Found in cmd/eksterd/micropub.go - About 1 hr to fix

Function parseIncomingItem has 7 return statements (exceeds 4 allowed).
Open

func parseIncomingItem(r *http.Request) (*microsub.Item, error) {
    contentType := r.Header.Get("content-type")

    if contentType == "application/jf2+json" {
        var item microsub.Item
Severity: Major
Found in cmd/eksterd/micropub.go - About 45 mins to fix

Method micropubHandler.ServeHTTP has 6 return statements (exceeds 4 allowed).
Open

func (h *micropubHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
    defer func() {
        err := r.Body.Close()
        if err != nil {
            log.Printf("could not close request body: %v", err)
Severity: Major
Found in cmd/eksterd/micropub.go - About 40 mins to fix

Function getChannelFromAuthorization has 5 return statements (exceeds 4 allowed).
Open

func getChannelFromAuthorization(r *http.Request, conn redis.Conn) (string, error) {
    // backward compatible
    sourceID := r.URL.Query().Get("source_id")
    if sourceID != "" {
        channel, err := redis.String(conn.Do("HGET", "sources", sourceID))
Severity: Major
Found in cmd/eksterd/micropub.go - About 35 mins to fix

TODO found
Open

        // TODO: improve handling of form-urlencoded
Severity: Minor
Found in cmd/eksterd/micropub.go by fixme

TODO found
Open

        // TODO: We could try to fill the Source of the Item with something, but what?
Severity: Minor
Found in cmd/eksterd/micropub.go by fixme

There are no issues that match your filters.

Category
Status