Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds JSON output format #402

Merged
merged 1 commit into from Mar 3, 2015
Merged

Adds JSON output format #402

merged 1 commit into from Mar 3, 2015

Conversation

leonelgalan
Copy link
Contributor

Includes both rspec and cucumber tests as seen on the yaml report.


I needed JSON output while setting up a CI with Reek. I was using the YamlReport and YAML.parse(output).to_ruby to get a Hash, but I thought this could be useful for others as well.

I'm getting some 1 failure on rspec and 1 on cucumber, but they are not related to the files changed on this PR. I'm getting the same failures when pulling from master. Maybe is something on my local setup, so I thought I'll give this a try.

@mvz
Copy link
Collaborator

mvz commented Mar 3, 2015

Very useful. Looks good to me.

require 'reek/cli/report/formatter'

include Reek
include Reek::Cli
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know we are doing this a lot in our codebase but at least for new specs, lets not do the "include Reek" dance and use fully qualified constants.

@troessner
Copy link
Owner

Excellent addition!
Lets fix this one thing i commented on and re-squash - then i'll happily merge..;)

@@ -102,6 +103,15 @@ def show
end

#
# Displays a list of smells in JSON format
# JSON with empty array for 0 smells
class JsonReport < Base
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it have to be JsonReport rather than JSONReport?

(The only reason for these capitalisation abominations I heard about was related to Rails’ code autoloading, but I’m working on a Rails 2.3 app at the moment and even it would find JSONRerport in json_report.rb just fine.)

Includes both rspec and cucumber tests as seen on the yaml report.
@leonelgalan
Copy link
Contributor Author

Fixed and squashed! Thanks again for building Reek!

@chastell, I feel you but we the same applies to Yaml, Html, Cli, etc. It might require a major refactor to change all this and add consistency across the project.

@troessner
Copy link
Owner

Great job, merged, thanks!

troessner pushed a commit that referenced this pull request Mar 3, 2015
@troessner troessner merged commit a532f99 into troessner:master Mar 3, 2015
@chastell
Copy link
Collaborator

chastell commented Mar 3, 2015

@chastell, I feel you but we the same applies to Yaml, Html, Cli, etc. It might require a major refactor to change all this and add consistency across the project.

Challenge accepted. :bowtie:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants