Skip to content

Commit

Permalink
chore: rubocop
Browse files Browse the repository at this point in the history
  • Loading branch information
ronaldtse committed Jan 11, 2025
1 parent 7aae606 commit d83959d
Show file tree
Hide file tree
Showing 10 changed files with 66 additions and 137 deletions.
30 changes: 24 additions & 6 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2025-01-07 10:02:25 UTC using RuboCop version 1.69.2.
# on 2025-01-11 09:55:13 UTC using RuboCop version 1.70.0.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
Expand All @@ -13,8 +13,26 @@ Gemspec/RequiredRubyVersion:
Exclude:
- 'rfcxml.gemspec'

# Offense count: 6
# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
# AllowedMethods: refine
Metrics/BlockLength:
Max: 34
# Offense count: 1
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: EnforcedStyle, IndentationWidth.
# SupportedStyles: with_first_element, with_fixed_indentation
Layout/ArrayAlignment:
Exclude:
- 'lib/rfcxml/v3/dt.rb'

# Offense count: 2
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: Max, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns, SplitStrings.
# URISchemes: http, https
Layout/LineLength:
Exclude:
- 'lib/rfcxml/v3/dt.rb'
- 'lib/rfcxml/v3/li.rb'

# Offense count: 1
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: AllowInHeredoc.
Layout/TrailingWhitespace:
Exclude:
- 'lib/rfcxml/v3/dt.rb'
10 changes: 6 additions & 4 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@

source "https://rubygems.org"

# Specify your gem's dependencies in rfcxml.gemspec
# Specify your gem's dependencies in genericode.gemspec
gemspec

gem "equivalent-xml"
gem "nokogiri"
gem "rake", "~> 13.0"

gem "rspec", "~> 3.0"

gem "rubocop", "~> 1.21"
gem "rubocop"
gem "rubocop-performance"
gem "xml-c14n"
26 changes: 5 additions & 21 deletions lib/rfcxml/v3/blockquote.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,27 +65,11 @@ class Blockquote < Lutaml::Model::Serializable
map_attribute "pn", to: :pn
map_attribute "cite", to: :cite
map_attribute "quotedFrom", to: :quoted_from
map_element "artset", to: :artset
map_element "artwork", to: :artwork
map_element "dl", to: :dl
map_element "figure", to: :figure
map_element "ol", to: :ol
map_element "sourcecode", to: :sourcecode
map_element "t", to: :t
map_element "ul", to: :ul
map_element "bcp14", to: :bcp14
map_element "br", to: :br
map_element "cref", to: :cref
map_element "em", to: :em
map_element "eref", to: :eref
map_element "iref", to: :iref
map_element "relref", to: :relref
map_element "strong", to: :strong
map_element "sub", to: :sub
map_element "sup", to: :sup
map_element "tt", to: :tt
map_element "u", to: :u
map_element "xref", to: :xref

%w[artset artwork dl figure ol sourcecode t ul bcp14 br cref em eref
iref relref strong sub sup tt u xref].each do |element|
map_element element, to: element.to_sym
end
end
end
end
Expand Down
28 changes: 5 additions & 23 deletions lib/rfcxml/v3/dd.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,29 +63,11 @@ class Dd < Lutaml::Model::Serializable
map_content to: :content
map_attribute "anchor", to: :anchor
map_attribute "pn", to: :pn
map_element "artset", to: :artset
map_element "artwork", to: :artwork
map_element "aside", to: :aside
map_element "dl", to: :dl
map_element "figure", to: :figure
map_element "ol", to: :ol
map_element "sourcecode", to: :sourcecode
map_element "t", to: :t
map_element "table", to: :table
map_element "ul", to: :ul
map_element "bcp14", to: :bcp14
map_element "br", to: :br
map_element "cref", to: :cref
map_element "em", to: :em
map_element "eref", to: :eref
map_element "iref", to: :iref
map_element "relref", to: :relref
map_element "strong", to: :strong
map_element "sub", to: :sub
map_element "sup", to: :sup
map_element "tt", to: :tt
map_element "u", to: :u
map_element "xref", to: :xref

%w[artset artwork aside dl figure ol sourcecode t table ul bcp14 br
cref em eref iref relref strong sub sup tt u xref].each do |element|
map_element element, to: element.to_sym
end
end
end
end
Expand Down
17 changes: 5 additions & 12 deletions lib/rfcxml/v3/dt.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,18 +40,11 @@ class Dt < Lutaml::Model::Serializable
map_content to: :content
map_attribute "anchor", to: :anchor
map_attribute "pn", to: :pn
map_element "bcp14", to: :bcp14
map_element "br", to: :br
map_element "cref", to: :cref
map_element "em", to: :em
map_element "eref", to: :eref
map_element "iref", to: :iref
map_element "relref", to: :relref
map_element "strong", to: :strong
map_element "sub", to: :sub
map_element "sup", to: :sup
map_element "tt", to: :tt
map_element "xref", to: :xref

%w[bcp14 br cref em eref iref relref strong sub sup tt
xref].each do |element|
map_element element, to: element.to_sym
end
end
end
end
Expand Down
12 changes: 5 additions & 7 deletions lib/rfcxml/v3/figure.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,11 @@ class Figure < Lutaml::Model::Serializable
map_attribute "alt", to: :alt
map_attribute "width", to: :width
map_attribute "height", to: :height
map_element "name", to: :name
map_element "iref", to: :iref
map_element "preamble", to: :preamble
map_element "artset", to: :artset
map_element "artwork", to: :artwork
map_element "sourcecode", to: :sourcecode
map_element "postamble", to: :postamble

%w[name iref preamble artset artwork sourcecode
postamble].each do |element|
map_element element, to: element.to_sym
end
end
end
end
Expand Down
28 changes: 5 additions & 23 deletions lib/rfcxml/v3/li.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,29 +68,11 @@ class Li < Lutaml::Model::Serializable
map_attribute "anchor", to: :anchor
map_attribute "derivedCounter", to: :derived_counter
map_attribute "pn", to: :pn
map_element "artset", to: :artset
map_element "artwork", to: :artwork
map_element "blockquote", to: :blockquote
map_element "dl", to: :dl
map_element "figure", to: :figure
map_element "ol", to: :ol
map_element "sourcecode", to: :sourcecode
map_element "t", to: :t
map_element "table", to: :table
map_element "ul", to: :ul
map_element "bcp14", to: :bcp14
map_element "br", to: :br
map_element "cref", to: :cref
map_element "em", to: :em
map_element "eref", to: :eref
map_element "iref", to: :iref
map_element "relref", to: :relref
map_element "strong", to: :strong
map_element "sub", to: :sub
map_element "sup", to: :sup
map_element "tt", to: :tt
map_element "u", to: :u
map_element "xref", to: :xref

%w[artset artwork blockquote dl figure ol sourcecode t table ul bcp14
br cref em eref iref relref strong sub sup tt u xref].each do |element|
map_element element, to: element.to_sym
end
end
end
end
Expand Down
8 changes: 4 additions & 4 deletions lib/rfcxml/v3/rfc.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,10 @@ class Rfc < Lutaml::Model::Serializable
map_attribute "scripts", to: :scripts
map_attribute "expiresDate", to: :expires_date
map_attribute "lang", to: :lang, prefix: :xml
map_element "link", to: :link
map_element "front", to: :front
map_element "middle", to: :middle
map_element "back", to: :back

%w[link front middle back].each do |element|
map_element element, to: element.to_sym
end
end
end
end
Expand Down
26 changes: 5 additions & 21 deletions lib/rfcxml/v3/td.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,27 +62,11 @@ class Td < Lutaml::Model::Serializable
map_attribute "colspan", to: :colspan
map_attribute "rowspan", to: :rowspan
map_attribute "align", to: :align
map_element "artset", to: :artset
map_element "artwork", to: :artwork
map_element "dl", to: :dl
map_element "figure", to: :figure
map_element "ol", to: :ol
map_element "sourcecode", to: :sourcecode
map_element "t", to: :t
map_element "ul", to: :ul
map_element "bcp14", to: :bcp14
map_element "br", to: :br
map_element "cref", to: :cref
map_element "em", to: :em
map_element "eref", to: :eref
map_element "iref", to: :iref
map_element "relref", to: :relref
map_element "strong", to: :strong
map_element "sub", to: :sub
map_element "sup", to: :sup
map_element "tt", to: :tt
map_element "u", to: :u
map_element "xref", to: :xref

%w[artset artwork dl figure ol sourcecode t ul bcp14 br cref em eref
iref relref strong sub sup tt u xref].each do |element|
map_element element, to: element.to_sym
end
end
end
end
Expand Down
18 changes: 2 additions & 16 deletions rfcxml.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@ Gem::Specification.new do |spec|
spec.metadata["source_code_uri"] = spec.homepage
spec.metadata["changelog_uri"] = "https://github.com/metanorma/rfcxml/releases"

# Specify which files should be added to the gem when it is released.
# The `git ls-files -z` loads the files in the RubyGem
# that have been added into git.
spec.files = Dir.chdir(File.expand_path(__dir__)) do
`git ls-files -z`
.split("\x0")
Expand All @@ -31,17 +28,6 @@ Gem::Specification.new do |spec|

spec.required_ruby_version = ">= 2.7.0"

spec.add_runtime_dependency "lutaml-model"
spec.add_runtime_dependency "nokogiri"

spec.add_development_dependency "equivalent-xml"
spec.add_development_dependency "rake"
spec.add_development_dependency "rspec"
spec.add_development_dependency "rubocop"
spec.add_development_dependency "rubocop-performance"
spec.add_development_dependency "xml-c14n"

spec.metadata["homepage_uri"] = spec.homepage
spec.metadata["source_code_uri"] = spec.homepage
spec.metadata["changelog_uri"] = spec.homepage
spec.add_dependency "lutaml-model"
spec.add_dependency "nokogiri"
end

0 comments on commit d83959d

Please sign in to comment.