From 6282f26986edae5d2538d388fde6453629512c7a Mon Sep 17 00:00:00 2001 From: Ronald Tse Date: Tue, 21 Apr 2026 06:54:22 +0800 Subject: [PATCH] fix: add collection: true to XhtmlContent content attribute --- .rubocop_todo.yml | 196 ++----------------------------------- Gemfile | 1 + lib/reqif/reqif_float.rb | 1 + lib/reqif/xhtml_content.rb | 3 +- 4 files changed, 12 insertions(+), 189 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 3189721..49e9697 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1,159 +1,26 @@ # This configuration was generated by # `rubocop --auto-gen-config` -# on 2026-04-01 07:11:02 UTC using RuboCop version 1.86.0. +# on 2026-04-20 22:54:00 UTC using RuboCop version 1.86.1. # 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 # versions of RuboCop, may require this file to be generated again. -# Offense count: 17 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: TreatCommentsAsGroupSeparators, ConsiderPunctuation. -Bundler/OrderedGems: - Exclude: - - 'Gemfile' - -# Offense count: 1 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: TreatCommentsAsGroupSeparators, ConsiderPunctuation. -Gemspec/OrderedDependencies: - Exclude: - - 'reqif.gemspec' - -# Offense count: 1 -# This cop supports safe autocorrection (--autocorrect). -Gemspec/RequireMFA: - Exclude: - - 'reqif.gemspec' - -# Offense count: 63 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: EnforcedStyle, IndentationWidth. -# SupportedStyles: with_first_argument, with_fixed_indentation -Layout/ArgumentAlignment: - Exclude: - - 'lib/reqif.rb' - - 'lib/reqif/datatypes.rb' - - 'lib/reqif/default_value.rb' - - 'lib/reqif/definition.rb' - - 'lib/reqif/doors/readonly_attributes.rb' - - 'lib/reqif/editable_atts.rb' - - 'lib/reqif/reqif_float.rb' - - 'lib/reqif/spec_attributes.rb' - - 'lib/reqif/type.rb' - - 'lib/reqif/values.rb' - -# Offense count: 2 -# This cop supports safe autocorrection (--autocorrect). -Layout/ClosingParenthesisIndentation: - Exclude: - - 'spec/reqif/polarion_export_spec.rb' - - 'spec/spec_helper.rb' - -# Offense count: 22 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: AllowForAlignment. -Layout/CommentIndentation: - Exclude: - - 'lib/reqif/doors/module_definition.rb' - - 'lib/reqif/doors/readonly_attributes.rb' - - 'lib/reqif/doors/rif_definition.rb' - - 'lib/reqif/req_if_tool_extension.rb' - -# Offense count: 1 -# This cop supports safe autocorrection (--autocorrect). -Layout/ElseAlignment: - Exclude: - - 'spec/spec_helper.rb' - -# Offense count: 1 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: EnforcedStyle. -# SupportedStyles: empty_lines, empty_lines_except_namespace, empty_lines_special, no_empty_lines, beginning_only, ending_only -Layout/EmptyLinesAroundClassBody: - Exclude: - - 'lib/reqif/req_if_tool_extension.rb' - -# Offense count: 2 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: EnforcedStyle, IndentationWidth. -# SupportedStyles: consistent, consistent_relative_to_receiver, special_for_inner_method_call, special_for_inner_method_call_in_parentheses -Layout/FirstArgumentIndentation: - Exclude: - - 'spec/reqif/polarion_export_spec.rb' - - 'spec/spec_helper.rb' - -# Offense count: 4 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: EnforcedStyle. -# SupportedStyles: normal, indented_internal_methods -Layout/IndentationConsistency: - Exclude: - - 'lib/reqif/doors/readonly_attributes.rb' - - 'reqif.gemspec' - -# Offense count: 10 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: Width, EnforcedStyleAlignWith, AllowedPatterns. -# SupportedStylesAlignWith: start_of_line, relative_to_receiver -Layout/IndentationWidth: - Exclude: - - 'lib/reqif/doors/readonly_attributes.rb' - - 'spec/spec_helper.rb' - -# Offense count: 78 +# Offense count: 14 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: Max, AllowHeredoc, AllowURI, AllowQualifiedName, URISchemes, AllowRBSInlineAnnotation, AllowCopDirectives, AllowedPatterns, SplitStrings. # URISchemes: http, https Layout/LineLength: - Enabled: false - -# Offense count: 1 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: EnforcedStyle. -# SupportedStyles: symmetrical, new_line, same_line -Layout/MultilineMethodCallBraceLayout: Exclude: + - 'lib/reqif/doors/string_type.rb' + - 'lib/reqif/high_precision_date_time.rb' + - 'lib/reqif/namespace.rb' + - 'lib/reqif/reqif_integer.rb' - 'spec/reqif/polarion_export_spec.rb' - -# Offense count: 1 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: EnforcedStyle, IndentationWidth. -# SupportedStyles: aligned, indented -Layout/MultilineOperationIndentation: - Exclude: + - 'spec/reqif/spec_types_spec.rb' + - 'spec/reqif/specifications_spec.rb' - 'spec/reqif_spec.rb' - -# Offense count: 8 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: EnforcedStyle. -# SupportedStyles: final_newline, final_blank_line -Layout/TrailingEmptyLines: - Exclude: - - 'lib/reqif/doors/identifier.rb' - - 'lib/reqif/doors/module_definition.rb' - - 'lib/reqif/doors/namespace.rb' - - 'lib/reqif/doors/readonly_attributes.rb' - - 'lib/reqif/doors/rif_definition.rb' - - 'lib/reqif/doors/string_type.rb' - - 'lib/reqif/string_type.rb' - - 'lib/reqif/xhtml/namespace.rb' - -# Offense count: 63 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: AllowInHeredoc. -Layout/TrailingWhitespace: - Exclude: - - 'lib/reqif.rb' - - 'lib/reqif/datatypes.rb' - - 'lib/reqif/default_value.rb' - - 'lib/reqif/definition.rb' - - 'lib/reqif/doors/readonly_attributes.rb' - - 'lib/reqif/editable_atts.rb' - - 'lib/reqif/reqif_float.rb' - - 'lib/reqif/spec_attributes.rb' - - 'lib/reqif/type.rb' - - 'lib/reqif/values.rb' + - 'spec/spec_helper.rb' # Offense count: 1 # Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns, inherit_mode. @@ -187,14 +54,6 @@ RSpec/ExampleLength: RSpec/MultipleExpectations: Max: 8 -# Offense count: 1 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: EnforcedStyle. -# SupportedStyles: not_to, to_not -RSpec/NotToNot: - Exclude: - - 'spec/reqif/polarion_export_spec.rb' - # Offense count: 2 # Configuration parameters: CustomTransform, IgnoreMethods, IgnoreMetadata, InflectorPath, EnforcedInflector. # SupportedInflectors: default, active_support @@ -202,40 +61,3 @@ RSpec/SpecFilePathFormat: Exclude: - 'spec/reqif/data_types_spec.rb' - 'spec/reqif/tool_extension_spec.rb' - -# Offense count: 2 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: EnforcedStyle. -# SupportedStyles: separated, grouped -Style/AccessorGrouping: - Exclude: - - 'lib/reqif/high_precision_date_time.rb' - -# Offense count: 1 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: AllowIfModifier. -Style/IfInsideElse: - Exclude: - - 'spec/spec_helper.rb' - -# Offense count: 1 -# This cop supports safe autocorrection (--autocorrect). -Style/MultilineIfModifier: - Exclude: - - 'lib/reqif/reqif_float.rb' - -# Offense count: 2 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline. -# SupportedStyles: single_quotes, double_quotes -Style/StringLiterals: - Exclude: - - 'reqif.gemspec' - -# Offense count: 1 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: EnforcedStyleForMultiline. -# SupportedStylesForMultiline: comma, consistent_comma, diff_comma, no_comma -Style/TrailingCommaInArguments: - Exclude: - - 'spec/reqif/req_if_spec.rb' diff --git a/Gemfile b/Gemfile index 25c379a..48e15e7 100644 --- a/Gemfile +++ b/Gemfile @@ -7,6 +7,7 @@ gemspec gem "canon" gem "lutaml-model", github: "lutaml/lutaml-model", branch: "main" +gem "moxml" gem "nokogiri" gem "rake", "~> 13.0" gem "rspec", "~> 3.0" diff --git a/lib/reqif/reqif_float.rb b/lib/reqif/reqif_float.rb index 4c029f7..9d3058b 100644 --- a/lib/reqif/reqif_float.rb +++ b/lib/reqif/reqif_float.rb @@ -67,6 +67,7 @@ def self.format_scientific(float_value) def self.cast(value, options = {}) return nil if value.nil? + return value if Lutaml::Model::Utils.uninitialized?(value) unless options.equal?(EMPTY_OPTIONS) Lutaml::Model::Services::Type::Validator::Number.validate!(value, diff --git a/lib/reqif/xhtml_content.rb b/lib/reqif/xhtml_content.rb index efdc5a1..26a1a3e 100644 --- a/lib/reqif/xhtml_content.rb +++ b/lib/reqif/xhtml_content.rb @@ -82,8 +82,7 @@ class XhtmlContent < Lutaml::Model::Serializable attribute :rp, Hyperlang::Xhtml::Rp, collection: true attribute :rbc, Hyperlang::Xhtml::Rbc, collection: true attribute :rtc, Hyperlang::Xhtml::Rtc, collection: true - attribute :content, :string - + attribute :content, :string, collection: true xml do element "XHTML-CONTENT" namespace Namespace