Skip to content

Commit

Permalink
Merge pull request #16 from TBAA/master
Browse files Browse the repository at this point in the history
Filter Parameter Logging
  • Loading branch information
radar committed Jan 19, 2012
2 parents a333f4e + 23d099e commit bfb804d
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
14 changes: 14 additions & 0 deletions lib/application_checker.rb
Expand Up @@ -358,6 +358,20 @@ def check_old_action_mailer_sent_on_setting
) )
end end
end end
def check_old_filter_parameter
files = []
lines = grep_for("filter_parameter_logging", "app/controllers/*")
files += extract_filenames(lines) || []

unless files.empty?
alert(
"Deprecated filter_parameter_logging calls",
"The list of filtered parameters are now stored in /config/application.rb. For example: config.filter_parameters += [:password]",
"http://de.asciicasts.com/episodes/224-controller-in-rails-3",
files
)
end
end
private private
def grep_for_with_perl_regex(text, where = "./", double_quote = false) def grep_for_with_perl_regex(text, where = "./", double_quote = false)
grep_for(text, where, double_quote, true) grep_for(text, where, double_quote, true)
Expand Down
7 changes: 7 additions & 0 deletions test/application_checker_test.rb
Expand Up @@ -304,6 +304,13 @@ def test_check_old_ajax_helpers


assert @checker.alerts.has_key?("Deprecated AJAX helper calls") assert @checker.alerts.has_key?("Deprecated AJAX helper calls")
end end

def test_check_old_ajax_helpers
make_file("app/controllers", "application_controller.rb", "filter_parameter_logging :password")
@checker.check_old_filter_parameter

assert @checker.alerts.has_key?("Deprecated filter_parameter_logging calls")
end


def test_check_old_ajax_helpers_empty def test_check_old_ajax_helpers_empty
@checker.check_old_ajax_helpers @checker.check_old_ajax_helpers
Expand Down

0 comments on commit bfb804d

Please sign in to comment.