Skip to content

Commit

Permalink
Process Concerns before regular files
Browse files Browse the repository at this point in the history
  • Loading branch information
presidentbeef committed Nov 28, 2016
1 parent 98d506f commit b68370c
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions lib/brakeman/app_tree.rb
Original file line number Diff line number Diff line change
Expand Up @@ -89,15 +89,15 @@ def path_exists?(path)
end

def initializer_paths
@initializer_paths ||= find_paths("config/initializers")
@initializer_paths ||= prioritize_concerns(find_paths("config/initializers"))
end

def controller_paths
@controller_paths ||= find_paths("app/**/controllers")
@controller_paths ||= prioritize_concerns(find_paths("app/**/controllers"))
end

def model_paths
@model_paths ||= find_paths("app/**/models")
@model_paths ||= prioritize_concerns(find_paths("app/**/models"))
end

def template_paths
Expand Down Expand Up @@ -177,5 +177,9 @@ def root_search_pattern
rel_engines = (rel + [""]).join("/,")
@root_search_patrern = "{#{roots}}/{#{rel_engines}}"
end

def prioritize_concerns paths
paths.partition { |path| path.include? "concerns" }.flatten
end
end
end

0 comments on commit b68370c

Please sign in to comment.