Better HN
topnewbestaskshowjobs
Log inSign up

codesnik

1,035 karma · joined Mar 11, 2009 (17y ago) · 496 submissions

Submissions

comment 2y ago · link · parent

problem is that it does too much out of the box. Finding some sloppy formatting - ok. Fixing it automatically? even better. But rubocop tries to sniff "code smells", security problems, and it's not that great with it, not everything you can get about the logic and intent just from AST. There are so many rules that developers spent significant time appeasing rubocop and this sometimes takes away effort to make code actually readable by humans. Have you ever seen a tidy mess?

Even worse, it gives simple tools to write plugins to sniff more logic related stuff, and I've seen projects where developers really went overboard with it.

comment 2y ago · link · parent

I also am not sure why it's intuitive at all. Article doesn't mention why - ruby has a parse phase, it doesn't scan your string byte for byte every time it runs looking for an interpolation. During the parse those "foo#{bar}" are replaced by something like 'foo'.dup << bar.to_str in the bytecode, but that happens only when parser hits #{ in a double quoted string, there's no penalty for that and it happens just once. Only really old, naive interpretators parse source code each time line is hit. (Or some weird ones, where interpolation can change semantics and argument count, like tcl and bash.)

comment 2y ago · link · parent

strange, I think default rubocop setting is actually to add spaces around = in default values in functions. https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Layout/Spa...

this is an override in your project's .rubocop.yml

For me it's a bit opposite, I use and appreciate rubocop for simple formatting, not all of the rules but some of them, where autocorrect works. Recently I reformatted a big old project which was written by pretty sloppy developers who didn't care about whitespace, and it's just easier to work with now.

But I truly hate when rubocop tries to be smart about method calls, amount of lines in methods and amount methods or some other "code smell" metric.

yes, the tool allows to check for it, but it's not THAT smart. I have reasons. I'd happy to explain those reasons on code review to a human, but I'm not that happy to appease a dumb tool.

So, please do it as rails does, use bare minimals, something like https://github.com/rails/rubocop-rails-omakase

and ask other developers to stay away from .rubocop.yml

comment 2y ago · link · parent

this isn't true for any half-ass interpretator out there. Perhaps some old PHP executable was slower with different quotes, but it's not true for ruby for decades. In bytecode there's zero distinction between "" and ''. Don't believe me? benchmark.

comment 2y ago · link · parent

Nice. Now we can probably ask to move there half of the too nosy rubocop rules from the main rubocop repo. And then to never install rubocop-obsession!

comment 2y ago · link · parent

if you're on os x, you can also do

  pbpaste > file
and if you're using zsh, just

  > file
is sufficient, without cat

comment 2y ago · link · parent

if you prefer to use cat just to read your pipeline from left to right, you can just start your command with file redirection. It doesn't have to be at the end of the command.

  <file grep something | do something else ...
this works in bash too, but if you're using zsh, there're a couple of nice shortcuts

  <file
on it's own works as

  more file
and

  > file
  ...
  ...
  ^D
allows you to put something into the file quickly without firing up the editor. Though

  > file << end
  ...
  end
will give you nicer line editing experience.

more zsh redirection tricks here: https://zsh.sourceforge.io/Doc/Release/Redirection.html#Mult...

comment 2y ago · link · parent

there are, even with defaults. Look in "Window > Move and resize" menu of any app.

comment 2y ago · link · parent

aiming it and keeping it on target would be pretty hard, though. And time-consuming, to say the least.

comment 2y ago · link · parent

from what I understand, slowing down would be true for a non-massless particle, but speed of light in vacuum is still the same around massive objects. What changes is the frequency of the light in this particular direction, and that "turns" it, probably because of self-diffraction?

comment 2y ago · link · parent

all the wavefunction collapses only needed to compute future/far away collapses, we are all just thunks, evaluated because we needed for the final compute.

comment 2y ago · link · parent

"My account" is innocent enough, compared to some other real life examples. And it sometimes doesn't come from marketing, but from development too.

I've worked in company which added a "funny" codename to everything: features, libraries, sprints, sections of backoffice interface. I don't know, maybe for some developers it makes things more engaging, for me it added a ton of unnecessary stuff to memorize or look up.

Also one of the reasons I don't like AWS. You really can call a router just "router", virtual machine "virtual machine" and so on.

comment 2y ago · link · parent

> "arming Ukraine's invasion of Russia's Kursk Oblast"

just because you don't like US imperialism, you don't have to suck up to Russian one.

comment 2y ago · link · parent

I'm still amazed that many US companies willingly force every employee to install zscaler "to improve security and compliance", application which basically passes all inbound and outbound traffic through zscaler edge servers, unencrypted. Who knows who could be listening. And who can control that they aren't.

comment 2y ago · link · parent

> could have been

yeah, we can go a long way with that reasoning.

comment 2y ago · link · parent

would symlinks in that global location help, maybe?

comment 2y ago · link · parent

chemical gradients?

comment 2y ago · link · parent

well, it's time for another abstraction layer.

comment 2y ago · link · parent

YAML is alright when you create it by hand. Problems start when YAML is templated, and frankly it's just dumb, though common. Templating the source without proper escaping could bite even with JSON.

comment 2y ago · link · parent

wow. It's a long way between jaw, sinuses and the inner ear. Was your inflamation that big?

comment 2y ago · link · parent

please specify Remote (US or Canada) as it says in your careers page. There're a lot of devs there from other locations.

comment 2y ago · link · parent

Iron and nickel mostly, not lead, AFAIK

comment 2y ago · link · parent

and yeah, I've been an election observer a couple of times, witnessing democracy deterioration in Russia proper, I have to say that they cheat on _every_ level, with ridiculous redundancy, and in many cases without any noticeable coordination. All it takes is to make elections in municipal organizations like schools and hospitals and just by convenience assign bureaucrats and other government paid officials (like teachers!) to manage voting districts. Those guys are very well trained to understand unofficial demand for "results". Otherwise you know, next time funding would be lower or day to day work would become harder.

comment 2y ago · link · parent

just door to door "vote at home" canvassing with two guys armed with AK. I wonder how many people assumed nobody would check where the tick went on the ballot. There were videos.

comment 2y ago · link · parent

happened in annexed parts of Ukraine during "referendum"

comment 2y ago · link · parent

somewhat related concepts: Space fountain and and Launch loop

https://en.wikipedia.org/wiki/Space_fountain

https://en.wikipedia.org/wiki/Launch_loop

comment 2y ago · link · parent

Huh. Could you tell more on ways of sneaking up information to them? I personally am so undiplomatic I have hard time even to imagine, how to do it.

comment 2y ago · link · parent

but because of sane notion of falsiness in ruby, it's easy to both always have a string on unchecked inputs

  "abc".slice(4, 10) || ""

_and_ check those inputs in one go if needed.

  substr = "abc".slice(start, len)
  raise "wrong inputs" if substr.nil?
  
just that one feature (only nil and false are falsy) of ruby makes it positively stand out among all the languages that have "null" as concept

comment 2y ago · link · parent

flipflop basically has a hidden boolean variable for state. Btw, while I HAD used it, i still have no idea what's the scope of that state and when it'd reset itself.

comment 2y ago · link · parent

well, db latency in some naive unoptimized app with multiple sequential queries directly affects _app_'s throughput
1
567
17