Skip to content

Commit

Permalink
Run prettier again after ignore :(
Browse files Browse the repository at this point in the history
  • Loading branch information
SuperTux88 committed Jul 25, 2022
1 parent 31f8be3 commit b6653e9
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 45 deletions.
2 changes: 2 additions & 0 deletions docs/entities/index.md
Expand Up @@ -5,7 +5,9 @@ title: Entities
The diaspora\* federation protocol currently knows the following entities:

<!-- prettier-ignore-start -->

{% for entity in site.entities %}

- [{{ entity.title }}]({{ site.baseurl }}{{ entity.url }})
{% endfor %}
<!-- prettier-ignore-end -->
1 change: 1 addition & 0 deletions docs/federation/types.md
Expand Up @@ -6,6 +6,7 @@ This page describes which types are used for values of the [federation entities]
need to be.

<!-- prettier-ignore-start -->

- TOC
{:toc}
<!-- prettier-ignore-end -->
Expand Down
10 changes: 2 additions & 8 deletions lib/diaspora_federation/discovery/xrd_document.rb
Expand Up @@ -193,9 +193,7 @@ def add_links_to(xml)
.each do |node|
link = {}
# prettier-ignore-start
LINK_ATTRS.each do |attr|
link[attr] = node[attr.to_s] if node.key?(attr.to_s)
end
LINK_ATTRS.each { |attr| link[attr] = node[attr.to_s] if node.key?(attr.to_s) }
# prettier-ignore-end
links << link
end
Expand All @@ -206,11 +204,7 @@ def add_links_to(xml)
# prettier-ignore
private_class_method def self.symbolize_keys_for_links(links)
# prettier-ignore-start
links&.map do |link|
LINK_ATTRS.filter_map { |attr|
[attr, link[attr.to_s]] if link.key?(attr.to_s)
}.to_h
end
links&.map { |link| LINK_ATTRS.filter_map { |attr| [attr, link[attr.to_s]] if link.key?(attr.to_s) }.to_h }
# prettier-ignore-end
end
end
Expand Down
12 changes: 4 additions & 8 deletions lib/diaspora_federation/entity.rb
Expand Up @@ -103,11 +103,9 @@ def to_h
# prettier-ignore
def to_xml
doc = Nokogiri::XML::Document.new
Nokogiri::XML::Element.new(self.class.entity_name, doc).tap do |root_element|
xml_elements.each do |name, value|
add_property_to_xml(doc, root_element, name, value)
end
end
Nokogiri::XML::Element
.new(self.class.entity_name, doc)
.tap { |root_element| xml_elements.each { |name, value| add_property_to_xml(doc, root_element, name, value) } }
end

# Construct a new instance of the given Entity and populate the properties
Expand Down Expand Up @@ -317,9 +315,7 @@ def add_property_to_xml(doc, root_element, name, value)
# prettier-ignore
def simple_node(doc, name, value)
# prettier-ignore-start
Nokogiri::XML::Element.new(name.to_s, doc).tap do |node|
node.content = value unless value.empty?
end
Nokogiri::XML::Element.new(name.to_s, doc).tap { |node| node.content = value unless value.empty? }
# prettier-ignore-end
end

Expand Down
11 changes: 7 additions & 4 deletions lib/diaspora_federation/validators/rules/public_key.rb
Expand Up @@ -22,10 +22,13 @@ def valid_value?(value)

# prettier-ignore-start
(
(value.strip.start_with?("-----BEGIN PUBLIC KEY-----") &&
value.strip.end_with?("-----END PUBLIC KEY-----")) ||
(value.strip.start_with?("-----BEGIN RSA PUBLIC KEY-----") &&
value.strip.end_with?("-----END RSA PUBLIC KEY-----"))
(
value.strip.start_with?("-----BEGIN PUBLIC KEY-----") && value.strip.end_with?("-----END PUBLIC KEY-----")
) ||
(
value.strip.start_with?("-----BEGIN RSA PUBLIC KEY-----") &&
value.strip.end_with?("-----END RSA PUBLIC KEY-----")
)
)
# prettier-ignore-end
end
Expand Down
28 changes: 3 additions & 25 deletions spec/lib/diaspora_federation/entity_spec.rb
Expand Up @@ -226,27 +226,9 @@ module DiasporaFederation

describe "#to_json" do
# prettier-ignore-start
let(:basic_props) do
{
test1: "123",
test2: false,
test3: "456",
test4: 789,
test5: Time.now.utc
}
end
let(:basic_props) { { test1: "123", test2: false, test3: "456", test4: 789, test5: Time.now.utc } }

let(:hash) do
basic_props.merge(
test6: {
test: "000"
},
multi: [
{ asdf: "01" },
{ asdf: "02" }
]
)
end
let(:hash) { basic_props.merge(test6: { test: "000" }, multi: [{ asdf: "01" }, { asdf: "02" }]) }
# prettier-ignore-end
let(:entity_class) { Entities::TestComplexEntity }

Expand Down Expand Up @@ -453,11 +435,7 @@ def self.from_hash(_arg1, _arg2, _arg3)

# prettier-ignore-start
let(:nested_hash) do
{
asdf: nested_data[:asdf],
test: nested_data[:test].to_h,
multi: nested_data[:multi].map(&:to_h)
}
{ asdf: nested_data[:asdf], test: nested_data[:test].to_h, multi: nested_data[:multi].map(&:to_h) }
end
# prettier-ignore-end

Expand Down

0 comments on commit b6653e9

Please sign in to comment.