On this note, I thought it would be good to raise having a "lint like" tool on the list;

I've been asking in IRC if there is a "lint like" tool available, this would make it easier for smaller contributors to at least avoid the majority of issues, providing they run it through the "lint like" tool, which has been configured per coding standards.

This is all conjecture of course untill such time as the tool is made available, whatever it may be.

Case and point, whilst I am very interested in "hacking" and contributing code, I am not in any way shape or form a ruby developer I am a systems admin, who just happens to be able to write some ruby; and prefers python (pylint for example is a great tool).

Thoughts?

Cheers

David (Oneiroi)


On Fri, Aug 17, 2012 at 2:39 PM, Matt Wagner <matt.wagner@redhat.com> wrote:
On Fri, Aug 17, 2012 at 10:52:46AM +0200, Jirka Tomasek wrote:
>
> I don't like the sentence "Don't use it for passing variables to
> view. Never." which is actually one of the first things that any
> Rails book teaches you.

Yes, that was the main source of my confusion.

> I agree that we should try to reduce using
> instance variables in controllers where possible to avoid cluttering
> controllers with them.

As someone mentioned in another reply here, there are uses where you
really need them -- e.g., before_filters. Of course we should be
careful to not use instance variables where there's no need for them;
sometimes we'll mistakenly use an instance variable just within the
scope of a method, for example.

> The blog post you sent points out the reusability of partials so
> passing the variables as locals helps avoid requiring use of eg.
> @post in all partials instances. Imho it depends on the desired use
> of the partial.
>
> We have discussed with Imre the alternative way to pass variables
> from controller's action to view. It can be done similar way as with
> partials:
>
>   ...someactioncode...
>   render :action => :index, :locals => {:post => post}
> end
>
>
> but I have never seen this used anywhere in controller and I assume
> this is not the "Rails way".

Yes, this feels pretty weird to me. That whole line should be
unnecessary -- we're overriding the "Rails magic" to explicitly perform
the default behavior, except referencing the variable as a local one. If
anything, this seems _more_ error-prone to me than relying on instance
variables.

-- Matt