Add GFM reporter, Allow user to select reporter with CL option #71

Merged
merged 4 commits into from Feb 7, 2013

Projects

None yet

2 participants

@RyanMcG
Contributor
RyanMcG commented Feb 7, 2013

I am truly sorry about the dense title, I was trying to be concise.

This pull request is an attempt to implement a few things:

  1. Add a reporter that outputs github flavored markdown.
  2. Add reporter output tests.
  3. Allow the user to select which reporter to use ('"text" or "markdown").

Usage:

lein kibit --reporter markdown

Or

lein kibit -r text

If the given argument does not match a reporter the plain text (cli-reporter) is used.

Suggestions, criticisms and hints are more than welcome!

Example Output:

Below is some sample output on some code I need to update. Apparently I did not know about when-not.


/home/ryan/repo/Cadence/src/cadence/model.clj:63

Consider using:

  (update-in user-map [:roles] namespace-and-keywordize-roles)

instead of:

  (assoc
    user-map
    :roles
    (namespace-and-keywordize-roles (:roles user-map)))

/home/ryan/repo/Cadence/src/cadence/model.clj:136

Consider using:

  (when-not (nil? result)
    (mc/update-by-id
      "phrases"
      (:_id result)
      {$set {:random_point [(rand) 0]}}))

instead of:

  (when (not (nil? result))
    (mc/update-by-id
      "phrases"
      (:_id result)
      {$set {:random_point [(rand) 0]}}))

/home/ryan/repo/Cadence/src/cadence/model/validators.clj:18

Consider using:

  (when (has-value? name)
    (rule
      (min-length? name 3)
      [:name "Your name must be at least 3 characters long."])
    (rule
      (max-length? name 64)
      [:name "Your name must be no more than 64 characters long."])
    (rule
      (re-find #"^[a-zA-z][\-'\w]*( [\-'\w]+)*\w$" name)
      [:name
       (str
         "Your name must match this regex "
         "/^[a-zA-z][\\-'\\w]*( [\\-'\\w]+)*\\w$/")]))

instead of:

  (when (has-value? name)
    (do
      (rule
        (min-length? name 3)
        [:name "Your name must be at least 3 characters long."])
      (rule
        (max-length? name 64)
        [:name "Your name must be no more than 64 characters long."])
      (rule
        (re-find #"^[a-zA-z][\-'\w]*( [\-'\w]+)*\w$" name)
        [:name
         (str
           "Your name must match this regex "
           "/^[a-zA-z][\\-'\\w]*( [\\-'\\w]+)*\\w$/")])))

/home/ryan/repo/Cadence/src/cadence/model/validators.clj:46

Consider using:

  (set (keys eve))

instead of:

  (into #{} (keys eve))

/home/ryan/repo/Cadence/src/cadence/model/validators.clj:56

Consider using:

  (set (keys cadence))

instead of:

  (into #{} (keys cadence))

/home/ryan/repo/Cadence/src/cadence/views/common.clj:88

Consider using:

  (when-not (friend/anonymous?)
    (html
      [:li [:a {:href "/user/training"} "Training"]]
      [:li [:a {:href "/user/auth"} "Auth"]]))

instead of:

  (when (not (friend/anonymous?))
    (html
      [:li [:a {:href "/user/training"} "Training"]]
      [:li [:a {:href "/user/auth"} "Auth"]]))

/home/ryan/repo/Cadence/src/cadence/views/common.clj:139

Consider using:

  (when-not (nil? errors) (format-errors errors))

instead of:

  (when (not (nil? errors)) (format-errors errors))
Owner
jonase commented Feb 7, 2013

Awesome! Thanks.

@jonase jonase merged commit ce7d9b6 into jonase:master Feb 7, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment