Amber: Indentation issues in generated recipes

Created on 11 Apr 2018  Â·  6Comments  Â·  Source: amberframework/amber

Description

@damianham I found some indentation issues in the new recipe feature

screenshot_20180411_103744

Steps to Reproduce

  1. Create an amber project with amber master
  2. Create a module with recipe feature and damianham/modular recipe

Expected behavior: Generate well indented code

Actual behavior: Generates bad indented code

Reproduces how often: 100%

Versions

Master https://github.com/amberframework/amber/commit/fa633160e3f467565bd314df40e3325ca0d0efd0

Additional Information

I found other indentation issues in config/routers.cr as well, not related to recipe feature, though

enhancement

Most helpful comment

All 6 comments

crystal tool format --check output:

➜  app crystal tool format --check
Error: formatting './config/application.cr' produced changes
Error: formatting './config/initializers/database.cr' produced changes
Error: formatting './spec/modules/posts/posts_controller_spec.cr' produced changes
Error: formatting './spec/modules/posts/posts_spec.cr' produced changes
Error: formatting './spec/modules/tasks/tasks_controller_spec.cr' produced changes
Error: formatting './spec/modules/tasks/tasks_spec.cr' produced changes
Error: formatting './spec/modules/post/post_controller_spec.cr' produced changes
Error: formatting './spec/modules/post/post_spec.cr' produced changes
Error: formatting './spec/modules/users/users_controller_spec.cr' produced changes
Error: formatting './spec/modules/users/users_spec.cr' produced changes
Error: formatting './src/modules/posts/posts_controller.cr' produced changes
Error: formatting './src/modules/posts/posts.cr' produced changes
Error: formatting './src/modules/tasks/tasks_controller.cr' produced changes
Error: formatting './src/modules/users/users_controller.cr' produced changes
Error: formatting './src/modules/users/users.cr' produced changes

This is due to an issue with the liquid.cr template engine and I created an issue for it
https://github.com/TechMagister/liquid.cr/issues/28

Apparently it needs an update to the parser. I had a look at it but I have no idea what to do to fix it. One of the contributors to amber @docelic is also a contributor to liquid.cr so maybe he could have a look at it ?

I can take a look, I'm on it.

@docelic Was this addressed?

@eliasjpr Yeah, this was already solved, we kinda fix this using a bunch of hacks ({{" "}} to keep indentation), although they work pretty well.

We're already checking formatting inside CI on generated templates in both, recipes and amber repo :tada:

Was this page helpful?
0 / 5 - 0 ratings

Related issues

netwarp picture netwarp  Â·  6Comments

olegsobchuk picture olegsobchuk  Â·  5Comments

elorest picture elorest  Â·  6Comments

faustinoaq picture faustinoaq  Â·  7Comments

ZeroPointEnergy picture ZeroPointEnergy  Â·  4Comments