Project

General

Profile

Feature #11032

Add a warning for misspelling "def intialize"

Added by shevegen (Robert A. Heiler) about 4 years ago. Updated almost 4 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Target version:
-
[ruby-core:<unknown>]

Description

Hi guys,

When I was younger, in a class, I wrote this:

"def intialize(some_argument_here)"

This lead to an error because it should have been:

"def initialize(some_argument_here)"

My proposal is simple:

Add a warning for an error like this. :)

(a) If there is no method called "initialize"
(b) but there is a message called "intialize",
in a given class, add a notification such as:

"warning: intialize might be misspelled, perhaps you meant initialize"

Reasoning: Perhaps other people out there also sometimes misspell
initialize, so that might make it a bit faster for them to
detect this error.


Related issues

Related to Ruby trunk - Feature #11252: Integrated "did_you_mean" gem to ruby-coreClosedActions

History

#1

Updated by jeremyevans0 (Jeremy Evans) about 4 years ago

What if I misspelled it "initailize"? Or "initalize"? Or any other of the numerous different ways to misspell it?

#2

Updated by phluid61 (Matthew Kerwin) about 4 years ago

Jeremy Evans wrote:

What if I misspelled it "initailize"? Or "initalize"? Or any other of the numerous different ways to misspell it?

Or "initialise"? Which I do with some regularity.

My solution: unit testing.

#3

Updated by duerst (Martin Dürst) almost 4 years ago

  • Related to Feature #11252: Integrated "did_you_mean" gem to ruby-core added

Updated by duerst (Martin Dürst) almost 4 years ago

  • Status changed from Open to Closed

This issue can be closed because this will be covered by #11252 in a much more general way.

Also available in: Atom PDF