summaryrefslogtreecommitdiff
path: root/lib/banzai
diff options
context:
space:
mode:
authorJacopo <beschi.jacopo@gmail.com>2017-11-14 10:02:39 +0100
committerJacopo <beschi.jacopo@gmail.com>2017-11-16 17:58:29 +0100
commit181cd299f9e06223e8338e93b1c318c671ccb1aa (patch)
tree0d71dcf3f786496eaa46b9d65ce2626f162015da /lib/banzai
parentf2997af4d5cdec3266d3178edeedc36d4e590062 (diff)
downloadgitlab-ce-181cd299f9e06223e8338e93b1c318c671ccb1aa.tar.gz
Adds Rubocop rule for line break after guard clause
Adds a rubocop rule (with autocorrect) to ensure line break after guard clauses.
Diffstat (limited to 'lib/banzai')
-rw-r--r--lib/banzai/object_renderer.rb1
-rw-r--r--lib/banzai/querying.rb2
-rw-r--r--lib/banzai/reference_parser/user_parser.rb1
-rw-r--r--lib/banzai/renderer.rb2
4 files changed, 6 insertions, 0 deletions
diff --git a/lib/banzai/object_renderer.rb b/lib/banzai/object_renderer.rb
index 9bb8ed913d8..ecb3affbba5 100644
--- a/lib/banzai/object_renderer.rb
+++ b/lib/banzai/object_renderer.rb
@@ -86,6 +86,7 @@ module Banzai
def save_options
return {} unless base_context[:xhtml]
+
{ save_with: Nokogiri::XML::Node::SaveOptions::AS_XHTML }
end
end
diff --git a/lib/banzai/querying.rb b/lib/banzai/querying.rb
index fb2faae02bc..a19a05e8c0d 100644
--- a/lib/banzai/querying.rb
+++ b/lib/banzai/querying.rb
@@ -52,8 +52,10 @@ module Banzai
children.each do |child|
next if child.text.blank?
+
node = nodes.shift
break unless node == child
+
filtered_nodes << node
end
end
diff --git a/lib/banzai/reference_parser/user_parser.rb b/lib/banzai/reference_parser/user_parser.rb
index 4d336068861..8932d4f2905 100644
--- a/lib/banzai/reference_parser/user_parser.rb
+++ b/lib/banzai/reference_parser/user_parser.rb
@@ -31,6 +31,7 @@ module Banzai
nodes.each do |node|
if node.has_attribute?(group_attr)
next unless can_read_group_reference?(node, user, groups)
+
visible << node
elsif can_read_project_reference?(node)
visible << node
diff --git a/lib/banzai/renderer.rb b/lib/banzai/renderer.rb
index 5cb9adf52b0..0050295eeda 100644
--- a/lib/banzai/renderer.rb
+++ b/lib/banzai/renderer.rb
@@ -149,6 +149,7 @@ module Banzai
def self.full_cache_key(cache_key, pipeline_name)
return unless cache_key
+
["banzai", *cache_key, pipeline_name || :full]
end
@@ -157,6 +158,7 @@ module Banzai
# method.
def self.full_cache_multi_key(cache_key, pipeline_name)
return unless cache_key
+
Rails.cache.__send__(:expanded_key, full_cache_key(cache_key, pipeline_name)) # rubocop:disable GitlabSecurity/PublicSend
end
end