reactjs / react-tutorial

Code from the React tutorial.
http://facebook.github.io/react/docs/tutorial.html
Other
3.29k stars 2.13k forks source link

Lint for go and ruby #76

Closed mttrs closed 9 years ago

mttrs commented 9 years ago

Let's have a lint for awesome react tutorial :) Confirmed that the server ran well with go and ruby.

facebook-github-bot commented 9 years ago

Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla - and if you have received this in error or have any questions, please drop us a line at cla@fb.com. Thanks!

facebook-github-bot commented 9 years ago

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

zpao commented 9 years ago

What did you use to lint?

mttrs commented 9 years ago
% golint server.go
server.go:60:3: can probably use "var comments []comment" instead
% rubocop server.rb
Offenses:

server.rb:19:34: C: Use the new Ruby 1.9 hash syntax.
server = WEBrick::HTTPServer.new :Port => port, :DocumentRoot => root
                                 ^^^^^^^^
server.rb:19:49: C: Use the new Ruby 1.9 hash syntax.
server = WEBrick::HTTPServer.new :Port => port, :DocumentRoot => root
                                                ^^^^^^^^^^^^^^^^
server.rb:31:66: C: Use the new Ruby 1.9 hash syntax.
    File.write('./comments.json', JSON.pretty_generate(comments, :indent => '    '))
                                                                 ^^^^^^^^^^
server.rb:31:81: C: Line is too long. [84/80]
    File.write('./comments.json', JSON.pretty_generate(comments, :indent => '    '))
                                                                                ^^^^
server.rb:40:12: C: Prefer {...} over do...end for single-line blocks.
trap 'INT' do server.shutdown end
           ^^

1 file inspected, 5 offenses detected

I set these lints in my editor, so I can easily see warnings when I save a file.

zpao commented 9 years ago

Cool, thanks. I just wanted to be able to reproduce. Maybe one day we'll do automated linting but this is such a small project, not sure it's worth the distraction.

PS, RIP hash rockets 😥