naw / fx-indentation-example

Example of how indentation creeps into function definitions

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Steps to reproduce:

  1. rails new hippo --database=postgresql
  2. edit gemfile to add fx, bundle install
  3. bundle exec rails generate fx:function square
  4. edit the function definition file
  5. bundle exec rake db:create db:migrate (this writes the initial function definition to schema.rb)

Up to this point, everything is fine. However, if we use db:schema:load, fx will read the function definition from schema.rb and recreate the function with 6 spaces within the function definition itself.

Then whenever the schema is dumped again, such as after running db:migrate for other migrations, the function definition will be written to schema.rb with the internal spaces as well as the formatting spaces, for a total of 12 spaces:

  1. bundle exec rake db:schema:load db:migrate (0a4f9d)

  2. repeat step 6, each time 6 new spaces are added. (052f76)

  3. Switch fx to my patched version (459314)

  4. repeat step 6, each time nothing is added (NO DIFF, because schema.rb does not change)

About

Example of how indentation creeps into function definitions


Languages

Language:Ruby 77.7%Language:HTML 16.6%Language:JavaScript 3.4%Language:CSS 2.1%Language:PLpgSQL 0.3%