

Search: .lenght - Github - uyhayuy
https://github.com/search?type=Code&language=JavaScript&q=.lenght&repo=&langOverride=&x=0&y=0&start_value=1

======
theli0nheart
I remember seeing a Github bot a couple weeks ago that strips out whitespace
and adds a .gitignore file to a repo (I also remember this really rubbing some
people the wrong way). This search indicates that it would probably be useful
to have a linter bot running on Github for all the popular languages. It would
find syntax errors, common mispellings, and compilation issues, and then
submit pull requests to fix the issues.

I have no time to work on something like this myself, but I'm sure a lot of
people would find it useful, especially if it acted as a "first defense"
before deployment. Curious what other HN'ers think about this.

~~~
Mizza
I wrote that bot!

<https://github.com/Miserlou/WhitespaceBot>

Feel free to fork it to do whatever you want, that's why I made it.

~~~
xyzzyb
Ah, aggressive trailing whitespace removal. That I can completely get behind.
I've already got command-s bound to a custom macro that strips trailing
whitespace in TextMate for myself and my co-workers; but this would be an even
more inclusive solution.

~~~
tensafefrogs
Fantastic. If you use vim, you should have this in your .vimrc:

" Remove any trailing whitespace that is in the file

autocmd BufRead,BufWrite * if ! &bin | silent! %s/\s\\+$//ge | endif

~~~
illicium
I prefer using the vim-trailing-whitespace plugin and fixing it manually:
<https://github.com/bronson/vim-trailing-whitespace>

~~~
throwaway392
Or you can use my competing plugin: <https://github.com/bitc/vim-bad-
whitespace>

which has some advantages (described in the README)

~~~
jdwhit2
One advantage taken from the readme:

    
    
      This plugin is better than using the builtin vim 'list' command because it
      doesn't show an annoying highlight while you are typing in insert mode at the
      end of a line.

------
zeratul
I thought this is actually interesting but I would like to know if >4k
misspellings is a lot or not. Here is one way to do it:

    
    
        LANGUAGE #LENGHT #LENGTH = #LENGHT/#LENGTH  
        JavaScript 4252 2907459 = 0.0015
        C 18981 2902857 = 0.0065
        Java 7706 2348900 = 0.0033
        Ruby 10789 1690604 = 0.0064
        C++ 9458 1315552 = 0.0072
        PHP 3116 1167924 = 0.0027
        C# 1352 937647 = 0.0014
        Python 3662 737292 = 0.0050
        Ruby 1232 380484 = 0.0032
        Perl 1239 258892 = 0.0048
        Objective-C 679 238051 = 0.0029
    

P.S. There is something wrong with Github's language breakdown algorithm,
sometimes it shows same language twice with a different number of hits.

~~~
koenigdavidmj
C# I can understand being so low, since it's almost always written in Visual
Studio or MonoDevelop (both of which provide autocompletion). But how is
JavaScript the next lowest?

~~~
untog
C# is also a compiled language, so you wouldn't be able to get anything to run
with a typo like that hanging around. I find it surprising that there are so
many commits making that mistake!

~~~
baddox
Being a compiled language isn't sufficient to prevent "no method" errors. It's
completely possible for a compiled language to define methods at runtime or
use duck typing.

------
josegonzalez
For the record, Github's search index is wayyy out of date sometimes. The
second user here is me and I deleted that user like two years ago:
<http://cl.ly/0y271f0T3G0X2J1L022E>

~~~
eik3_de
Same here, I contacted support two times in two years and they said "we're
working on it". Obviously, that isn't true and they just don't care about the
outdated search index.

~~~
holman
Your latter statement is unequivocally false, for what it's worth. On both
counts.

~~~
jc123
Perhaps some info about the progress being made would be more helpful as elk3
has mentioned contacting support over the past 2 years.

------
jond3k

      #  Language    Illiteracy
      1  C           0.02877583  
      2  Perl        0.01635618  
      3  Ruby        0.01560477  
      4  JavaScript  0.01330989  
      5  Shell       0.01235425  
      6  Python      0.01046104  
      7  PHP         0.00910218  
      8  Java        0.00736395  
    

(For height, length and hierarchy, averaged out)

And you thought this would end up being a PHP joke...

[https://github.com/jond3k/sandbox/tree/master/github-
illiter...](https://github.com/jond3k/sandbox/tree/master/github-illiteracy-
index)

------
xcud
'wtf' is a good search term when coming into contact with a new codebase;
[https://github.com/search?type=Code&language=JavaScript&...](https://github.com/search?type=Code&language=JavaScript&q=wtf&repo=&langOverride=&x=0&y=0&start_value=1)

------
timdorr
"hieght" is also a good one:
[https://github.com/search?type=Code&language=JavaScript&...](https://github.com/search?type=Code&language=JavaScript&q=.hieght&repo=&langOverride=&x=0&y=0&start_value=1)

~~~
alpb
not an attribute of a standard object type, though.

~~~
sjwright
Neither is length in many languages.

~~~
mark_story
But length is in Javascript. Both String and Array have that property.

~~~
sjwright
Which is why I said _many_ and not _all_.

------
angrycoder
Even the search has a bug. The query is for ".lenght" but many of the
highlighted results are just lenght without the dot.

~~~
cpr
Prob a reg exp so matches any char...

~~~
andrewflnr
But then shouldn't the highlighted bit include the char in front? It's also
case insensitive. I think it's trying to be clever.

~~~
mattdeboard
More likely is form/input validation.

------
southern
A common typo, it seems. But I'm a bit confused as to why this was submitted.

~~~
kaffeinecoma
In a static language this would be flagged as an error. I assume something
less than ideal happens in languages such as Ruby.

I once worked at a company where a very early piece of code had a typo
"properites" instead of "properties". This misspelling became
institutionalized, and was used throughout the codebase because it was deemed
too expensive to fix. And this was with a static language (with good IDE
refactoring support)!

~~~
palish
I'm confused as to why they couldn't simply:

    
    
      grep -R properites .

~~~
storborg
Perhaps the same reason why "referer" has not been corrected to "referrer".

~~~
kaffeinecoma
Yes, it was exactly like that- lots of code had grown around the "bug", and it
was not immediately obvious what other software had come to depend upon it.
"Little hairs", as Joel might say.

------
billpg
My experience is more with languages that are typically compiled and would
report this error as an error fairly early on, so the coder would correct it
long before checking the code in.

What's the trade-off by having "undefined" returned instead of having an error
reported as soon as the code is loaded?

~~~
nostrademons
It prevents you from later defining a 'lenght' method and using it at runtime
without a recompile.

For core methods like 'length', it seems silly to think that you'd want to
redefine it. And indeed, it's usually counterproductive - that's why any
experienced JavaScript dev will have coding conventions like "Don't muck with
the prototypes of built-in objects."

But at the application layer, this can be really useful. Imagine you're adding
a new field to a message deep in the storage system, and then you want to pass
that along to a template in the rendered HTML. It's _really_ useful to be able
to do this without recompiling & restarting each individual server between the
backend and the frontend, and just edit a few template files and have them
automatically pick up any changes to backend data formats.

Ditto adding a new database column, if you're using an RDBMS - it's pretty
handy to have your model objects instantly reflect the new field, instead of
needing to manually add accessors to each of your model classes. Rails and
Django are built on this principle.

Also, you have a versioning problem with statically-compiled code in a
distributed system. Imagine that you add this new 'lenght' field to a backend
message, and add it to the frontend, and they both compile & deploy. Now
imagine that a message from an old backend hits a new frontend (it's not
possible to upgrade a whole distributed system at once without downtime). What
does the new frontend do with it? It needs a piece of data, but the backend
had no idea that it had to provide that piece of data. The only thing it _can_
do is return the equivalent of 'undefined'.

In C++/Java code, you usually deal with these by inventing frameworks. Google
code, for example, is littered with

    
    
      if (msg.has_new_field()) {
        run_long_complicated_ui_display_routine(msg.new_field());
      } else {
        fall_back_to_old_behavior(msg.old_field());
      }
    

checks. If you use a more dynamic language like Python, you can use language
mechanisms to represent undefined values or fields that are defined at
runtime. If you use a static language, you're stuck mimicking them with
hashmaps and null.

------
joblessjunkie
It should be possible to build a bot that automatically generates patches and
pull requests for these kinds of typos.

------
j_baker
Equally scary to me is "UFT8".

[https://github.com/search?langOverride=&language=&q=...](https://github.com/search?langOverride=&language=&q=uft8&repo=&start_value=1&type=Code&x=18&y=22)

------
gren
What about this one:
[https://github.com/search?type=Code&language=JavaScript&...](https://github.com/search?type=Code&language=JavaScript&q=fucntion&repo=&langOverride=&x=0&y=0&start_value=1)

------
veyron
Someone wrote a spellchecker a while ago using perl spellchecker:
[http://blog.holdenkarau.com/2011/08/automatic-spelling-
corre...](http://blog.holdenkarau.com/2011/08/automatic-spelling-corrections-
on.html)

------
eik3_de
105395 results for _heigth_ , now beat that ;)

------
flexd
And this is why we have testing frameworks.

~~~
azth
... and compiled languages. Testing won't ensure 100% code coverage.

~~~
flexd
... and nice things like <https://github.com/scrooloose/syntastic> for vim (or
your editor of choice).

------
davidmccann
Recieve. Has to be my number one pet pieve.

[https://github.com/search?type=Code&language=JavaScript&...](https://github.com/search?type=Code&language=JavaScript&q=.recieve&repo=&langOverride=&x=26&y=21&start_value=1)

------
mrchess
This reminds me of a US company I worked with that outsourced some of their
service layer work to a company with heavy European influence. As a result,
API methods also had the spelling of certain words eg. getColour() or
getFavourites(). Good times.

------
gus_massa
In the LaTex editor that I'm using (WinEdt), I have a custom color
highlighting that marks _\rigth_ and _\heigth_ in red+bold+strikeout, so I
don't have to wait to compile and see a strange error to spot the mistake.

------
andrewcamel
It'd be great if Github would scan your code for errors like these and just
let you know they exist (in case you didn't want them to, which I would assume
you wouldn't for the most part).

------
justinhj
For some reason in video game source code I see the word 'hierarchy' in
comments spelt wrong a lot in every project I've been on.

------
kissickas
Is there any context to this or are you just pointing the humor of out how
common this is?

~~~
kristiandupont
Well it is basically a list of bugs -- and a rather long one too.

Of course there are rare cases where "lenght" is a variable and that name is
used in every instance but mostly, these are bugs in code that we all use.

------
obilgic
most of them are variable names which is acceptable!

~~~
VMG
Not at all. It's irritating and confusing.

Come back to that code in a year and try to extend it, stuff will break
because you start to use the correct name.

------
speleding
I just tried "heigth", it's almost as bad.

