presidentbeef/brakeman — pull request #325 by presidentbeef (2013-05-05 05:06:54+00:00)
Title: Better handling of nested classes in/with/around controllers

Sometimes controllers have classes inside them. Sometimes controllers are inside other classes. Sometimes there are classes in `app/controllers` that inherit from `ApplicationController` but do not have `Controller` in their name so I don't think Rails actually treats them like controllers. But then actual controllers inherit from these not-really-controllers.

What does this all mean (besides that I look like this :crying_cat_face:)? It means that my [earlier change](https://github.com/presidentbeef/brakeman/pull/315) to only treat classes ending with `Controller` like controllers broke a bunch of stuff, even though it seemed right.

Here's the new strategy when initially processing controllers:

* If a class is inside another class that ends in `Controller` treat it like a library. If you have nested classes both ending in `Controller` I don't know what to tell you.
* If a class is inside another class that does not end in `Controller`:
* Treat it like a module for namespace naming purposes
* Treat it like a library for tracking purposes
* Treat it like a controller to get the same info and because it may contain a controller or inherit from one

When doing alias processing, classes that are inside a controller or do not end in `Controller` will NOT be processed except as needed for filters. This will probably change in the future when libraries get shoved through the alias processor, too.