sonicop 26.8.111 → 26.8.113

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 (436) hide show
  1. checksums.yaml +4 -4
  2. data/CONFORMANCE.md +64 -31
  3. data/Cargo.lock +94 -19
  4. data/Cargo.toml +13 -8
  5. data/NOTICE +15 -3
  6. data/README.ja.md +145 -57
  7. data/README.md +140 -48
  8. data/build.rs +155 -0
  9. data/lib/sonicop/runner.rb +7 -1
  10. data/lib/sonicop/version.rb +1 -1
  11. data/src/cli.rs +216 -45
  12. data/src/config/inheritance.rs +637 -64
  13. data/src/config/mod.rs +130 -1
  14. data/src/config/paths.rs +550 -48
  15. data/src/cop_name.rs +18 -1
  16. data/src/diagnostic.rs +168 -3
  17. data/src/directives.rs +398 -77
  18. data/src/display_width.rs +82 -42
  19. data/src/display_width_table.rs +506 -0
  20. data/src/engine.rs +1532 -51
  21. data/src/formatter.rs +10 -1
  22. data/src/lib.rs +2 -0
  23. data/src/main.rs +112 -1
  24. data/src/nul_bytes.rs +245 -47
  25. data/src/parser.rs +37 -0
  26. data/src/profile.rs +174 -24
  27. data/src/ruby_version.rs +167 -21
  28. data/src/rules/bundler/duplicated_group.rs +3 -2
  29. data/src/rules/bundler/gem_comment.rs +5 -4
  30. data/src/rules/gemspec/attribute_assignment.rs +4 -3
  31. data/src/rules/gemspec/deprecated_attribute_assignment.rs +7 -6
  32. data/src/rules/gemspec/duplicated_assignment.rs +4 -3
  33. data/src/rules/gemspec/require_mfa.rs +10 -9
  34. data/src/rules/gemspec/required_ruby_version.rs +3 -2
  35. data/src/rules/gemspec/support.rs +28 -8
  36. data/src/rules/layout/access_modifier_indentation.rs +13 -6
  37. data/src/rules/layout/argument_alignment.rs +19 -7
  38. data/src/rules/layout/array_alignment.rs +1 -2
  39. data/src/rules/layout/block_alignment.rs +74 -30
  40. data/src/rules/layout/block_end_newline.rs +5 -5
  41. data/src/rules/layout/class_structure.rs +13 -4
  42. data/src/rules/layout/closing_heredoc_indentation.rs +24 -5
  43. data/src/rules/layout/closing_parenthesis_indentation.rs +3 -3
  44. data/src/rules/layout/comment_indentation.rs +2 -1
  45. data/src/rules/layout/condition_position.rs +3 -2
  46. data/src/rules/layout/def_end_alignment.rs +10 -6
  47. data/src/rules/layout/dot_position.rs +1 -2
  48. data/src/rules/layout/else_alignment.rs +24 -14
  49. data/src/rules/layout/empty_line_after_guard_clause.rs +8 -7
  50. data/src/rules/layout/empty_line_after_multiline_condition.rs +5 -5
  51. data/src/rules/layout/empty_line_between_defs.rs +8 -6
  52. data/src/rules/layout/empty_lines_around_access_modifier.rs +22 -10
  53. data/src/rules/layout/empty_lines_around_arguments.rs +4 -4
  54. data/src/rules/layout/empty_lines_around_body.rs +8 -2
  55. data/src/rules/layout/empty_lines_around_exception_handling_keywords.rs +1 -2
  56. data/src/rules/layout/empty_lines_around_method_body.rs +3 -2
  57. data/src/rules/layout/end_alignment.rs +32 -7
  58. data/src/rules/layout/end_of_line.rs +14 -1
  59. data/src/rules/layout/extra_spacing.rs +9 -11
  60. data/src/rules/layout/first_array_element_indentation.rs +1 -2
  61. data/src/rules/layout/first_hash_element_indentation.rs +8 -6
  62. data/src/rules/layout/hash_alignment.rs +113 -19
  63. data/src/rules/layout/heredoc_argument_closing_parenthesis.rs +6 -5
  64. data/src/rules/layout/heredoc_indentation.rs +4 -3
  65. data/src/rules/layout/indentation_style.rs +6 -4
  66. data/src/rules/layout/indentation_width.rs +76 -16
  67. data/src/rules/layout/initial_indentation.rs +18 -5
  68. data/src/rules/layout/line_continuation_leading_space.rs +4 -3
  69. data/src/rules/layout/line_continuation_spacing.rs +4 -3
  70. data/src/rules/layout/line_length.rs +417 -43
  71. data/src/rules/layout/mod.rs +1 -1
  72. data/src/rules/layout/multiline_assignment_layout.rs +20 -3
  73. data/src/rules/layout/multiline_block_layout.rs +1 -2
  74. data/src/rules/layout/multiline_expression.rs +60 -31
  75. data/src/rules/layout/multiline_hash_brace_layout.rs +4 -3
  76. data/src/rules/layout/multiline_method_call_indentation.rs +1 -1
  77. data/src/rules/layout/multiline_operation_indentation.rs +3 -3
  78. data/src/rules/layout/redundant_line_break.rs +16 -5
  79. data/src/rules/layout/rescue_ensure_alignment.rs +20 -12
  80. data/src/rules/layout/single_line_block_chain.rs +13 -4
  81. data/src/rules/layout/space_around_block_parameters.rs +16 -2
  82. data/src/rules/layout/space_around_equals_in_parameter_default.rs +1 -2
  83. data/src/rules/layout/space_around_keyword.rs +22 -4
  84. data/src/rules/layout/space_around_operators.rs +34 -2
  85. data/src/rules/layout/space_before_brackets.rs +13 -6
  86. data/src/rules/layout/space_before_comma.rs +3 -2
  87. data/src/rules/layout/space_inside_array_literal_brackets.rs +25 -10
  88. data/src/rules/layout/space_inside_array_percent_literal.rs +7 -1
  89. data/src/rules/layout/space_inside_parens.rs +170 -87
  90. data/src/rules/layout/space_inside_range_literal.rs +53 -19
  91. data/src/rules/layout/space_inside_reference_brackets.rs +65 -3
  92. data/src/rules/layout/space_inside_string_interpolation.rs +147 -48
  93. data/src/rules/layout/support.rs +172 -26
  94. data/src/rules/layout/tokens.rs +47 -7
  95. data/src/rules/layout/trailing_whitespace.rs +5 -2
  96. data/src/rules/lint/access_modifier.rs +50 -5
  97. data/src/rules/lint/ambiguity.rs +97 -7
  98. data/src/rules/lint/ambiguous_block_association.rs +29 -12
  99. data/src/rules/lint/ambiguous_operator.rs +8 -0
  100. data/src/rules/lint/ambiguous_operator_precedence.rs +18 -1
  101. data/src/rules/lint/ambiguous_range.rs +15 -1
  102. data/src/rules/lint/ambiguous_regexp_literal.rs +40 -1
  103. data/src/rules/lint/array_literal_in_regexp.rs +13 -5
  104. data/src/rules/lint/assignment_in_condition.rs +3 -2
  105. data/src/rules/lint/blocks.rs +2 -1
  106. data/src/rules/lint/boolean_symbol.rs +4 -4
  107. data/src/rules/lint/constant_definition_in_block.rs +1 -2
  108. data/src/rules/lint/constant_reassignment.rs +9 -13
  109. data/src/rules/lint/constant_resolution.rs +8 -0
  110. data/src/rules/lint/cop_directives.rs +28 -4
  111. data/src/rules/lint/debugger.rs +59 -9
  112. data/src/rules/lint/deprecated_open_ssl_constant.rs +1 -2
  113. data/src/rules/lint/disjunctive_assignment_in_constructor.rs +2 -2
  114. data/src/rules/lint/duplicate_branch.rs +16 -6
  115. data/src/rules/lint/duplicate_case_condition.rs +5 -5
  116. data/src/rules/lint/duplicate_hash_key.rs +8 -4
  117. data/src/rules/lint/duplicate_match_pattern.rs +7 -5
  118. data/src/rules/lint/duplicate_methods.rs +133 -54
  119. data/src/rules/lint/duplicate_require.rs +1 -2
  120. data/src/rules/lint/duplicate_set_element.rs +19 -5
  121. data/src/rules/lint/empty_conditional_body.rs +19 -3
  122. data/src/rules/lint/empty_expression.rs +16 -1
  123. data/src/rules/lint/empty_in_pattern.rs +3 -2
  124. data/src/rules/lint/empty_when.rs +4 -4
  125. data/src/rules/lint/ensure_return.rs +3 -2
  126. data/src/rules/lint/float_comparison.rs +8 -6
  127. data/src/rules/lint/flow.rs +8 -5
  128. data/src/rules/lint/format_parameter_mismatch.rs +4 -3
  129. data/src/rules/lint/hash_compare_by_identity.rs +5 -4
  130. data/src/rules/lint/heredoc_method_call_position.rs +3 -2
  131. data/src/rules/lint/implicit_string_concatenation.rs +33 -3
  132. data/src/rules/lint/ineffective_access_modifier.rs +5 -4
  133. data/src/rules/lint/inherit_exception.rs +4 -3
  134. data/src/rules/lint/literal_as_condition.rs +51 -31
  135. data/src/rules/lint/literal_assignment_in_condition.rs +4 -3
  136. data/src/rules/lint/literal_in_interpolation.rs +66 -5
  137. data/src/rules/lint/literals.rs +10 -8
  138. data/src/rules/lint/missing_cop_enable_directive.rs +95 -18
  139. data/src/rules/lint/mod.rs +1 -0
  140. data/src/rules/lint/nested_method_definition.rs +36 -11
  141. data/src/rules/lint/nil_receiver.rs +420 -0
  142. data/src/rules/lint/no_return_in_begin_end_blocks.rs +2 -2
  143. data/src/rules/lint/node_equality.rs +8 -5
  144. data/src/rules/lint/non_atomic_file_operation.rs +9 -3
  145. data/src/rules/lint/non_deterministic_require_order.rs +5 -3
  146. data/src/rules/lint/non_local_exit_from_iterator.rs +22 -9
  147. data/src/rules/lint/number_conversion.rs +1 -1
  148. data/src/rules/lint/out_of_range_regexp_ref.rs +6 -4
  149. data/src/rules/lint/parentheses_as_grouped_expression.rs +5 -0
  150. data/src/rules/lint/redundant_cop_enable_directive.rs +3 -1
  151. data/src/rules/lint/redundant_dir_glob_sort.rs +1 -2
  152. data/src/rules/lint/redundant_safe_navigation.rs +47 -22
  153. data/src/rules/lint/redundant_splat_expansion.rs +4 -2
  154. data/src/rules/lint/redundant_string_coercion.rs +3 -2
  155. data/src/rules/lint/redundant_type_conversion.rs +16 -4
  156. data/src/rules/lint/regexp.rs +1 -3
  157. data/src/rules/lint/regexp_source.rs +2 -2
  158. data/src/rules/lint/regexp_tree.rs +38 -5
  159. data/src/rules/lint/require_range_parentheses.rs +5 -5
  160. data/src/rules/lint/rescue_exception.rs +4 -3
  161. data/src/rules/lint/rescue_type.rs +3 -2
  162. data/src/rules/lint/return_in_void_context.rs +8 -3
  163. data/src/rules/lint/safe_navigation_chain.rs +47 -11
  164. data/src/rules/lint/self_assignment.rs +20 -2
  165. data/src/rules/lint/shadowed_argument.rs +2 -2
  166. data/src/rules/lint/shadowed_exception.rs +2 -2
  167. data/src/rules/lint/suppressed_exception.rs +21 -3
  168. data/src/rules/lint/suppressed_exception_in_number_conversion.rs +4 -3
  169. data/src/rules/lint/symbol_conversion.rs +56 -8
  170. data/src/rules/lint/syntax.rs +195 -5
  171. data/src/rules/lint/top_level_return_with_argument.rs +11 -1
  172. data/src/rules/lint/triple_quotes.rs +3 -2
  173. data/src/rules/lint/unescaped_bracket_in_regexp.rs +1 -1
  174. data/src/rules/lint/unexpected_block_arity.rs +23 -5
  175. data/src/rules/lint/unified_integer.rs +18 -12
  176. data/src/rules/lint/unmodified_reduce_accumulator.rs +36 -7
  177. data/src/rules/lint/unreachable_code.rs +4 -4
  178. data/src/rules/lint/unreachable_loop.rs +26 -10
  179. data/src/rules/lint/unreachable_pattern_branch.rs +7 -5
  180. data/src/rules/lint/unused_block_argument.rs +2 -2
  181. data/src/rules/lint/unused_method_argument.rs +1 -2
  182. data/src/rules/lint/useless_assignment.rs +3 -2
  183. data/src/rules/lint/useless_constant_scoping.rs +3 -2
  184. data/src/rules/lint/useless_else_without_rescue.rs +4 -3
  185. data/src/rules/lint/useless_rescue.rs +5 -4
  186. data/src/rules/lint/useless_ruby2_keywords.rs +2 -1
  187. data/src/rules/lint/useless_setter_call.rs +5 -4
  188. data/src/rules/lint/useless_times.rs +4 -3
  189. data/src/rules/lint/variable_force.rs +307 -79
  190. data/src/rules/lint/void.rs +32 -20
  191. data/src/rules/metrics/abc_size.rs +197 -7
  192. data/src/rules/metrics/block_length.rs +19 -10
  193. data/src/rules/metrics/block_nesting.rs +1 -2
  194. data/src/rules/metrics/class_length.rs +16 -4
  195. data/src/rules/metrics/collection_literal_length.rs +2 -1
  196. data/src/rules/metrics/complexity.rs +52 -14
  197. data/src/rules/metrics/fragments.rs +10 -14
  198. data/src/rules/metrics/locals.rs +35 -14
  199. data/src/rules/metrics/method_length.rs +14 -6
  200. data/src/rules/metrics/parameter_lists.rs +7 -6
  201. data/src/rules/metrics/perceived_complexity.rs +1 -3
  202. data/src/rules/metrics/support.rs +94 -4
  203. data/src/rules/mod.rs +525 -80
  204. data/src/rules/naming/ascii_identifiers.rs +3 -3
  205. data/src/rules/naming/binary_operator_parameter_name.rs +5 -4
  206. data/src/rules/naming/block_forwarding.rs +9 -8
  207. data/src/rules/naming/constant_name.rs +56 -18
  208. data/src/rules/naming/file_name.rs +174 -43
  209. data/src/rules/naming/method_name.rs +8 -1
  210. data/src/rules/naming/predicate_method.rs +42 -14
  211. data/src/rules/naming/predicate_prefix.rs +70 -4
  212. data/src/rules/naming/rescued_exceptions_variable_name.rs +14 -11
  213. data/src/rules/naming/support.rs +54 -295
  214. data/src/rules/naming/variable_name.rs +17 -4
  215. data/src/rules/naming/variable_number.rs +9 -10
  216. data/src/rules/node_ext.rs +1 -1
  217. data/src/rules/ruby_literal.rs +8 -3
  218. data/src/rules/security/compound_hash.rs +3 -2
  219. data/src/rules/security/open.rs +5 -4
  220. data/src/rules/send_node.rs +134 -0
  221. data/src/rules/single_line.rs +4 -4
  222. data/src/rules/style/access_modifier_declarations.rs +76 -22
  223. data/src/rules/style/accessor_grouping.rs +44 -6
  224. data/src/rules/style/alias.rs +4 -3
  225. data/src/rules/style/and_or.rs +2 -2
  226. data/src/rules/style/arguments_forwarding.rs +5 -5
  227. data/src/rules/style/array_coercion.rs +5 -5
  228. data/src/rules/style/array_first_last.rs +19 -4
  229. data/src/rules/style/array_intersect.rs +26 -8
  230. data/src/rules/style/array_intersect_with_single_element.rs +1 -1
  231. data/src/rules/style/ascii_comments.rs +2 -0
  232. data/src/rules/style/attr.rs +1 -1
  233. data/src/rules/style/auto_resource_cleanup.rs +1 -1
  234. data/src/rules/style/bitwise_predicate.rs +2 -2
  235. data/src/rules/style/block_args.rs +1 -1
  236. data/src/rules/style/block_comments.rs +11 -2
  237. data/src/rules/style/block_delimiters.rs +154 -10
  238. data/src/rules/style/case_equality.rs +7 -2
  239. data/src/rules/style/case_like_if.rs +26 -2
  240. data/src/rules/style/class_and_module_children.rs +162 -10
  241. data/src/rules/style/class_methods.rs +1 -1
  242. data/src/rules/style/class_methods_definitions.rs +9 -0
  243. data/src/rules/style/collection_compact.rs +4 -4
  244. data/src/rules/style/combinable_defined.rs +2 -2
  245. data/src/rules/style/combinable_loops.rs +9 -11
  246. data/src/rules/style/comments.rs +6 -3
  247. data/src/rules/style/comparable_clamp.rs +2 -2
  248. data/src/rules/style/concat_array_literals.rs +3 -3
  249. data/src/rules/style/conditional.rs +12 -1
  250. data/src/rules/style/conditional_assignment.rs +133 -4
  251. data/src/rules/style/constant_visibility.rs +3 -3
  252. data/src/rules/style/copyright.rs +64 -3
  253. data/src/rules/style/data_inheritance.rs +1 -1
  254. data/src/rules/style/def_with_parentheses.rs +1 -1
  255. data/src/rules/style/document_dynamic_eval_definition.rs +50 -12
  256. data/src/rules/style/documentation.rs +1 -1
  257. data/src/rules/style/each_for_simple_loop.rs +1 -1
  258. data/src/rules/style/each_with_object.rs +4 -4
  259. data/src/rules/style/empty_block_parameter.rs +1 -1
  260. data/src/rules/style/empty_case_condition.rs +6 -6
  261. data/src/rules/style/empty_class_definition.rs +1 -1
  262. data/src/rules/style/empty_else.rs +1 -1
  263. data/src/rules/style/empty_heredoc.rs +14 -1
  264. data/src/rules/style/empty_lambda_parameter.rs +1 -1
  265. data/src/rules/style/empty_literal.rs +34 -2
  266. data/src/rules/style/empty_method.rs +1 -1
  267. data/src/rules/style/empty_string_inside_interpolation.rs +1 -1
  268. data/src/rules/style/endless.rs +11 -3
  269. data/src/rules/style/env_home.rs +1 -1
  270. data/src/rules/style/eval_with_location.rs +6 -0
  271. data/src/rules/style/even_odd.rs +1 -1
  272. data/src/rules/style/exact_regexp_match.rs +1 -1
  273. data/src/rules/style/expand_path_arguments.rs +3 -3
  274. data/src/rules/style/explicit_block_argument.rs +3 -3
  275. data/src/rules/style/file_open.rs +5 -0
  276. data/src/rules/style/file_open_call.rs +3 -3
  277. data/src/rules/style/file_write.rs +1 -1
  278. data/src/rules/style/for.rs +1 -1
  279. data/src/rules/style/format_sequences.rs +6 -0
  280. data/src/rules/style/format_string.rs +75 -11
  281. data/src/rules/style/format_string_token.rs +61 -12
  282. data/src/rules/style/frozen_string_literal_comment.rs +62 -4
  283. data/src/rules/style/guard_clause.rs +8 -7
  284. data/src/rules/style/hash_as_last_array_item.rs +4 -4
  285. data/src/rules/style/hash_each_methods.rs +1 -1
  286. data/src/rules/style/hash_like_case.rs +8 -8
  287. data/src/rules/style/hash_lookup_method.rs +43 -3
  288. data/src/rules/style/hash_subset.rs +16 -10
  289. data/src/rules/style/hash_syntax.rs +609 -71
  290. data/src/rules/style/hash_transform.rs +20 -18
  291. data/src/rules/style/hash_transform_keys.rs +7 -0
  292. data/src/rules/style/hash_transform_values.rs +7 -0
  293. data/src/rules/style/identical_conditional_branches.rs +54 -5
  294. data/src/rules/style/if_inside_else.rs +19 -3
  295. data/src/rules/style/if_unless_modifier.rs +13 -14
  296. data/src/rules/style/if_with_boolean_literal_branches.rs +1 -1
  297. data/src/rules/style/if_with_semicolon.rs +7 -1
  298. data/src/rules/style/implicit_runtime_error.rs +7 -0
  299. data/src/rules/style/in_pattern_then.rs +2 -2
  300. data/src/rules/style/infinite_loop.rs +6 -0
  301. data/src/rules/style/inline_comment.rs +4 -1
  302. data/src/rules/style/inverse_methods.rs +12 -2
  303. data/src/rules/style/invertible_unless_condition.rs +12 -12
  304. data/src/rules/style/it_block_parameter.rs +5 -2
  305. data/src/rules/style/keyword_arguments_merging.rs +8 -2
  306. data/src/rules/style/keyword_parameters_order.rs +1 -1
  307. data/src/rules/style/line_end_concatenation.rs +1 -1
  308. data/src/rules/style/magic_comment_format.rs +14 -6
  309. data/src/rules/style/map_chain.rs +1 -1
  310. data/src/rules/style/map_compact_with_conditional_block.rs +3 -3
  311. data/src/rules/style/map_into_array.rs +7 -7
  312. data/src/rules/style/map_join.rs +3 -3
  313. data/src/rules/style/method_call_with_args_parentheses.rs +7 -7
  314. data/src/rules/style/method_call_without_args_parentheses.rs +2 -2
  315. data/src/rules/style/method_def_parentheses.rs +2 -3
  316. data/src/rules/style/min_max.rs +3 -3
  317. data/src/rules/style/min_max_comparison.rs +2 -2
  318. data/src/rules/style/missing_else.rs +1 -1
  319. data/src/rules/style/missing_respond_to_missing.rs +1 -1
  320. data/src/rules/style/mixin_grouping.rs +6 -7
  321. data/src/rules/style/multiline_block_chain.rs +6 -8
  322. data/src/rules/style/multiline_if_then.rs +1 -1
  323. data/src/rules/style/multiline_in_pattern_then.rs +16 -3
  324. data/src/rules/style/multiline_method_signature.rs +1 -1
  325. data/src/rules/style/multiline_when_then.rs +2 -2
  326. data/src/rules/style/mutable_constant.rs +31 -35
  327. data/src/rules/style/negated_if.rs +2 -2
  328. data/src/rules/style/negated_if_else_condition.rs +5 -3
  329. data/src/rules/style/negated_while.rs +1 -1
  330. data/src/rules/style/negative_array_index.rs +25 -3
  331. data/src/rules/style/nested_modifier.rs +1 -1
  332. data/src/rules/style/nested_parenthesized_calls.rs +2 -2
  333. data/src/rules/style/nested_ternary_operator.rs +2 -2
  334. data/src/rules/style/next.rs +12 -12
  335. data/src/rules/style/nil_lambda.rs +2 -2
  336. data/src/rules/style/nodes.rs +21 -0
  337. data/src/rules/style/non_nil_check.rs +82 -2
  338. data/src/rules/style/numbered_parameters.rs +4 -1
  339. data/src/rules/style/numbered_parameters_limit.rs +2 -2
  340. data/src/rules/style/numeric_literals.rs +17 -1
  341. data/src/rules/style/numeric_predicate.rs +25 -6
  342. data/src/rules/style/one_line_conditional.rs +24 -7
  343. data/src/rules/style/operator_method_call.rs +5 -0
  344. data/src/rules/style/optional_arguments.rs +1 -1
  345. data/src/rules/style/or_assignment.rs +1 -1
  346. data/src/rules/style/parallel_assignment.rs +20 -9
  347. data/src/rules/style/parens.rs +1 -1
  348. data/src/rules/style/parentheses_around_condition.rs +3 -3
  349. data/src/rules/style/partition_instead_of_double_select.rs +3 -3
  350. data/src/rules/style/percent.rs +18 -9
  351. data/src/rules/style/percent_q_literals.rs +40 -7
  352. data/src/rules/style/preferred_hash_methods.rs +1 -1
  353. data/src/rules/style/quoted_symbols.rs +6 -0
  354. data/src/rules/style/raise_args.rs +26 -20
  355. data/src/rules/style/random_with_offset.rs +1 -1
  356. data/src/rules/style/reduce_to_hash.rs +6 -6
  357. data/src/rules/style/redundant_argument.rs +1 -1
  358. data/src/rules/style/redundant_assignment.rs +5 -5
  359. data/src/rules/style/redundant_begin.rs +5 -3
  360. data/src/rules/style/redundant_capital_w.rs +3 -2
  361. data/src/rules/style/redundant_condition.rs +17 -8
  362. data/src/rules/style/redundant_current_directory_in_path.rs +2 -2
  363. data/src/rules/style/redundant_double_splat_hash_braces.rs +15 -5
  364. data/src/rules/style/redundant_exception.rs +3 -1
  365. data/src/rules/style/redundant_file_extension_in_require.rs +2 -2
  366. data/src/rules/style/redundant_format.rs +98 -20
  367. data/src/rules/style/redundant_freeze.rs +1 -1
  368. data/src/rules/style/redundant_heredoc_delimiter_quotes.rs +1 -1
  369. data/src/rules/style/redundant_initialize.rs +6 -3
  370. data/src/rules/style/redundant_interpolation.rs +8 -8
  371. data/src/rules/style/redundant_interpolation_unfreeze.rs +10 -3
  372. data/src/rules/style/redundant_line_continuation.rs +10 -7
  373. data/src/rules/style/redundant_parentheses.rs +96 -19
  374. data/src/rules/style/redundant_regexp_argument.rs +1 -1
  375. data/src/rules/style/redundant_regexp_character_class.rs +4 -3
  376. data/src/rules/style/redundant_regexp_escape.rs +3 -2
  377. data/src/rules/style/redundant_return.rs +1 -2
  378. data/src/rules/style/redundant_self.rs +28 -16
  379. data/src/rules/style/redundant_sort.rs +1 -1
  380. data/src/rules/style/redundant_sort_by.rs +1 -1
  381. data/src/rules/style/redundant_string_escape.rs +6 -5
  382. data/src/rules/style/regexp_literal.rs +3 -2
  383. data/src/rules/style/require_order.rs +2 -2
  384. data/src/rules/style/rescue_modifier.rs +9 -4
  385. data/src/rules/style/rescue_standard_error.rs +1 -1
  386. data/src/rules/style/return_nil.rs +2 -2
  387. data/src/rules/style/return_nil_in_predicate_method_definition.rs +2 -2
  388. data/src/rules/style/safe_navigation.rs +2 -2
  389. data/src/rules/style/safe_navigation_chain_length.rs +8 -1
  390. data/src/rules/style/sample.rs +3 -3
  391. data/src/rules/style/select_by.rs +6 -2
  392. data/src/rules/style/select_by_range.rs +1 -1
  393. data/src/rules/style/semicolon.rs +77 -4
  394. data/src/rules/style/signal_exception.rs +60 -3
  395. data/src/rules/style/single_argument_dig.rs +10 -2
  396. data/src/rules/style/single_line_block_params.rs +14 -4
  397. data/src/rules/style/single_line_do_end_block.rs +13 -12
  398. data/src/rules/style/single_line_methods.rs +2 -2
  399. data/src/rules/style/slicing_with_range.rs +2 -2
  400. data/src/rules/style/sole_nested_conditional.rs +4 -4
  401. data/src/rules/style/special_global_vars.rs +2 -2
  402. data/src/rules/style/stabby_lambda_parentheses.rs +1 -1
  403. data/src/rules/style/statement_modifier.rs +3 -2
  404. data/src/rules/style/static_class.rs +7 -1
  405. data/src/rules/style/string_concatenation.rs +12 -7
  406. data/src/rules/style/string_hash_keys.rs +3 -2
  407. data/src/rules/style/string_literals.rs +3 -3
  408. data/src/rules/style/string_literals_in_interpolation.rs +4 -1
  409. data/src/rules/style/struct_inheritance.rs +3 -3
  410. data/src/rules/style/super_arguments.rs +15 -7
  411. data/src/rules/style/super_with_args_parentheses.rs +49 -12
  412. data/src/rules/style/swap_values.rs +1 -1
  413. data/src/rules/style/symbol_array.rs +9 -2
  414. data/src/rules/style/symbol_proc.rs +3 -3
  415. data/src/rules/style/tally_method.rs +4 -4
  416. data/src/rules/style/ternary_parentheses.rs +30 -15
  417. data/src/rules/style/top_level_method_definition.rs +10 -5
  418. data/src/rules/style/trailing_body.rs +1 -1
  419. data/src/rules/style/trailing_comma.rs +206 -10
  420. data/src/rules/style/trailing_comma_in_arguments.rs +9 -10
  421. data/src/rules/style/trailing_comma_in_array_literal.rs +2 -1
  422. data/src/rules/style/trailing_comma_in_hash_literal.rs +2 -1
  423. data/src/rules/style/trailing_method_end_statement.rs +6 -1
  424. data/src/rules/style/trailing_underscore_variable.rs +4 -5
  425. data/src/rules/style/trivial_accessors.rs +2 -2
  426. data/src/rules/style/unless_logical_operators.rs +1 -1
  427. data/src/rules/style/unpack_first.rs +11 -2
  428. data/src/rules/style/when_then.rs +4 -4
  429. data/src/rules/style/while_until_do.rs +1 -1
  430. data/src/rules/style/while_until_modifier.rs +3 -3
  431. data/src/rules/style/word_array.rs +9 -7
  432. data/src/rules/style/yoda_condition.rs +2 -2
  433. data/src/rules/style/zero_length_predicate.rs +5 -0
  434. data/src/rules/support.rs +128 -11
  435. data/src/source.rs +18 -15
  436. metadata +5 -1
data/src/display_width.rs CHANGED
@@ -4,55 +4,95 @@
4
4
  //! CJK text is wider than its character count and the two disagree about where a caret belongs.
5
5
  //! Both the alignment cops and the `clang`-style formatters need the same answer, which is why this
6
6
  //! lives outside either of them.
7
+ //!
8
+ //! The answer comes from [`crate::display_width_table`], generated from the gem itself. A hand
9
+ //! written table stood here before and drifted: it counted the combining marks U+3099 and U+309A
10
+ //! two columns each, because the blanket wide range `0x3041..=0x33FF` swallowed them, so a source
11
+ //! file holding decomposed Japanese -- which is what macOS hands over routinely -- drew ten carets
12
+ //! where RuboCop draws six. Reproducing an exception table by hand is what went wrong; the ranges
13
+ //! are now taken from the reference implementation rather than restated.
14
+
15
+ use crate::display_width_table::WIDTHS;
7
16
 
8
- /// `Unicode::DisplayWidth.of`, restricted to what a source file can hold: East Asian Wide and
9
- /// Fullwidth characters take two columns, combining marks take none, everything else takes one.
17
+ /// `Unicode::DisplayWidth.of`, called the way RuboCop calls it: no options, one character at a
18
+ /// time.
10
19
  pub fn display_width(text: &str) -> i64 {
11
- text.chars().map(character_width).sum()
20
+ // `of` clamps its own result at zero, which is observable because BACKSPACE is worth -1: the
21
+ // gem answers 0 for `"ab\b\b\b\b"` rather than -2. Nothing is narrower than nothing.
22
+ text.chars().map(character_width).sum::<i64>().max(0)
12
23
  }
13
24
 
14
25
  fn character_width(character: char) -> i64 {
15
26
  let code = character as u32;
16
- if is_zero_width(code) {
17
- return 0;
18
- }
19
- if is_wide(code) { 2 } else { 1 }
27
+ // The table holds only the ranges whose width is not 1, sorted by their first code point and
28
+ // non-overlapping, so the range that could contain `code` is the last one starting at or below
29
+ // it. Anything else is one column wide.
30
+ let candidate = WIDTHS.partition_point(|(first, _, _)| *first <= code);
31
+ candidate
32
+ .checked_sub(1)
33
+ .and_then(|index| WIDTHS.get(index))
34
+ .filter(|(_, last, _)| code <= *last)
35
+ .map_or(1, |(_, _, width)| i64::from(*width))
20
36
  }
21
37
 
22
- fn is_zero_width(code: u32) -> bool {
23
- matches!(code,
24
- 0x0300..=0x036F | 0x0483..=0x0489 | 0x0591..=0x05BD | 0x0610..=0x061A
25
- | 0x064B..=0x065F | 0x0670 | 0x06D6..=0x06DC | 0x0730..=0x074A
26
- | 0x07A6..=0x07B0 | 0x0816..=0x0819 | 0x081B..=0x0823 | 0x0825..=0x0827
27
- | 0x0829..=0x082D | 0x0900..=0x0902 | 0x093A | 0x093C | 0x0941..=0x0948
28
- | 0x094D | 0x0951..=0x0957 | 0x0962..=0x0963 | 0x0E31 | 0x0E34..=0x0E3A
29
- | 0x0E47..=0x0E4E | 0x200B..=0x200F | 0x202A..=0x202E | 0x2060..=0x2064
30
- | 0x20D0..=0x20F0 | 0xFE00..=0xFE0F | 0xFE20..=0xFE2F | 0xFEFF
31
- | 0x1AB0..=0x1AFF | 0x1DC0..=0x1DFF)
32
- }
38
+ #[cfg(test)]
39
+ mod tests {
40
+ use super::{WIDTHS, display_width};
41
+
42
+ #[test]
43
+ fn ascii_is_one_column_per_character() {
44
+ assert_eq!(display_width(""), 0);
45
+ assert_eq!(display_width("x = 1"), 5);
46
+ }
47
+
48
+ #[test]
49
+ fn east_asian_wide_and_fullwidth_characters_take_two_columns() {
50
+ assert_eq!(display_width("日本語"), 6);
51
+ assert_eq!(display_width("a"), 2); // U+FF41 FULLWIDTH LATIN SMALL LETTER A
52
+ assert_eq!(display_width("ア"), 1); // U+FF71 halfwidth katakana stays narrow
53
+ assert_eq!(display_width("😀"), 2);
54
+ }
33
55
 
34
- /// The East Asian Wide and Fullwidth ranges, which is what makes a character two columns wide.
35
- fn is_wide(code: u32) -> bool {
36
- matches!(code,
37
- 0x1100..=0x115F | 0x231A..=0x231B | 0x2329..=0x232A | 0x23E9..=0x23EC
38
- | 0x23F0 | 0x23F3 | 0x25FD..=0x25FE | 0x2614..=0x2615 | 0x2648..=0x2653
39
- | 0x267F | 0x2693 | 0x26A1 | 0x26AA..=0x26AB | 0x26BD..=0x26BE
40
- | 0x26C4..=0x26C5 | 0x26CE | 0x26D4 | 0x26EA | 0x26F2..=0x26F3 | 0x26F5
41
- | 0x26FA | 0x26FD | 0x2705 | 0x270A..=0x270B | 0x2728 | 0x274C | 0x274E
42
- | 0x2753..=0x2755 | 0x2757 | 0x2795..=0x2797 | 0x27B0 | 0x27BF
43
- | 0x2B1B..=0x2B1C | 0x2B50 | 0x2B55 | 0x2E80..=0x303E | 0x3041..=0x33FF
44
- | 0x3400..=0x4DBF | 0x4E00..=0x9FFF | 0xA000..=0xA4CF | 0xA960..=0xA97F
45
- | 0xAC00..=0xD7A3 | 0xF900..=0xFAFF | 0xFE10..=0xFE19 | 0xFE30..=0xFE6F
46
- | 0xFF00..=0xFF60 | 0xFFE0..=0xFFE6 | 0x16FE0..=0x16FE4 | 0x17000..=0x18AFF
47
- | 0x1B000..=0x1B2FF | 0x1F004 | 0x1F0CF | 0x1F18E | 0x1F191..=0x1F19A
48
- | 0x1F200..=0x1F320 | 0x1F32D..=0x1F335 | 0x1F337..=0x1F37C
49
- | 0x1F37E..=0x1F393 | 0x1F3A0..=0x1F3CA | 0x1F3CF..=0x1F3D3
50
- | 0x1F3E0..=0x1F3F0 | 0x1F3F4 | 0x1F3F8..=0x1F43E | 0x1F440
51
- | 0x1F442..=0x1F4FC | 0x1F4FF..=0x1F53D | 0x1F54B..=0x1F54E
52
- | 0x1F550..=0x1F567 | 0x1F57A | 0x1F595..=0x1F596 | 0x1F5A4
53
- | 0x1F5FB..=0x1F64F | 0x1F680..=0x1F6C5 | 0x1F6CC | 0x1F6D0..=0x1F6D2
54
- | 0x1F6EB..=0x1F6EC | 0x1F6F4..=0x1F6FC | 0x1F7E0..=0x1F7EB
55
- | 0x1F90C..=0x1F93A | 0x1F93C..=0x1F945 | 0x1F947..=0x1F978
56
- | 0x1F97A..=0x1F9CB | 0x1F9CD..=0x1F9FF | 0x1FA70..=0x1FAF6
57
- | 0x20000..=0x2FFFD | 0x30000..=0x3FFFD)
56
+ /// The regression this table was generated for. macOS hands over decomposed Japanese, and
57
+ /// counting the voiced sound mark as a character of its own made every one of them two columns
58
+ /// too wide: `x = "がが"` drew ten carets where RuboCop draws six.
59
+ #[test]
60
+ fn a_combining_mark_takes_no_columns_of_its_own() {
61
+ assert_eq!(display_width("\u{304B}\u{3099}"), 2); // か + ◌゙ = が
62
+ assert_eq!(display_width("\u{304C}"), 2); // the composed form agrees
63
+ assert_eq!(display_width("e\u{0301}"), 1); // e + ◌́
64
+ assert_eq!(display_width("\u{115F}"), 0); // HANGUL CHOSEONG FILLER
65
+ }
66
+
67
+ /// `of` never answers with less than zero, however many backspaces the text holds.
68
+ #[test]
69
+ fn backspace_takes_a_column_back_but_never_past_zero() {
70
+ assert_eq!(display_width("a\u{0008}"), 0);
71
+ assert_eq!(display_width("ab\u{0008}\u{0008}\u{0008}\u{0008}"), 0);
72
+ assert_eq!(display_width("\u{0008}"), 0);
73
+ }
74
+
75
+ /// Not every character is one or two columns wide, which is why the table stores a width rather
76
+ /// than a flag.
77
+ #[test]
78
+ fn the_two_em_dash_takes_three_columns() {
79
+ assert_eq!(display_width("\u{2E3B}"), 3);
80
+ assert_eq!(display_width("\u{2E3A}"), 2); // THREE-EM DASH's narrower sibling
81
+ }
82
+
83
+ /// The lookup is a binary search, so a regenerated table that is unsorted or overlapping would
84
+ /// answer wrongly rather than fail to build.
85
+ #[test]
86
+ fn the_generated_table_is_sorted_and_disjoint() {
87
+ for window in WIDTHS.windows(2) {
88
+ let (first, last, width) = window[0];
89
+ let (next_first, _, _) = window[1];
90
+ assert!(first <= last, "range 0x{first:04X} ends before it starts");
91
+ assert!(
92
+ last < next_first,
93
+ "range 0x{first:04X}..=0x{last:04X} overlaps 0x{next_first:04X}"
94
+ );
95
+ assert_ne!(width, 1, "the table only holds widths other than 1");
96
+ }
97
+ }
58
98
  }
@@ -0,0 +1,506 @@
1
+ //! Character widths as `Unicode::DisplayWidth` reports them. **Generated; do not edit.**
2
+ //!
3
+ //! Regenerate with `ruby scripts/dump_display_width.rb > src/display_width_table.rs`, which
4
+ //! documents why the gem rather than the Unicode data files is the source.
5
+ //!
6
+ //! Generated from unicode-display_width 3.2.0 (Unicode 17.0.0).
7
+ //!
8
+ //! RuboCop's gemspec allows `>= 2.4.0, < 4.0`, so a user's own RuboCop may measure with a
9
+ //! different release of the gem and disagree about a handful of code points. Pinning to one
10
+ //! release is as close as a table can get; the version above is what the table reproduces.
11
+
12
+ /// `(first, last, width)` for every inclusive range whose width is not 1, sorted by `first` and
13
+ /// non-overlapping. A code point matching no range is one column wide.
14
+ pub(crate) static WIDTHS: &[(u32, u32, i8)] = &[
15
+ (0x0000, 0x0000, 0),
16
+ (0x0005, 0x0005, 0),
17
+ (0x0007, 0x0007, 0),
18
+ (0x0008, 0x0008, -1),
19
+ (0x000A, 0x000F, 0),
20
+ (0x0300, 0x036F, 0),
21
+ (0x0483, 0x0489, 0),
22
+ (0x0591, 0x05BD, 0),
23
+ (0x05BF, 0x05BF, 0),
24
+ (0x05C1, 0x05C2, 0),
25
+ (0x05C4, 0x05C5, 0),
26
+ (0x05C7, 0x05C7, 0),
27
+ (0x0605, 0x0605, 0),
28
+ (0x0610, 0x061A, 0),
29
+ (0x061C, 0x061C, 0),
30
+ (0x064B, 0x065F, 0),
31
+ (0x0670, 0x0670, 0),
32
+ (0x06D6, 0x06DD, 0),
33
+ (0x06DF, 0x06E4, 0),
34
+ (0x06E7, 0x06E8, 0),
35
+ (0x06EA, 0x06ED, 0),
36
+ (0x070F, 0x070F, 0),
37
+ (0x0711, 0x0711, 0),
38
+ (0x0730, 0x074A, 0),
39
+ (0x07A6, 0x07B0, 0),
40
+ (0x07EB, 0x07F3, 0),
41
+ (0x07FD, 0x07FD, 0),
42
+ (0x0816, 0x0819, 0),
43
+ (0x081B, 0x0823, 0),
44
+ (0x0825, 0x0827, 0),
45
+ (0x0829, 0x082D, 0),
46
+ (0x0859, 0x085B, 0),
47
+ (0x0897, 0x089F, 0),
48
+ (0x08CA, 0x0902, 0),
49
+ (0x093A, 0x093A, 0),
50
+ (0x093C, 0x093C, 0),
51
+ (0x0941, 0x0948, 0),
52
+ (0x094D, 0x094D, 0),
53
+ (0x0951, 0x0957, 0),
54
+ (0x0962, 0x0963, 0),
55
+ (0x0981, 0x0981, 0),
56
+ (0x09BC, 0x09BC, 0),
57
+ (0x09C1, 0x09C4, 0),
58
+ (0x09CD, 0x09CD, 0),
59
+ (0x09E2, 0x09E3, 0),
60
+ (0x09FE, 0x09FE, 0),
61
+ (0x0A01, 0x0A02, 0),
62
+ (0x0A3C, 0x0A3C, 0),
63
+ (0x0A41, 0x0A42, 0),
64
+ (0x0A47, 0x0A48, 0),
65
+ (0x0A4B, 0x0A4D, 0),
66
+ (0x0A51, 0x0A51, 0),
67
+ (0x0A70, 0x0A71, 0),
68
+ (0x0A75, 0x0A75, 0),
69
+ (0x0A81, 0x0A82, 0),
70
+ (0x0ABC, 0x0ABC, 0),
71
+ (0x0AC1, 0x0AC5, 0),
72
+ (0x0AC7, 0x0AC8, 0),
73
+ (0x0ACD, 0x0ACD, 0),
74
+ (0x0AE2, 0x0AE3, 0),
75
+ (0x0AFA, 0x0AFF, 0),
76
+ (0x0B01, 0x0B01, 0),
77
+ (0x0B3C, 0x0B3C, 0),
78
+ (0x0B3F, 0x0B3F, 0),
79
+ (0x0B41, 0x0B44, 0),
80
+ (0x0B4D, 0x0B4D, 0),
81
+ (0x0B55, 0x0B56, 0),
82
+ (0x0B62, 0x0B63, 0),
83
+ (0x0B82, 0x0B82, 0),
84
+ (0x0BC0, 0x0BC0, 0),
85
+ (0x0BCD, 0x0BCD, 0),
86
+ (0x0C00, 0x0C00, 0),
87
+ (0x0C04, 0x0C04, 0),
88
+ (0x0C3C, 0x0C3C, 0),
89
+ (0x0C3E, 0x0C40, 0),
90
+ (0x0C46, 0x0C48, 0),
91
+ (0x0C4A, 0x0C4D, 0),
92
+ (0x0C55, 0x0C56, 0),
93
+ (0x0C62, 0x0C63, 0),
94
+ (0x0C81, 0x0C81, 0),
95
+ (0x0CBC, 0x0CBC, 0),
96
+ (0x0CBF, 0x0CBF, 0),
97
+ (0x0CC6, 0x0CC6, 0),
98
+ (0x0CCC, 0x0CCD, 0),
99
+ (0x0CE2, 0x0CE3, 0),
100
+ (0x0D00, 0x0D01, 0),
101
+ (0x0D3B, 0x0D3C, 0),
102
+ (0x0D41, 0x0D44, 0),
103
+ (0x0D4D, 0x0D4D, 0),
104
+ (0x0D62, 0x0D63, 0),
105
+ (0x0D81, 0x0D81, 0),
106
+ (0x0DCA, 0x0DCA, 0),
107
+ (0x0DD2, 0x0DD4, 0),
108
+ (0x0DD6, 0x0DD6, 0),
109
+ (0x0E31, 0x0E31, 0),
110
+ (0x0E34, 0x0E3A, 0),
111
+ (0x0E47, 0x0E4E, 0),
112
+ (0x0EB1, 0x0EB1, 0),
113
+ (0x0EB4, 0x0EBC, 0),
114
+ (0x0EC8, 0x0ECE, 0),
115
+ (0x0F18, 0x0F19, 0),
116
+ (0x0F35, 0x0F35, 0),
117
+ (0x0F37, 0x0F37, 0),
118
+ (0x0F39, 0x0F39, 0),
119
+ (0x0F71, 0x0F7E, 0),
120
+ (0x0F80, 0x0F84, 0),
121
+ (0x0F86, 0x0F87, 0),
122
+ (0x0F8D, 0x0F97, 0),
123
+ (0x0F99, 0x0FBC, 0),
124
+ (0x0FC6, 0x0FC6, 0),
125
+ (0x102D, 0x1030, 0),
126
+ (0x1032, 0x1037, 0),
127
+ (0x1039, 0x103A, 0),
128
+ (0x103D, 0x103E, 0),
129
+ (0x1058, 0x1059, 0),
130
+ (0x105E, 0x1060, 0),
131
+ (0x1071, 0x1074, 0),
132
+ (0x1082, 0x1082, 0),
133
+ (0x1085, 0x1086, 0),
134
+ (0x108D, 0x108D, 0),
135
+ (0x109D, 0x109D, 0),
136
+ (0x1100, 0x115E, 2),
137
+ (0x115F, 0x11FF, 0),
138
+ (0x135D, 0x135F, 0),
139
+ (0x1712, 0x1714, 0),
140
+ (0x1732, 0x1733, 0),
141
+ (0x1752, 0x1753, 0),
142
+ (0x1772, 0x1773, 0),
143
+ (0x17B4, 0x17B5, 0),
144
+ (0x17B7, 0x17BD, 0),
145
+ (0x17C6, 0x17C6, 0),
146
+ (0x17C9, 0x17D3, 0),
147
+ (0x17DD, 0x17DD, 0),
148
+ (0x180B, 0x180F, 0),
149
+ (0x1885, 0x1886, 0),
150
+ (0x18A9, 0x18A9, 0),
151
+ (0x1920, 0x1922, 0),
152
+ (0x1927, 0x1928, 0),
153
+ (0x1932, 0x1932, 0),
154
+ (0x1939, 0x193B, 0),
155
+ (0x1A17, 0x1A18, 0),
156
+ (0x1A1B, 0x1A1B, 0),
157
+ (0x1A56, 0x1A56, 0),
158
+ (0x1A58, 0x1A5E, 0),
159
+ (0x1A60, 0x1A60, 0),
160
+ (0x1A62, 0x1A62, 0),
161
+ (0x1A65, 0x1A6C, 0),
162
+ (0x1A73, 0x1A7C, 0),
163
+ (0x1A7F, 0x1A7F, 0),
164
+ (0x1AB0, 0x1AEF, 0),
165
+ (0x1B00, 0x1B03, 0),
166
+ (0x1B34, 0x1B34, 0),
167
+ (0x1B36, 0x1B3A, 0),
168
+ (0x1B3C, 0x1B3C, 0),
169
+ (0x1B42, 0x1B42, 0),
170
+ (0x1B6B, 0x1B73, 0),
171
+ (0x1B80, 0x1B81, 0),
172
+ (0x1BA2, 0x1BA5, 0),
173
+ (0x1BA8, 0x1BA9, 0),
174
+ (0x1BAB, 0x1BAD, 0),
175
+ (0x1BE6, 0x1BE6, 0),
176
+ (0x1BE8, 0x1BE9, 0),
177
+ (0x1BED, 0x1BED, 0),
178
+ (0x1BEF, 0x1BF1, 0),
179
+ (0x1C2C, 0x1C33, 0),
180
+ (0x1C36, 0x1C37, 0),
181
+ (0x1CD0, 0x1CD2, 0),
182
+ (0x1CD4, 0x1CE0, 0),
183
+ (0x1CE2, 0x1CE8, 0),
184
+ (0x1CED, 0x1CED, 0),
185
+ (0x1CF4, 0x1CF4, 0),
186
+ (0x1CF8, 0x1CF9, 0),
187
+ (0x1DC0, 0x1DFF, 0),
188
+ (0x200B, 0x200F, 0),
189
+ (0x2028, 0x202E, 0),
190
+ (0x2060, 0x206F, 0),
191
+ (0x20D0, 0x20FF, 0),
192
+ (0x231A, 0x231B, 2),
193
+ (0x2329, 0x232A, 2),
194
+ (0x23E9, 0x23EC, 2),
195
+ (0x23F0, 0x23F0, 2),
196
+ (0x23F3, 0x23F3, 2),
197
+ (0x25FD, 0x25FE, 2),
198
+ (0x2614, 0x2615, 2),
199
+ (0x2630, 0x2637, 2),
200
+ (0x2648, 0x2653, 2),
201
+ (0x267F, 0x267F, 2),
202
+ (0x268A, 0x268F, 2),
203
+ (0x2693, 0x2693, 2),
204
+ (0x26A1, 0x26A1, 2),
205
+ (0x26AA, 0x26AB, 2),
206
+ (0x26BD, 0x26BE, 2),
207
+ (0x26C4, 0x26C5, 2),
208
+ (0x26CE, 0x26CE, 2),
209
+ (0x26D4, 0x26D4, 2),
210
+ (0x26EA, 0x26EA, 2),
211
+ (0x26F2, 0x26F3, 2),
212
+ (0x26F5, 0x26F5, 2),
213
+ (0x26FA, 0x26FA, 2),
214
+ (0x26FD, 0x26FD, 2),
215
+ (0x2705, 0x2705, 2),
216
+ (0x270A, 0x270B, 2),
217
+ (0x2728, 0x2728, 2),
218
+ (0x274C, 0x274C, 2),
219
+ (0x274E, 0x274E, 2),
220
+ (0x2753, 0x2755, 2),
221
+ (0x2757, 0x2757, 2),
222
+ (0x2795, 0x2797, 2),
223
+ (0x27B0, 0x27B0, 2),
224
+ (0x27BF, 0x27BF, 2),
225
+ (0x2B1B, 0x2B1C, 2),
226
+ (0x2B50, 0x2B50, 2),
227
+ (0x2B55, 0x2B55, 2),
228
+ (0x2CEF, 0x2CF1, 0),
229
+ (0x2D7F, 0x2D7F, 0),
230
+ (0x2DE0, 0x2DFF, 0),
231
+ (0x2E3A, 0x2E3A, 2),
232
+ (0x2E3B, 0x2E3B, 3),
233
+ (0x2E80, 0x2E99, 2),
234
+ (0x2E9B, 0x2FDF, 2),
235
+ (0x2FF0, 0x3029, 2),
236
+ (0x302A, 0x302D, 0),
237
+ (0x302E, 0x303E, 2),
238
+ (0x3041, 0x3096, 2),
239
+ (0x3099, 0x309A, 0),
240
+ (0x309B, 0x30FF, 2),
241
+ (0x3105, 0x312F, 2),
242
+ (0x3131, 0x3163, 2),
243
+ (0x3164, 0x3164, 0),
244
+ (0x3165, 0x31E5, 2),
245
+ (0x31EF, 0x3247, 2),
246
+ (0x3250, 0xA4CF, 2),
247
+ (0xA66F, 0xA672, 0),
248
+ (0xA674, 0xA67D, 0),
249
+ (0xA69E, 0xA69F, 0),
250
+ (0xA6F0, 0xA6F1, 0),
251
+ (0xA802, 0xA802, 0),
252
+ (0xA806, 0xA806, 0),
253
+ (0xA80B, 0xA80B, 0),
254
+ (0xA825, 0xA826, 0),
255
+ (0xA82C, 0xA82C, 0),
256
+ (0xA8C4, 0xA8C5, 0),
257
+ (0xA8E0, 0xA8F1, 0),
258
+ (0xA8FF, 0xA8FF, 0),
259
+ (0xA926, 0xA92D, 0),
260
+ (0xA947, 0xA951, 0),
261
+ (0xA960, 0xA97F, 2),
262
+ (0xA980, 0xA982, 0),
263
+ (0xA9B3, 0xA9B3, 0),
264
+ (0xA9B6, 0xA9B9, 0),
265
+ (0xA9BC, 0xA9BD, 0),
266
+ (0xA9E5, 0xA9E5, 0),
267
+ (0xAA29, 0xAA2E, 0),
268
+ (0xAA31, 0xAA32, 0),
269
+ (0xAA35, 0xAA36, 0),
270
+ (0xAA43, 0xAA43, 0),
271
+ (0xAA4C, 0xAA4C, 0),
272
+ (0xAA7C, 0xAA7C, 0),
273
+ (0xAAB0, 0xAAB0, 0),
274
+ (0xAAB2, 0xAAB4, 0),
275
+ (0xAAB7, 0xAAB8, 0),
276
+ (0xAABE, 0xAABF, 0),
277
+ (0xAAC1, 0xAAC1, 0),
278
+ (0xAAEC, 0xAAED, 0),
279
+ (0xAAF6, 0xAAF6, 0),
280
+ (0xABE5, 0xABE5, 0),
281
+ (0xABE8, 0xABE8, 0),
282
+ (0xABED, 0xABED, 0),
283
+ (0xAC00, 0xD7AF, 2),
284
+ (0xD7B0, 0xD7FF, 0),
285
+ (0xF900, 0xFAFF, 2),
286
+ (0xFB1E, 0xFB1E, 0),
287
+ (0xFE00, 0xFE0F, 0),
288
+ (0xFE10, 0xFE1F, 2),
289
+ (0xFE20, 0xFE2F, 0),
290
+ (0xFE30, 0xFE52, 2),
291
+ (0xFE54, 0xFE66, 2),
292
+ (0xFE68, 0xFE6B, 2),
293
+ (0xFEFF, 0xFEFF, 0),
294
+ (0xFF01, 0xFF60, 2),
295
+ (0xFFA0, 0xFFA0, 0),
296
+ (0xFFE0, 0xFFE6, 2),
297
+ (0xFFF0, 0xFFFB, 0),
298
+ (0x101FD, 0x101FD, 0),
299
+ (0x102E0, 0x102E0, 0),
300
+ (0x10376, 0x1037A, 0),
301
+ (0x10A01, 0x10A03, 0),
302
+ (0x10A05, 0x10A06, 0),
303
+ (0x10A0C, 0x10A0F, 0),
304
+ (0x10A38, 0x10A3A, 0),
305
+ (0x10A3F, 0x10A3F, 0),
306
+ (0x10AE5, 0x10AE6, 0),
307
+ (0x10D24, 0x10D27, 0),
308
+ (0x10D69, 0x10D6D, 0),
309
+ (0x10EAB, 0x10EAC, 0),
310
+ (0x10EFA, 0x10EFF, 0),
311
+ (0x10F46, 0x10F50, 0),
312
+ (0x10F82, 0x10F85, 0),
313
+ (0x11001, 0x11001, 0),
314
+ (0x11038, 0x11046, 0),
315
+ (0x11070, 0x11070, 0),
316
+ (0x11073, 0x11074, 0),
317
+ (0x1107F, 0x11081, 0),
318
+ (0x110B3, 0x110B6, 0),
319
+ (0x110B9, 0x110BA, 0),
320
+ (0x110BD, 0x110BD, 0),
321
+ (0x110C2, 0x110C2, 0),
322
+ (0x110CD, 0x110CD, 0),
323
+ (0x11100, 0x11102, 0),
324
+ (0x11127, 0x1112B, 0),
325
+ (0x1112D, 0x11134, 0),
326
+ (0x11173, 0x11173, 0),
327
+ (0x11180, 0x11181, 0),
328
+ (0x111B6, 0x111BE, 0),
329
+ (0x111C9, 0x111CC, 0),
330
+ (0x111CF, 0x111CF, 0),
331
+ (0x1122F, 0x11231, 0),
332
+ (0x11234, 0x11234, 0),
333
+ (0x11236, 0x11237, 0),
334
+ (0x1123E, 0x1123E, 0),
335
+ (0x11241, 0x11241, 0),
336
+ (0x112DF, 0x112DF, 0),
337
+ (0x112E3, 0x112EA, 0),
338
+ (0x11300, 0x11301, 0),
339
+ (0x1133B, 0x1133C, 0),
340
+ (0x11340, 0x11340, 0),
341
+ (0x11366, 0x1136C, 0),
342
+ (0x11370, 0x1137F, 0),
343
+ (0x113BB, 0x113C0, 0),
344
+ (0x113CE, 0x113CE, 0),
345
+ (0x113D0, 0x113D0, 0),
346
+ (0x113D2, 0x113D2, 0),
347
+ (0x113E1, 0x113E2, 0),
348
+ (0x11438, 0x1143F, 0),
349
+ (0x11442, 0x11444, 0),
350
+ (0x11446, 0x11446, 0),
351
+ (0x1145E, 0x1145E, 0),
352
+ (0x114B3, 0x114B8, 0),
353
+ (0x114BA, 0x114BA, 0),
354
+ (0x114BF, 0x114C0, 0),
355
+ (0x114C2, 0x114C3, 0),
356
+ (0x115B2, 0x115B5, 0),
357
+ (0x115BC, 0x115BD, 0),
358
+ (0x115BF, 0x115C0, 0),
359
+ (0x115DC, 0x115DD, 0),
360
+ (0x11633, 0x1163A, 0),
361
+ (0x1163D, 0x1163D, 0),
362
+ (0x1163F, 0x11640, 0),
363
+ (0x116AB, 0x116AB, 0),
364
+ (0x116AD, 0x116AD, 0),
365
+ (0x116B0, 0x116B5, 0),
366
+ (0x116B7, 0x116B7, 0),
367
+ (0x1171D, 0x1171D, 0),
368
+ (0x1171F, 0x1171F, 0),
369
+ (0x11722, 0x11725, 0),
370
+ (0x11727, 0x1172B, 0),
371
+ (0x1182F, 0x11837, 0),
372
+ (0x11839, 0x1183A, 0),
373
+ (0x1193B, 0x1193C, 0),
374
+ (0x1193E, 0x1193E, 0),
375
+ (0x11943, 0x11943, 0),
376
+ (0x119D4, 0x119D7, 0),
377
+ (0x119DA, 0x119DB, 0),
378
+ (0x119E0, 0x119E0, 0),
379
+ (0x11A01, 0x11A0A, 0),
380
+ (0x11A33, 0x11A38, 0),
381
+ (0x11A3B, 0x11A3E, 0),
382
+ (0x11A47, 0x11A47, 0),
383
+ (0x11A51, 0x11A56, 0),
384
+ (0x11A59, 0x11A5B, 0),
385
+ (0x11A8A, 0x11A96, 0),
386
+ (0x11A98, 0x11A99, 0),
387
+ (0x11B60, 0x11B60, 0),
388
+ (0x11B62, 0x11B64, 0),
389
+ (0x11B66, 0x11B66, 0),
390
+ (0x11C30, 0x11C36, 0),
391
+ (0x11C38, 0x11C3D, 0),
392
+ (0x11C3F, 0x11C3F, 0),
393
+ (0x11C92, 0x11CA7, 0),
394
+ (0x11CAA, 0x11CB0, 0),
395
+ (0x11CB2, 0x11CB3, 0),
396
+ (0x11CB5, 0x11CB6, 0),
397
+ (0x11D31, 0x11D36, 0),
398
+ (0x11D3A, 0x11D3A, 0),
399
+ (0x11D3C, 0x11D3D, 0),
400
+ (0x11D3F, 0x11D45, 0),
401
+ (0x11D47, 0x11D47, 0),
402
+ (0x11D90, 0x11D91, 0),
403
+ (0x11D95, 0x11D95, 0),
404
+ (0x11D97, 0x11D97, 0),
405
+ (0x11EF3, 0x11EF4, 0),
406
+ (0x11F00, 0x11F01, 0),
407
+ (0x11F36, 0x11F3A, 0),
408
+ (0x11F40, 0x11F40, 0),
409
+ (0x11F42, 0x11F42, 0),
410
+ (0x11F5A, 0x11F5A, 0),
411
+ (0x13430, 0x13440, 0),
412
+ (0x13447, 0x1345F, 0),
413
+ (0x1611E, 0x16129, 0),
414
+ (0x1612D, 0x1612F, 0),
415
+ (0x16AF0, 0x16AF4, 0),
416
+ (0x16B30, 0x16B36, 0),
417
+ (0x16F4F, 0x16F4F, 0),
418
+ (0x16F8F, 0x16F92, 0),
419
+ (0x16FE0, 0x16FE3, 2),
420
+ (0x16FE4, 0x16FE4, 0),
421
+ (0x16FF0, 0x18CDF, 2),
422
+ (0x18CFF, 0x18D1F, 2),
423
+ (0x18D80, 0x18DFF, 2),
424
+ (0x1AFF0, 0x1AFF3, 2),
425
+ (0x1AFF5, 0x1AFFB, 2),
426
+ (0x1AFFD, 0x1AFFE, 2),
427
+ (0x1B000, 0x1B12F, 2),
428
+ (0x1B132, 0x1B132, 2),
429
+ (0x1B150, 0x1B152, 2),
430
+ (0x1B155, 0x1B155, 2),
431
+ (0x1B164, 0x1B167, 2),
432
+ (0x1B170, 0x1B2FF, 2),
433
+ (0x1BC9D, 0x1BC9E, 0),
434
+ (0x1BCA0, 0x1BCAF, 0),
435
+ (0x1CF00, 0x1CF4F, 0),
436
+ (0x1D167, 0x1D169, 0),
437
+ (0x1D173, 0x1D182, 0),
438
+ (0x1D185, 0x1D18B, 0),
439
+ (0x1D1AA, 0x1D1AD, 0),
440
+ (0x1D242, 0x1D244, 0),
441
+ (0x1D300, 0x1D376, 2),
442
+ (0x1DA00, 0x1DA36, 0),
443
+ (0x1DA3B, 0x1DA6C, 0),
444
+ (0x1DA75, 0x1DA75, 0),
445
+ (0x1DA84, 0x1DA84, 0),
446
+ (0x1DA9B, 0x1DA9F, 0),
447
+ (0x1DAA1, 0x1DAAF, 0),
448
+ (0x1E000, 0x1E006, 0),
449
+ (0x1E008, 0x1E018, 0),
450
+ (0x1E01B, 0x1E021, 0),
451
+ (0x1E023, 0x1E024, 0),
452
+ (0x1E026, 0x1E02A, 0),
453
+ (0x1E08F, 0x1E08F, 0),
454
+ (0x1E130, 0x1E136, 0),
455
+ (0x1E2AE, 0x1E2AE, 0),
456
+ (0x1E2EC, 0x1E2EF, 0),
457
+ (0x1E4EC, 0x1E4EF, 0),
458
+ (0x1E5EE, 0x1E5EF, 0),
459
+ (0x1E6E3, 0x1E6E3, 0),
460
+ (0x1E6E6, 0x1E6E6, 0),
461
+ (0x1E6EE, 0x1E6EF, 0),
462
+ (0x1E6F5, 0x1E6F5, 0),
463
+ (0x1E8D0, 0x1E8DF, 0),
464
+ (0x1E944, 0x1E94A, 0),
465
+ (0x1F004, 0x1F004, 2),
466
+ (0x1F0CF, 0x1F0CF, 2),
467
+ (0x1F18E, 0x1F18E, 2),
468
+ (0x1F191, 0x1F19A, 2),
469
+ (0x1F200, 0x1F320, 2),
470
+ (0x1F32D, 0x1F335, 2),
471
+ (0x1F337, 0x1F37C, 2),
472
+ (0x1F37E, 0x1F393, 2),
473
+ (0x1F3A0, 0x1F3CA, 2),
474
+ (0x1F3CF, 0x1F3D3, 2),
475
+ (0x1F3E0, 0x1F3F0, 2),
476
+ (0x1F3F4, 0x1F3F4, 2),
477
+ (0x1F3F8, 0x1F43E, 2),
478
+ (0x1F440, 0x1F440, 2),
479
+ (0x1F442, 0x1F4FC, 2),
480
+ (0x1F4FF, 0x1F53D, 2),
481
+ (0x1F54B, 0x1F54E, 2),
482
+ (0x1F550, 0x1F567, 2),
483
+ (0x1F57A, 0x1F57A, 2),
484
+ (0x1F595, 0x1F596, 2),
485
+ (0x1F5A4, 0x1F5A4, 2),
486
+ (0x1F5FB, 0x1F64F, 2),
487
+ (0x1F680, 0x1F6C5, 2),
488
+ (0x1F6CC, 0x1F6CC, 2),
489
+ (0x1F6D0, 0x1F6D2, 2),
490
+ (0x1F6D5, 0x1F6D8, 2),
491
+ (0x1F6DC, 0x1F6DF, 2),
492
+ (0x1F6EB, 0x1F6EC, 2),
493
+ (0x1F6F4, 0x1F6FC, 2),
494
+ (0x1F7E0, 0x1F7FF, 2),
495
+ (0x1F90C, 0x1F93A, 2),
496
+ (0x1F93C, 0x1F945, 2),
497
+ (0x1F947, 0x1F9FF, 2),
498
+ (0x1FA70, 0x1FA8A, 2),
499
+ (0x1FA8E, 0x1FAC6, 2),
500
+ (0x1FAC8, 0x1FAC8, 2),
501
+ (0x1FACD, 0x1FADC, 2),
502
+ (0x1FADF, 0x1FAEA, 2),
503
+ (0x1FAEF, 0x1FAFF, 2),
504
+ (0x20000, 0x3FFFF, 2),
505
+ (0xE0000, 0xEFFFF, 0),
506
+ ];