moxml 0.1.7 → 0.1.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (215) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/dependent-repos.json +5 -0
  3. data/.github/workflows/dependent-tests.yml +20 -0
  4. data/.github/workflows/docs.yml +59 -0
  5. data/.github/workflows/rake.yml +10 -10
  6. data/.github/workflows/release.yml +5 -3
  7. data/.gitignore +37 -0
  8. data/.rubocop.yml +15 -7
  9. data/.rubocop_todo.yml +224 -43
  10. data/Gemfile +14 -9
  11. data/LICENSE.md +6 -2
  12. data/README.adoc +535 -373
  13. data/Rakefile +53 -0
  14. data/benchmarks/.gitignore +6 -0
  15. data/benchmarks/generate_report.rb +550 -0
  16. data/docs/Gemfile +13 -0
  17. data/docs/_config.yml +138 -0
  18. data/docs/_guides/advanced-features.adoc +87 -0
  19. data/docs/_guides/development-testing.adoc +165 -0
  20. data/docs/_guides/index.adoc +51 -0
  21. data/docs/_guides/modifying-xml.adoc +292 -0
  22. data/docs/_guides/parsing-xml.adoc +230 -0
  23. data/docs/_guides/sax-parsing.adoc +603 -0
  24. data/docs/_guides/working-with-documents.adoc +118 -0
  25. data/docs/_guides/xml-declaration.adoc +450 -0
  26. data/docs/_pages/adapter-compatibility.adoc +369 -0
  27. data/docs/_pages/adapters/headed-ox.adoc +237 -0
  28. data/docs/_pages/adapters/index.adoc +97 -0
  29. data/docs/_pages/adapters/libxml.adoc +285 -0
  30. data/docs/_pages/adapters/nokogiri.adoc +251 -0
  31. data/docs/_pages/adapters/oga.adoc +291 -0
  32. data/docs/_pages/adapters/ox.adoc +56 -0
  33. data/docs/_pages/adapters/rexml.adoc +292 -0
  34. data/docs/_pages/best-practices.adoc +429 -0
  35. data/docs/_pages/compatibility.adoc +467 -0
  36. data/docs/_pages/configuration.adoc +250 -0
  37. data/docs/_pages/error-handling.adoc +349 -0
  38. data/docs/_pages/headed-ox-limitations.adoc +574 -0
  39. data/docs/_pages/headed-ox.adoc +1025 -0
  40. data/docs/_pages/index.adoc +35 -0
  41. data/docs/_pages/installation.adoc +140 -0
  42. data/docs/_pages/node-api-reference.adoc +49 -0
  43. data/docs/_pages/performance.adoc +35 -0
  44. data/docs/_pages/quick-start.adoc +243 -0
  45. data/docs/_pages/thread-safety.adoc +28 -0
  46. data/docs/_references/document-api.adoc +407 -0
  47. data/docs/_references/index.adoc +48 -0
  48. data/docs/_tutorials/basic-usage.adoc +267 -0
  49. data/docs/_tutorials/builder-pattern.adoc +342 -0
  50. data/docs/_tutorials/index.adoc +33 -0
  51. data/docs/_tutorials/namespace-handling.adoc +324 -0
  52. data/docs/_tutorials/xpath-queries.adoc +358 -0
  53. data/docs/index.adoc +122 -0
  54. data/examples/README.md +124 -0
  55. data/examples/api_client/README.md +424 -0
  56. data/examples/api_client/api_client.rb +394 -0
  57. data/examples/api_client/example_response.xml +48 -0
  58. data/examples/headed_ox_example/README.md +90 -0
  59. data/examples/headed_ox_example/headed_ox_demo.rb +71 -0
  60. data/examples/rss_parser/README.md +194 -0
  61. data/examples/rss_parser/example_feed.xml +93 -0
  62. data/examples/rss_parser/rss_parser.rb +189 -0
  63. data/examples/sax_parsing/README.md +50 -0
  64. data/examples/sax_parsing/data_extractor.rb +75 -0
  65. data/examples/sax_parsing/example.xml +21 -0
  66. data/examples/sax_parsing/large_file.rb +78 -0
  67. data/examples/sax_parsing/simple_parser.rb +55 -0
  68. data/examples/web_scraper/README.md +352 -0
  69. data/examples/web_scraper/example_page.html +201 -0
  70. data/examples/web_scraper/web_scraper.rb +312 -0
  71. data/lib/moxml/adapter/base.rb +107 -28
  72. data/lib/moxml/adapter/customized_libxml/cdata.rb +28 -0
  73. data/lib/moxml/adapter/customized_libxml/comment.rb +24 -0
  74. data/lib/moxml/adapter/customized_libxml/declaration.rb +85 -0
  75. data/lib/moxml/adapter/customized_libxml/element.rb +39 -0
  76. data/lib/moxml/adapter/customized_libxml/node.rb +44 -0
  77. data/lib/moxml/adapter/customized_libxml/processing_instruction.rb +31 -0
  78. data/lib/moxml/adapter/customized_libxml/text.rb +27 -0
  79. data/lib/moxml/adapter/customized_oga/xml_generator.rb +1 -1
  80. data/lib/moxml/adapter/customized_ox/attribute.rb +28 -1
  81. data/lib/moxml/adapter/customized_rexml/formatter.rb +13 -8
  82. data/lib/moxml/adapter/headed_ox.rb +161 -0
  83. data/lib/moxml/adapter/libxml.rb +1564 -0
  84. data/lib/moxml/adapter/nokogiri.rb +156 -9
  85. data/lib/moxml/adapter/oga.rb +190 -15
  86. data/lib/moxml/adapter/ox.rb +322 -28
  87. data/lib/moxml/adapter/rexml.rb +157 -28
  88. data/lib/moxml/adapter.rb +21 -4
  89. data/lib/moxml/attribute.rb +6 -0
  90. data/lib/moxml/builder.rb +40 -4
  91. data/lib/moxml/config.rb +8 -3
  92. data/lib/moxml/context.rb +57 -2
  93. data/lib/moxml/declaration.rb +9 -0
  94. data/lib/moxml/doctype.rb +13 -1
  95. data/lib/moxml/document.rb +53 -6
  96. data/lib/moxml/document_builder.rb +34 -5
  97. data/lib/moxml/element.rb +71 -2
  98. data/lib/moxml/error.rb +175 -6
  99. data/lib/moxml/node.rb +155 -4
  100. data/lib/moxml/node_set.rb +34 -0
  101. data/lib/moxml/sax/block_handler.rb +194 -0
  102. data/lib/moxml/sax/element_handler.rb +124 -0
  103. data/lib/moxml/sax/handler.rb +113 -0
  104. data/lib/moxml/sax.rb +31 -0
  105. data/lib/moxml/version.rb +1 -1
  106. data/lib/moxml/xml_utils/encoder.rb +4 -4
  107. data/lib/moxml/xml_utils.rb +7 -4
  108. data/lib/moxml/xpath/ast/node.rb +159 -0
  109. data/lib/moxml/xpath/cache.rb +91 -0
  110. data/lib/moxml/xpath/compiler.rb +1770 -0
  111. data/lib/moxml/xpath/context.rb +26 -0
  112. data/lib/moxml/xpath/conversion.rb +124 -0
  113. data/lib/moxml/xpath/engine.rb +52 -0
  114. data/lib/moxml/xpath/errors.rb +101 -0
  115. data/lib/moxml/xpath/lexer.rb +304 -0
  116. data/lib/moxml/xpath/parser.rb +485 -0
  117. data/lib/moxml/xpath/ruby/generator.rb +269 -0
  118. data/lib/moxml/xpath/ruby/node.rb +193 -0
  119. data/lib/moxml/xpath.rb +37 -0
  120. data/lib/moxml.rb +5 -2
  121. data/moxml.gemspec +3 -1
  122. data/old-specs/moxml/adapter/customized_libxml/.gitkeep +6 -0
  123. data/spec/consistency/README.md +77 -0
  124. data/spec/{moxml/examples/adapter_spec.rb → consistency/adapter_parity_spec.rb} +4 -4
  125. data/spec/examples/README.md +75 -0
  126. data/spec/{support/shared_examples/examples/attribute.rb → examples/attribute_examples_spec.rb} +1 -1
  127. data/spec/{support/shared_examples/examples/basic_usage.rb → examples/basic_usage_spec.rb} +2 -2
  128. data/spec/{support/shared_examples/examples/namespace.rb → examples/namespace_examples_spec.rb} +3 -3
  129. data/spec/{support/shared_examples/examples/readme_examples.rb → examples/readme_examples_spec.rb} +6 -4
  130. data/spec/{support/shared_examples/examples/xpath.rb → examples/xpath_examples_spec.rb} +10 -6
  131. data/spec/integration/README.md +71 -0
  132. data/spec/{moxml/all_with_adapters_spec.rb → integration/all_adapters_spec.rb} +3 -2
  133. data/spec/integration/headed_ox_integration_spec.rb +326 -0
  134. data/spec/{support → integration}/shared_examples/edge_cases.rb +37 -10
  135. data/spec/integration/shared_examples/high_level/.gitkeep +0 -0
  136. data/spec/{support/shared_examples/context.rb → integration/shared_examples/high_level/context_behavior.rb} +2 -1
  137. data/spec/{support/shared_examples/integration.rb → integration/shared_examples/integration_workflows.rb} +23 -6
  138. data/spec/integration/shared_examples/node_wrappers/.gitkeep +0 -0
  139. data/spec/{support/shared_examples/cdata.rb → integration/shared_examples/node_wrappers/cdata_behavior.rb} +6 -1
  140. data/spec/{support/shared_examples/comment.rb → integration/shared_examples/node_wrappers/comment_behavior.rb} +2 -1
  141. data/spec/{support/shared_examples/declaration.rb → integration/shared_examples/node_wrappers/declaration_behavior.rb} +5 -5
  142. data/spec/{support/shared_examples/doctype.rb → integration/shared_examples/node_wrappers/doctype_behavior.rb} +2 -2
  143. data/spec/{support/shared_examples/document.rb → integration/shared_examples/node_wrappers/document_behavior.rb} +1 -1
  144. data/spec/{support/shared_examples/node.rb → integration/shared_examples/node_wrappers/node_behavior.rb} +9 -2
  145. data/spec/{support/shared_examples/node_set.rb → integration/shared_examples/node_wrappers/node_set_behavior.rb} +1 -18
  146. data/spec/{support/shared_examples/processing_instruction.rb → integration/shared_examples/node_wrappers/processing_instruction_behavior.rb} +6 -2
  147. data/spec/moxml/README.md +41 -0
  148. data/spec/moxml/adapter/.gitkeep +0 -0
  149. data/spec/moxml/adapter/README.md +61 -0
  150. data/spec/moxml/adapter/base_spec.rb +27 -0
  151. data/spec/moxml/adapter/headed_ox_spec.rb +311 -0
  152. data/spec/moxml/adapter/libxml_spec.rb +14 -0
  153. data/spec/moxml/adapter/ox_spec.rb +9 -8
  154. data/spec/moxml/adapter/shared_examples/.gitkeep +0 -0
  155. data/spec/{support/shared_examples/xml_adapter.rb → moxml/adapter/shared_examples/adapter_contract.rb} +39 -12
  156. data/spec/moxml/adapter_spec.rb +16 -0
  157. data/spec/moxml/attribute_spec.rb +30 -0
  158. data/spec/moxml/builder_spec.rb +33 -0
  159. data/spec/moxml/cdata_spec.rb +31 -0
  160. data/spec/moxml/comment_spec.rb +31 -0
  161. data/spec/moxml/config_spec.rb +3 -3
  162. data/spec/moxml/context_spec.rb +28 -0
  163. data/spec/moxml/declaration_preservation_spec.rb +217 -0
  164. data/spec/moxml/declaration_spec.rb +36 -0
  165. data/spec/moxml/doctype_spec.rb +33 -0
  166. data/spec/moxml/document_builder_spec.rb +30 -0
  167. data/spec/moxml/document_spec.rb +105 -0
  168. data/spec/moxml/element_spec.rb +143 -0
  169. data/spec/moxml/error_spec.rb +266 -22
  170. data/spec/{moxml_spec.rb → moxml/moxml_spec.rb} +9 -9
  171. data/spec/moxml/namespace_spec.rb +32 -0
  172. data/spec/moxml/node_set_spec.rb +39 -0
  173. data/spec/moxml/node_spec.rb +37 -0
  174. data/spec/moxml/processing_instruction_spec.rb +34 -0
  175. data/spec/moxml/sax_spec.rb +1067 -0
  176. data/spec/moxml/text_spec.rb +31 -0
  177. data/spec/moxml/version_spec.rb +14 -0
  178. data/spec/moxml/xml_utils/.gitkeep +0 -0
  179. data/spec/moxml/xml_utils/encoder_spec.rb +27 -0
  180. data/spec/moxml/xml_utils_spec.rb +49 -0
  181. data/spec/moxml/xpath/ast/node_spec.rb +83 -0
  182. data/spec/moxml/xpath/axes_spec.rb +296 -0
  183. data/spec/moxml/xpath/cache_spec.rb +358 -0
  184. data/spec/moxml/xpath/compiler_spec.rb +406 -0
  185. data/spec/moxml/xpath/context_spec.rb +210 -0
  186. data/spec/moxml/xpath/conversion_spec.rb +365 -0
  187. data/spec/moxml/xpath/fixtures/sample.xml +25 -0
  188. data/spec/moxml/xpath/functions/boolean_functions_spec.rb +114 -0
  189. data/spec/moxml/xpath/functions/node_functions_spec.rb +145 -0
  190. data/spec/moxml/xpath/functions/numeric_functions_spec.rb +164 -0
  191. data/spec/moxml/xpath/functions/position_functions_spec.rb +93 -0
  192. data/spec/moxml/xpath/functions/special_functions_spec.rb +89 -0
  193. data/spec/moxml/xpath/functions/string_functions_spec.rb +381 -0
  194. data/spec/moxml/xpath/lexer_spec.rb +488 -0
  195. data/spec/moxml/xpath/parser_integration_spec.rb +210 -0
  196. data/spec/moxml/xpath/parser_spec.rb +364 -0
  197. data/spec/moxml/xpath/ruby/generator_spec.rb +421 -0
  198. data/spec/moxml/xpath/ruby/node_spec.rb +291 -0
  199. data/spec/moxml/xpath_capabilities_spec.rb +199 -0
  200. data/spec/moxml/xpath_spec.rb +77 -0
  201. data/spec/performance/README.md +83 -0
  202. data/spec/performance/benchmark_spec.rb +64 -0
  203. data/spec/{support/shared_examples/examples/memory.rb → performance/memory_usage_spec.rb} +4 -1
  204. data/spec/{support/shared_examples/examples/thread_safety.rb → performance/thread_safety_spec.rb} +3 -1
  205. data/spec/performance/xpath_benchmark_spec.rb +259 -0
  206. data/spec/spec_helper.rb +58 -1
  207. data/spec/support/xml_matchers.rb +1 -1
  208. metadata +178 -34
  209. data/spec/support/shared_examples/examples/benchmark_spec.rb +0 -51
  210. /data/spec/{support/shared_examples/builder.rb → integration/shared_examples/high_level/builder_behavior.rb} +0 -0
  211. /data/spec/{support/shared_examples/document_builder.rb → integration/shared_examples/high_level/document_builder_behavior.rb} +0 -0
  212. /data/spec/{support/shared_examples/attribute.rb → integration/shared_examples/node_wrappers/attribute_behavior.rb} +0 -0
  213. /data/spec/{support/shared_examples/element.rb → integration/shared_examples/node_wrappers/element_behavior.rb} +0 -0
  214. /data/spec/{support/shared_examples/namespace.rb → integration/shared_examples/node_wrappers/namespace_behavior.rb} +0 -0
  215. /data/spec/{support/shared_examples/text.rb → integration/shared_examples/node_wrappers/text_behavior.rb} +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 35cf55a2fae2cbcf05a2c85a1985b1e773b8f84bca9577fc9ab237f0b9203725
4
- data.tar.gz: 8af184352fd686ac41446d225c84c93de3978220db50421b403e743ae783f727
3
+ metadata.gz: 4b2faed71c75f32fcfe528621b1d3ed01c603b04f81e75d5b45b6c525d9d1836
4
+ data.tar.gz: 68ead788c2e5098b2f1f88653443fe4d8ff1e76b17dab09c08badb64c7ab70a3
5
5
  SHA512:
6
- metadata.gz: 21fc2ffb57f9ada23c1e90539a72d2cf6a593a18996ecbf76cf1143c22724433f49a4da8ee02f64b0939d9f4fc49db58993d6a48f74c6768754719c4c685495c
7
- data.tar.gz: 1b92a5280b4efa175e680c1ad927db865d2457251cc62aa1e9d4368fbcf42ce77e2699153f3b86f7cca5022d308b8f9f644c33bc8a846ccc2e7a8b0d5978584e
6
+ metadata.gz: 8aa59a486d44d101e1c078fc6fde2eea1cad9d4d7690d937dc7faef233a4143206432ffab53da3a2ef01af9245d17f706ddb01bc55b2c3555b358a6a3df10143
7
+ data.tar.gz: b5256089daef1f94012046bd7ff0fcbff1827c615b46d416231933de3193f3a262063a6ad761a87c629cdfe15fc51644fc1887d43eaeff5f8710bd16a791ea3c
@@ -0,0 +1,5 @@
1
+ {
2
+ "repo": [
3
+ "lutaml/lutaml-model"
4
+ ]
5
+ }
@@ -0,0 +1,20 @@
1
+ name: dependent-gems-test
2
+
3
+ on:
4
+ push:
5
+ branches: [ main ]
6
+ tags: [ v* ]
7
+ paths-ignore:
8
+ - '**.adoc'
9
+ pull_request:
10
+ paths-ignore:
11
+ - '**.adoc'
12
+ workflow_dispatch:
13
+ repository_dispatch:
14
+ types: [ release-passed ]
15
+
16
+ jobs:
17
+ rake:
18
+ uses: metanorma/ci/.github/workflows/dependent-rake.yml@main
19
+ with:
20
+ command: bundle exec rspec
@@ -0,0 +1,59 @@
1
+ name: docs
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+ repository_dispatch:
8
+ workflow_dispatch:
9
+
10
+ permissions:
11
+ contents: read
12
+ pages: write
13
+ id-token: write
14
+
15
+ concurrency:
16
+ group: ${{ github.workflow }}-${{ github.ref }}
17
+ cancel-in-progress: false
18
+
19
+ jobs:
20
+ build:
21
+ runs-on: ubuntu-latest
22
+ steps:
23
+ - name: Checkout
24
+ uses: actions/checkout@v4
25
+
26
+ - name: Setup Ruby
27
+ uses: ruby/setup-ruby@v1
28
+ with:
29
+ ruby-version: '3.3'
30
+ bundler-cache: true
31
+ cache-version: 0
32
+ working-directory: docs
33
+
34
+ - name: Setup Pages
35
+ id: pages
36
+ uses: actions/configure-pages@v5
37
+
38
+ - name: Build with Jekyll
39
+ run: bundle exec jekyll build --verbose --trace --baseurl "${{ steps.pages.outputs.base_path }}"
40
+ working-directory: docs
41
+ env:
42
+ JEKYLL_ENV: production
43
+
44
+ - name: Upload artifact
45
+ uses: actions/upload-pages-artifact@v3
46
+ with:
47
+ path: docs/_site
48
+
49
+ deploy:
50
+ environment:
51
+ name: github-pages
52
+ url: ${{ steps.deployment.outputs.page_url }}
53
+ if: ${{ github.ref == 'refs/heads/main' }}
54
+ runs-on: ubuntu-latest
55
+ needs: build
56
+ steps:
57
+ - name: Deploy to GitHub Pages
58
+ id: deployment
59
+ uses: actions/deploy-pages@v4
@@ -1,10 +1,11 @@
1
- # Auto-generated by Cimas: Do not edit it manually!
2
- # See https://github.com/metanorma/cimas
3
1
  name: rake
4
2
 
3
+ permissions:
4
+ contents: write
5
+
5
6
  on:
6
7
  push:
7
- branches: [ master, main ]
8
+ branches: [ main ]
8
9
  tags: [ v* ]
9
10
  pull_request:
10
11
 
@@ -13,11 +14,10 @@ jobs:
13
14
  uses: metanorma/ci/.github/workflows/generic-rake.yml@main
14
15
  with:
15
16
  before-setup-ruby: |
16
- mkdir -p .bundle
17
- touch .bundle/config
18
- cat .bundle/config
19
- echo "---" >> .bundle/config
20
- echo 'BUNDLE_BUILD__RUBY___LL: "--with-cflags=-std=gnu17"' >> .bundle/config
21
- cat .bundle/config
17
+ vcpkg install libxml2:x64-windows 2>&1 || true
18
+ vcpkg integrate install 2>&1 || true
19
+ mkdir -p .bundle 2>&1 || true
20
+ echo "---" > .bundle/config 2>&1 || true
21
+ echo 'BUNDLE_BUILD__LIBXML___RUBY: "--with-xml2-dir=C:/vcpkg/installed/x64-windows --with-xml2-include=C:/vcpkg/installed/x64-windows/include/libxml2 --with-xml2-lib=C:/vcpkg/installed/x64-windows/lib"' >> .bundle/config 2>&1 || true
22
22
  secrets:
23
- pat_token: ${{ secrets.LUTAML_CI_PAT_TOKEN }}
23
+ pat_token: ${{ secrets.GITHUB_TOKEN }}
@@ -1,7 +1,9 @@
1
- # Auto-generated by Cimas: Do not edit it manually!
2
- # See https://github.com/metanorma/cimas
3
1
  name: release
4
2
 
3
+ permissions:
4
+ contents: write
5
+ packages: write
6
+
5
7
  on:
6
8
  workflow_dispatch:
7
9
  inputs:
@@ -20,4 +22,4 @@ jobs:
20
22
  next_version: ${{ github.event.inputs.next_version }}
21
23
  secrets:
22
24
  rubygems-api-key: ${{ secrets.LUTAML_CI_RUBYGEMS_API_KEY }}
23
- pat_token: ${{ secrets.LUTAML_CI_PAT_TOKEN }}
25
+ pat_token: ${{ secrets.GITHUB_TOKEN }}
data/.gitignore CHANGED
@@ -11,3 +11,40 @@ Gemfile.lock
11
11
  # rspec failure tracking
12
12
  .rspec_status
13
13
  /spec/examples.txt
14
+
15
+ # Temporary test files
16
+ test_*.rb
17
+ test_*.txt
18
+ debug_*.rb
19
+
20
+ # Temporary status and documentation files
21
+ *_STATUS.md
22
+ *_KNOWN_ISSUES.md
23
+ libxml_*.txt
24
+ *_failures.txt
25
+ *_output.txt
26
+ *_results.txt
27
+
28
+ # Generated benchmark reports (machine-specific)
29
+ /benchmarks/PERFORMANCE_REPORT.md
30
+
31
+ # IDE and editor files
32
+ .vscode/
33
+ .idea/
34
+ *.swp
35
+ *.swo
36
+ *~
37
+ .DS_Store
38
+ /.kilocode
39
+ /*.md
40
+
41
+ .rubocop-https*
42
+
43
+ # Ruby version managers
44
+ .ruby-version.lock
45
+ .rvmrc
46
+
47
+ # Artifacts from static site generators
48
+ /_site
49
+ /docs/_site
50
+ /docs/.jekyll-cache
data/.rubocop.yml CHANGED
@@ -1,10 +1,18 @@
1
- inherit_from: .rubocop_todo.yml
1
+ inherit_from:
2
+ - https://raw.githubusercontent.com/riboseinc/oss-guides/main/ci/rubocop.yml
3
+ - .rubocop_todo.yml
4
+
5
+ plugins:
6
+ - rubocop-performance
7
+ - rubocop-rake
8
+ - rubocop-rspec
2
9
 
3
10
  AllCops:
4
11
  TargetRubyVersion: 3.0
5
-
6
- Style/StringLiterals:
7
- EnforcedStyle: double_quotes
8
-
9
- Style/StringLiteralsInInterpolation:
10
- EnforcedStyle: double_quotes
12
+ NewCops: enable
13
+ SuggestExtensions: false
14
+ Exclude:
15
+ - 'debug_*.rb'
16
+ - 'test_*.rb'
17
+ - 'vendor/**/*'
18
+ - 'tmp/**/*'
data/.rubocop_todo.yml CHANGED
@@ -1,89 +1,266 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2025-05-09 11:52:41 UTC using RuboCop version 1.68.0.
3
+ # on 2025-11-24 13:45:20 UTC using RuboCop version 1.80.0.
4
4
  # The point is for the user to remove these configuration records
5
5
  # one by one as the offenses are removed from the code base.
6
6
  # Note that changes in the inspected code, or installation of new
7
7
  # versions of RuboCop, may require this file to be generated again.
8
8
 
9
- # Offense count: 1
10
- Lint/IneffectiveAccessModifier:
9
+ # Offense count: 192
10
+ # This cop supports safe autocorrection (--autocorrect).
11
+ # Configuration parameters: Max, AllowHeredoc, AllowURI, AllowQualifiedName, URISchemes, IgnoreCopDirectives, AllowedPatterns, SplitStrings.
12
+ # URISchemes: http, https
13
+ Layout/LineLength:
14
+ Enabled: false
15
+
16
+ # Offense count: 7
17
+ # Configuration parameters: AllowedMethods.
18
+ # AllowedMethods: enums
19
+ Lint/ConstantDefinitionInBlock:
11
20
  Exclude:
21
+ - 'spec/moxml/declaration_preservation_spec.rb'
22
+ - 'spec/moxml/sax_spec.rb'
23
+
24
+ # Offense count: 6
25
+ # Configuration parameters: IgnoreLiteralBranches, IgnoreConstantBranches, IgnoreDuplicateElseBranch.
26
+ Lint/DuplicateBranch:
27
+ Exclude:
28
+ - 'benchmarks/generate_report.rb'
29
+ - 'lib/moxml/adapter/customized_libxml/declaration.rb'
30
+ - 'lib/moxml/adapter/libxml.rb'
31
+ - 'lib/moxml/document.rb'
32
+
33
+ # Offense count: 2
34
+ Lint/DuplicateMethods:
35
+ Exclude:
36
+ - 'lib/moxml/element.rb'
12
37
  - 'lib/moxml/node.rb'
13
38
 
14
39
  # Offense count: 1
15
- # Configuration parameters: MaximumRangeSize.
16
- Lint/MissingCopEnableDirective:
40
+ # Configuration parameters: AllowComments.
41
+ Lint/EmptyWhen:
17
42
  Exclude:
18
- - 'lib/moxml/adapter/customized_oga/xml_generator.rb'
43
+ - 'lib/moxml/xpath/compiler.rb'
19
44
 
20
- # Offense count: 2
45
+ # Offense count: 1
46
+ Lint/IneffectiveAccessModifier:
47
+ Exclude:
48
+ - 'lib/moxml/node.rb'
49
+
50
+ # Offense count: 3
21
51
  # Configuration parameters: AllowedParentClasses.
22
52
  Lint/MissingSuper:
23
53
  Exclude:
24
54
  - 'lib/moxml/adapter/customized_oga/xml_declaration.rb'
25
55
  - 'lib/moxml/adapter/customized_rexml/formatter.rb'
56
+ - 'spec/moxml/xpath/ast/node_spec.rb'
57
+
58
+ # Offense count: 2
59
+ Lint/NoReturnInBeginEndBlocks:
60
+ Exclude:
61
+ - 'examples/api_client/api_client.rb'
26
62
 
27
- # Offense count: 8
28
- # Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes.
63
+ # Offense count: 93
64
+ # Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes, Max.
29
65
  Metrics/AbcSize:
30
- Max: 39
66
+ Enabled: false
31
67
 
32
- # Offense count: 53
33
- # Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
68
+ # Offense count: 7
69
+ # Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns, inherit_mode.
34
70
  # AllowedMethods: refine
35
71
  Metrics/BlockLength:
36
- Max: 270
72
+ Max: 90
37
73
 
38
74
  # Offense count: 5
39
- # Configuration parameters: CountComments, CountAsOne.
40
- Metrics/ClassLength:
41
- Max: 373
75
+ # Configuration parameters: CountBlocks, CountModifierForms.
76
+ Metrics/BlockNesting:
77
+ Max: 4
42
78
 
43
- # Offense count: 7
44
- # Configuration parameters: AllowedMethods, AllowedPatterns.
79
+ # Offense count: 63
80
+ # Configuration parameters: AllowedMethods, AllowedPatterns, Max.
45
81
  Metrics/CyclomaticComplexity:
46
- Max: 15
82
+ Enabled: false
47
83
 
48
- # Offense count: 15
84
+ # Offense count: 164
49
85
  # Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
50
86
  Metrics/MethodLength:
51
- Max: 23
87
+ Max: 110
52
88
 
53
89
  # Offense count: 3
54
- # Configuration parameters: AllowedMethods, AllowedPatterns.
90
+ # Configuration parameters: CountKeywordArgs, MaxOptionalParameters.
91
+ Metrics/ParameterLists:
92
+ Max: 7
93
+
94
+ # Offense count: 42
95
+ # Configuration parameters: AllowedMethods, AllowedPatterns, Max.
55
96
  Metrics/PerceivedComplexity:
56
- Max: 16
97
+ Enabled: false
57
98
 
58
- # Offense count: 5
99
+ # Offense count: 15
59
100
  # Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames.
60
101
  # AllowedNames: as, at, by, cc, db, id, if, in, io, ip, of, on, os, pp, to
61
102
  Naming/MethodParameterName:
62
103
  Exclude:
104
+ - 'benchmarks/generate_report.rb'
63
105
  - 'lib/moxml/adapter/customized_oga/xml_generator.rb'
106
+ - 'lib/moxml/adapter/libxml.rb'
64
107
  - 'lib/moxml/adapter/nokogiri.rb'
65
108
  - 'lib/moxml/adapter/ox.rb'
66
109
  - 'lib/moxml/adapter/rexml.rb'
67
110
  - 'lib/moxml/attribute.rb'
111
+ - 'lib/moxml/xpath/lexer.rb'
68
112
 
69
113
  # Offense count: 1
70
- # This cop supports unsafe autocorrection (--autocorrect-all).
71
- Style/CombinableLoops:
114
+ # Configuration parameters: Mode, AllowedMethods, AllowedPatterns, AllowBangMethods, WaywardPredicates.
115
+ # AllowedMethods: call
116
+ # WaywardPredicates: nonzero?
117
+ Naming/PredicateMethod:
72
118
  Exclude:
73
- - 'lib/moxml/adapter/customized_rexml/formatter.rb'
119
+ - 'lib/moxml/xpath/ruby/node.rb'
74
120
 
75
- # Offense count: 28
76
- # Configuration parameters: AllowedConstants.
77
- Style/Documentation:
78
- Enabled: false
121
+ # Offense count: 46
122
+ # Configuration parameters: Prefixes, AllowedPatterns.
123
+ # Prefixes: when, with, without
124
+ RSpec/ContextWording:
125
+ Exclude:
126
+ - 'spec/integration/headed_ox_integration_spec.rb'
127
+ - 'spec/moxml/adapter/headed_ox_spec.rb'
128
+ - 'spec/moxml/adapter/shared_examples/adapter_contract.rb'
129
+ - 'spec/moxml/declaration_preservation_spec.rb'
130
+ - 'spec/moxml/xpath/lexer_spec.rb'
131
+ - 'spec/moxml/xpath/parser_spec.rb'
132
+ - 'spec/performance/benchmark_spec.rb'
133
+
134
+ # Offense count: 15
135
+ # Configuration parameters: IgnoredMetadata.
136
+ RSpec/DescribeClass:
137
+ Exclude:
138
+ - '**/spec/features/**/*'
139
+ - '**/spec/requests/**/*'
140
+ - '**/spec/routing/**/*'
141
+ - '**/spec/system/**/*'
142
+ - '**/spec/views/**/*'
143
+ - 'spec/consistency/adapter_parity_spec.rb'
144
+ - 'spec/integration/all_adapters_spec.rb'
145
+ - 'spec/integration/headed_ox_integration_spec.rb'
146
+ - 'spec/moxml/declaration_preservation_spec.rb'
147
+ - 'spec/moxml/error_spec.rb'
148
+ - 'spec/moxml/xpath/axes_spec.rb'
149
+ - 'spec/moxml/xpath/functions/boolean_functions_spec.rb'
150
+ - 'spec/moxml/xpath/functions/node_functions_spec.rb'
151
+ - 'spec/moxml/xpath/functions/numeric_functions_spec.rb'
152
+ - 'spec/moxml/xpath/functions/position_functions_spec.rb'
153
+ - 'spec/moxml/xpath/functions/special_functions_spec.rb'
154
+ - 'spec/moxml/xpath/functions/string_functions_spec.rb'
155
+ - 'spec/moxml/xpath/parser_integration_spec.rb'
156
+ - 'spec/moxml/xpath_capabilities_spec.rb'
157
+ - 'spec/performance/xpath_benchmark_spec.rb'
158
+
159
+ # Offense count: 217
160
+ # Configuration parameters: CountAsOne.
161
+ RSpec/ExampleLength:
162
+ Max: 85
79
163
 
80
164
  # Offense count: 1
81
- # This cop supports unsafe autocorrection (--autocorrect-all).
82
- # Configuration parameters: EnforcedStyle.
83
- # SupportedStyles: always, always_true, never
84
- Style/FrozenStringLiteralComment:
165
+ # This cop supports safe autocorrection (--autocorrect).
166
+ RSpec/ExpectActual:
85
167
  Exclude:
86
- - 'lib/moxml/adapter/customized_rexml/formatter.rb'
168
+ - '**/spec/routing/**/*'
169
+ - 'spec/moxml/attribute_spec.rb'
170
+
171
+ # Offense count: 3
172
+ # Configuration parameters: Max, AllowedIdentifiers, AllowedPatterns.
173
+ RSpec/IndexedLet:
174
+ Exclude:
175
+ - 'spec/integration/shared_examples/node_wrappers/namespace_behavior.rb'
176
+
177
+ # Offense count: 102
178
+ # Configuration parameters: AssignmentOnly.
179
+ RSpec/InstanceVariable:
180
+ Exclude:
181
+ - 'spec/moxml/sax_spec.rb'
182
+
183
+ # Offense count: 7
184
+ RSpec/LeakyConstantDeclaration:
185
+ Exclude:
186
+ - 'spec/moxml/declaration_preservation_spec.rb'
187
+ - 'spec/moxml/sax_spec.rb'
188
+
189
+ # Offense count: 2
190
+ # Configuration parameters: .
191
+ # SupportedStyles: have_received, receive
192
+ RSpec/MessageSpies:
193
+ EnforcedStyle: receive
194
+
195
+ # Offense count: 317
196
+ RSpec/MultipleExpectations:
197
+ Max: 10
198
+
199
+ # Offense count: 2
200
+ # Configuration parameters: AllowSubject.
201
+ RSpec/MultipleMemoizedHelpers:
202
+ Max: 7
203
+
204
+ # Offense count: 10
205
+ # Configuration parameters: AllowedGroups.
206
+ RSpec/NestedGroups:
207
+ Max: 4
208
+
209
+ # Offense count: 3
210
+ # Configuration parameters: AllowedPatterns.
211
+ # AllowedPatterns: ^expect_, ^assert_
212
+ RSpec/NoExpectationExample:
213
+ Exclude:
214
+ - 'spec/performance/xpath_benchmark_spec.rb'
215
+
216
+ # Offense count: 6
217
+ RSpec/PendingWithoutReason:
218
+ Exclude:
219
+ - 'spec/moxml/xpath/functions/position_functions_spec.rb'
220
+ - 'spec/moxml/xpath/functions/special_functions_spec.rb'
221
+
222
+ # Offense count: 2
223
+ RSpec/RepeatedExample:
224
+ Exclude:
225
+ - 'spec/integration/shared_examples/node_wrappers/node_set_behavior.rb'
226
+
227
+ # Offense count: 10
228
+ # Configuration parameters: CustomTransform, IgnoreMethods, IgnoreMetadata.
229
+ RSpec/SpecFilePathFormat:
230
+ Exclude:
231
+ - '**/spec/routing/**/*'
232
+ - 'spec/moxml/xpath/ast/node_spec.rb'
233
+ - 'spec/moxml/xpath/cache_spec.rb'
234
+ - 'spec/moxml/xpath/compiler_spec.rb'
235
+ - 'spec/moxml/xpath/context_spec.rb'
236
+ - 'spec/moxml/xpath/conversion_spec.rb'
237
+ - 'spec/moxml/xpath/lexer_spec.rb'
238
+ - 'spec/moxml/xpath/parser_spec.rb'
239
+ - 'spec/moxml/xpath/ruby/generator_spec.rb'
240
+ - 'spec/moxml/xpath/ruby/node_spec.rb'
241
+ - 'spec/moxml/xpath_spec.rb'
242
+
243
+ # Offense count: 1
244
+ # Configuration parameters: IgnoreNameless, IgnoreSymbolicNames.
245
+ RSpec/VerifiedDoubles:
246
+ Exclude:
247
+ - 'spec/moxml/xpath/conversion_spec.rb'
248
+
249
+ # Offense count: 1
250
+ Security/Eval:
251
+ Exclude:
252
+ - 'spec/moxml/xpath/ruby/generator_spec.rb'
253
+
254
+ # Offense count: 1
255
+ Style/DocumentDynamicEvalDefinition:
256
+ Exclude:
257
+ - 'spec/moxml/xpath/ruby/generator_spec.rb'
258
+
259
+ # Offense count: 1
260
+ # This cop supports safe autocorrection (--autocorrect).
261
+ Style/EvalWithLocation:
262
+ Exclude:
263
+ - 'spec/moxml/xpath/ruby/generator_spec.rb'
87
264
 
88
265
  # Offense count: 2
89
266
  # Configuration parameters: MinBranchesCount.
@@ -91,11 +268,15 @@ Style/HashLikeCase:
91
268
  Exclude:
92
269
  - 'lib/moxml/adapter/customized_rexml/formatter.rb'
93
270
 
94
- # Offense count: 2
95
- # This cop supports unsafe autocorrection (--autocorrect-all).
96
- # Configuration parameters: ConvertCodeThatCanStartToReturnNil, AllowedMethods, MaxChainLength.
97
- # AllowedMethods: present?, blank?, presence, try, try!
98
- Style/SafeNavigation:
271
+ # Offense count: 1
272
+ Style/MissingRespondToMissing:
99
273
  Exclude:
100
- - 'lib/moxml/adapter/customized_rexml/formatter.rb'
101
- - 'lib/moxml/adapter/rexml.rb'
274
+ - 'lib/moxml/xpath/ruby/node.rb'
275
+
276
+ # Offense count: 4
277
+ # Configuration parameters: AllowedMethods.
278
+ # AllowedMethods: respond_to_missing?
279
+ Style/OptionalBooleanParameter:
280
+ Exclude:
281
+ - 'lib/moxml/adapter/libxml.rb'
282
+ - 'lib/moxml/xpath/compiler.rb'
data/Gemfile CHANGED
@@ -5,18 +5,23 @@ source "https://rubygems.org"
5
5
  # Specify your gem's dependencies in moxml.gemspec
6
6
  gemspec
7
7
 
8
- gem "byebug"
9
- gem "get_process_mem", "~> 1.0"
10
- gem "nokogiri", "~> 1.15"
8
+ # Provides iteration per second benchmarking for Ruby
9
+ gem "benchmark-ips"
10
+ gem "get_process_mem"
11
+ gem "libxml-ruby", "~> 5.0"
12
+ gem "nokogiri", "~> 1.18"
11
13
  gem "oga", "~> 3.4"
14
+ gem "openssl"
12
15
  gem "ox", "~> 2.14"
13
- gem "rake", "~> 13"
16
+ gem "rake"
14
17
  gem "rexml"
15
- gem "rspec", "~> 3.0"
16
- gem "rubocop", "~> 1.21"
17
- gem "tempfile", "~> 0.3"
18
- # Provides iteration per second benchmarking for Ruby
19
- gem "benchmark-ips"
18
+ gem "rspec"
19
+ gem "rubocop"
20
+ gem "rubocop-performance"
21
+ gem "rubocop-rake"
22
+ gem "rubocop-rspec"
23
+ gem "simplecov", require: false
24
+ gem "tempfile"
20
25
 
21
26
  # Needed by get_process_mem on Windows
22
27
  gem "sys-proctable" if Gem.win_platform?
data/LICENSE.md CHANGED
@@ -5,10 +5,10 @@ This license file adheres to the formatting guidelines of
5
5
  [readable-licenses](https://github.com/nevir/readable-licenses).
6
6
 
7
7
 
8
- Ribose's BSD 2-Clause License
8
+ Ribose's BSD 3-Clause License
9
9
  -----------------------------
10
10
 
11
- Copyright (c) 2024, [Ribose Inc](https://www.ribose.com).
11
+ Copyright (c) 2025, [Ribose Inc](https://www.ribose.com).
12
12
  All rights reserved.
13
13
 
14
14
  Redistribution and use in source and binary forms, with or without modification,
@@ -21,6 +21,10 @@ are permitted provided that the following conditions are met:
21
21
  this list of conditions and the following disclaimer in the documentation
22
22
  and/or other materials provided with the distribution.
23
23
 
24
+ 3. Neither the name of the copyright holder nor the names of its contributors
25
+ may be used to endorse or promote products derived from this software
26
+ without specific prior written permission.
27
+
24
28
  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
25
29
  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
26
30
  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE