mrtazz/pocketcleaner

View on GitHub

Showing 5 of 5 total issues

Function main has a Cognitive Complexity of 26 (exceeds 20 allowed). Consider refactoring.
Open

func main() {
    versionInfo := fmt.Sprint("pocketcleaner ", version,
        " built at ", buildTime,
        " by ", builder,
        " with ", goversion)
Severity: Minor
Found in cmd/pocketcleaner/main.go - About 1 hr to fix

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 PocketClient.callPocketAPI has 6 return statements (exceeds 4 allowed).
Open

func (c *PocketClient) callPocketAPI(method string, data interface{}) (ret string, err error) {
    if method != "get" && method != "send" {
        return ret, fmt.Errorf("unknown method: %s", method)
    }
    apiURL := fmt.Sprintf("%s/%s?consumer_key=%s&access_token=%s",
Severity: Major
Found in pocketcleaner.go - About 40 mins to fix

    error should be the last type when returning multiple items
    Open

    func (c *PocketClient) archiveItems(list pocketItemArray) (err error, ret pocketItemArray) {
    Severity: Minor
    Found in pocketcleaner.go by golint

    2: cannot find package "github.com/Unknwon/goconfig" in any of:
    Open

        "github.com/Unknwon/goconfig"
    Severity: Minor
    Found in cmd/pocketcleaner/main.go by govet

    error should be the last type when returning multiple items
    Open

    func (c *PocketClient) archiveBatch(list pocketArchiveItemArray) (err error, ret pocketItemArray) {
    Severity: Minor
    Found in pocketcleaner.go by golint
    Severity
    Category
    Status
    Source
    Language