TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

RuboCop – A Ruby static code analyzer

125 pointsby matugmabout 10 years ago

17 comments

hmsimhaabout 10 years ago
Rubocop is an absolute pleasure to work with, but it also helps that the ruby community seems to have a more widely-agreed upon style guide than other communities (Javascript comes to mind). There are similar tools for Javascript, and I imagine many of them are configurable as well to cover most use cases. But with the diversity of Javascript style guides and the lack of cohesiveness in the js community, it seems unlikely that many of these would be as useful as rubocop &#x27;out-of-the-box&#x27;.<p>It would be <i>amazing</i> if a similar static code analysis tool existed with settings to conform to the most popular javascript style guides: npm, idiomatic, jQuery, etc. But even within these style guides there is a lot of &#x27;undefined behavior&#x27;, or situations that aren&#x27;t explicitly described in the guides.
评论 #9163395 未加载
xytopabout 10 years ago
Is not it a standard yet? That&#x27;s a well known tool used by thousands of projects..
sergheiabout 10 years ago
Working link to the real thing <a href="http://batsov.com/rubocop/" rel="nofollow">http:&#x2F;&#x2F;batsov.com&#x2F;rubocop&#x2F;</a>
评论 #9162926 未加载
JD557about 10 years ago
I&#x27;m a casual ruby programmer (I only use it to write &quot;powerful bash scripts&quot;) and have been using rubocop with vim&#x2F;syntastic.<p>The attention to detail is incredible, which I&#x27;m not sure if I like or not, since it usually feels like I have someone nitpicking about the style of my quick scripts.<p>I&#x27;ve been learning a lot about ruby standards though.
pdkl95about 10 years ago
Is &quot;static code analyzer&quot; the new spelling for lint(1)?<p><a href="https://www.freebsd.org/cgi/man.cgi?query=lint&amp;sektion=1" rel="nofollow">https:&#x2F;&#x2F;www.freebsd.org&#x2F;cgi&#x2F;man.cgi?query=lint&amp;sektion=1</a><p>I&#x27;ve always been a big fan of code linters. They may not be perfect, but any bug you can catch at compile-time (or earlier) could be saving you hours of trying to track down runtime problems. In languages with a managed runtime such as ruby where you don&#x27;t really have the same kind of compile-time checking, a good linter is even more important.<p>It was a pretty crazy day when I first found RuboCop. I immediately used it on the large amount of ruby I&#x27;ve written over the last ~decade.
sergiotapiaabout 10 years ago
Is there a way to have RuboCop automatically clean up things it detects? Obviously I would run this one file at a time, and git diff it before committing it.
评论 #9163297 未加载
评论 #9163186 未加载
评论 #9163187 未加载
评论 #9163766 未加载
sytseabout 10 years ago
At GitLab we recently implemented this in our tests. After this all the reminders and comments about style are no longer needed. You just need to have green tests as you always should. We think having it in CI is a much better experience than a HoundCI that makes line comments in the merge request, that gets quite noisy for people following the MR.
评论 #9166160 未加载
sidravalabout 10 years ago
For more than just Ruby, as well: <a href="https://houndci.com/" rel="nofollow">https:&#x2F;&#x2F;houndci.com&#x2F;</a>
评论 #9163048 未加载
评论 #9165123 未加载
dankohn1about 10 years ago
I highly recommend it&#x27;s use with pronto. We run Rubocop, Rails Best Practice and Brakeman against every commit by calling pronto from CircleCI.<p><a href="https://github.com/mmozuras/pronto" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;mmozuras&#x2F;pronto</a>
PascalWabout 10 years ago
Absolutely amazing tool, always part of my CI build for Ruby projects.<p>Even though in a lot of cases I don&#x27;t care as much about the style used per se, it&#x27;s a treat to have a consistent coding style in projects with multiple team members.
sanematabout 10 years ago
Integrate with GitHub review comment not only RuboCop but also eslint, jscs, and any lint. <a href="https://github.com/packsaddle/ruby-saddler" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;packsaddle&#x2F;ruby-saddler</a>
mtarnovanabout 10 years ago
RuboCop is amazing. I use it in Sublime via <a href="https://github.com/pderichs/sublime_rubocop" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;pderichs&#x2F;sublime_rubocop</a>
nopcodeabout 10 years ago
I love how it integrates with text editors (textmate, atom) so well. There&#x27;s no need to wait for your CI to tell you you&#x27;re doing something wrong.
评论 #9170724 未加载
stevewilhelmabout 10 years ago
We are big fans. Use it on our projects in conjunction with Rspec, Capybara, and Jasmine to test CircleCI-based deploys.
gnuvinceabout 10 years ago
So what is it, a static code analyzer or a style checker?
评论 #9165739 未加载
zsomborabout 10 years ago
A great tool to create a healthy debate about nothing, while the world changes unnoticed beneath you.
bozhidarabout 10 years ago
RuboCop&#x27;s author here. If I knew someone would ever link to the homepage I would have put some useful info in it. :-)<p>Thanks for the kind words!<p>P.S. There&#x27;s a lot more info here <a href="https://github.com/bbatsov/rubocop" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;bbatsov&#x2F;rubocop</a>
评论 #9165176 未加载