summaryrefslogtreecommitdiff
path: root/lib/chef/formatters/doc.rb
diff options
context:
space:
mode:
authorNoah Kantrowitz <noah@coderanger.net>2018-06-14 18:39:14 -0700
committerNoah Kantrowitz <noah@coderanger.net>2018-06-14 18:39:14 -0700
commitd98d35448da139c5c039f810f5cb9c86094f695b (patch)
tree32a7af49b4919fc8a148690780f18d26ff4eb79b /lib/chef/formatters/doc.rb
parentaa4f3285f3e49919e29f40337183fd0510baaee5 (diff)
downloadchef-d98d35448da139c5c039f810f5cb9c86094f695b.tar.gz
Simplify the deprecations system a bit, and introduce ways to silence deprecation warnings.
Signed-off-by: Noah Kantrowitz <noah@coderanger.net>
Diffstat (limited to 'lib/chef/formatters/doc.rb')
-rw-r--r--lib/chef/formatters/doc.rb16
1 files changed, 6 insertions, 10 deletions
diff --git a/lib/chef/formatters/doc.rb b/lib/chef/formatters/doc.rb
index 0c51cc2cfb..d47ab73a30 100644
--- a/lib/chef/formatters/doc.rb
+++ b/lib/chef/formatters/doc.rb
@@ -414,19 +414,15 @@ class Chef
end
end
- def deprecation(message, location = caller(2..2)[0])
+ # (see Base#deprecation)
+ def deprecation(deprecation, _location = nil)
if Chef::Config[:treat_deprecation_warnings_as_errors]
super
+ elsif !deprecation.silenced?
+ # Save non-silenced deprecations to the screen until the end.
+ deprecations[deprecation.message] ||= { url: deprecation.url, locations: Set.new }
+ deprecations[deprecation.message][:locations] << deprecation.location
end
-
- # Save deprecations to the screen until the end
- if is_structured_deprecation?(message)
- url = message.url
- message = message.message
- end
-
- deprecations[message] ||= { url: url, locations: Set.new }
- deprecations[message][:locations] << location
end
def indent