Skip to content

Commit eea7268

Browse files
committed
chore: rubocop
1 parent 789c76c commit eea7268

File tree

12 files changed

+213
-17
lines changed

12 files changed

+213
-17
lines changed

.rubocop_todo.yml

Lines changed: 189 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,189 @@
1+
# This configuration was generated by
2+
# `rubocop --auto-gen-config`
3+
# on 2026-03-24 03:26:08 UTC using RuboCop version 1.86.0.
4+
# The point is for the user to remove these configuration records
5+
# one by one as the offenses are removed from the code base.
6+
# Note that changes in the inspected code, or installation of new
7+
# versions of RuboCop, may require this file to be generated again.
8+
9+
# Offense count: 1
10+
# This cop supports safe autocorrection (--autocorrect).
11+
Gemspec/RequireMFA:
12+
Exclude:
13+
- 'termium.gemspec'
14+
15+
# Offense count: 1
16+
Gemspec/RequiredRubyVersion:
17+
Exclude:
18+
- 'termium.gemspec'
19+
20+
# Offense count: 1
21+
# This cop supports safe autocorrection (--autocorrect).
22+
# Configuration parameters: IndentationWidth.
23+
Layout/AssignmentIndentation:
24+
Exclude:
25+
- 'lib/termium/cli.rb'
26+
27+
# Offense count: 1
28+
# This cop supports safe autocorrection (--autocorrect).
29+
# Configuration parameters: EnforcedStyle.
30+
# SupportedStyles: empty_lines, no_empty_lines
31+
Layout/EmptyLinesAroundBlockBody:
32+
Exclude:
33+
- 'spec/termium_spec.rb'
34+
35+
# Offense count: 1
36+
# This cop supports safe autocorrection (--autocorrect).
37+
# Configuration parameters: EnforcedStyle.
38+
# SupportedStyles: empty_lines, empty_lines_except_namespace, empty_lines_special, no_empty_lines
39+
Layout/EmptyLinesAroundModuleBody:
40+
Exclude:
41+
- 'lib/termium.rb'
42+
43+
# Offense count: 1
44+
# This cop supports safe autocorrection (--autocorrect).
45+
# Configuration parameters: AllowMultipleStyles, EnforcedHashRocketStyle, EnforcedColonStyle, EnforcedLastArgumentHashStyle.
46+
# SupportedHashRocketStyles: key, separator, table
47+
# SupportedColonStyles: key, separator, table
48+
# SupportedLastArgumentHashStyles: always_inspect, always_ignore, ignore_implicit, ignore_explicit
49+
Layout/HashAlignment:
50+
Exclude:
51+
- 'lib/termium/cli.rb'
52+
53+
# Offense count: 1
54+
# This cop supports safe autocorrection (--autocorrect).
55+
# Configuration parameters: EnforcedStyle.
56+
# SupportedStyles: normal, indented_internal_methods
57+
Layout/IndentationConsistency:
58+
Exclude:
59+
- 'termium.gemspec'
60+
61+
# Offense count: 1
62+
# This cop supports safe autocorrection (--autocorrect).
63+
# Configuration parameters: AllowDoxygenCommentStyle, AllowGemfileRubyComment, AllowRBSInlineAnnotation, AllowSteepAnnotation.
64+
Layout/LeadingCommentSpace:
65+
Exclude:
66+
- 'Rakefile'
67+
68+
# Offense count: 15
69+
# This cop supports safe autocorrection (--autocorrect).
70+
# Configuration parameters: Max, AllowHeredoc, AllowURI, AllowQualifiedName, URISchemes, AllowRBSInlineAnnotation, AllowCopDirectives, AllowedPatterns, SplitStrings.
71+
# URISchemes: http, https
72+
Layout/LineLength:
73+
Exclude:
74+
- 'lib/termium/cli.rb'
75+
- 'lib/termium/core.rb'
76+
- 'lib/termium/language_module.rb'
77+
- 'lib/termium/subject.rb'
78+
- 'lib/termium/textual_support.rb'
79+
- 'spec/termium_spec.rb'
80+
- 'termium.gemspec'
81+
82+
# Offense count: 1
83+
# This cop supports safe autocorrection (--autocorrect).
84+
# Configuration parameters: EnforcedStyle.
85+
# SupportedStyles: final_newline, final_blank_line
86+
Layout/TrailingEmptyLines:
87+
Exclude:
88+
- 'lib/termium.rb'
89+
90+
# Offense count: 2
91+
# This cop supports safe autocorrection (--autocorrect).
92+
# Configuration parameters: AllowInHeredoc.
93+
Layout/TrailingWhitespace:
94+
Exclude:
95+
- 'lib/termium/cli.rb'
96+
97+
# Offense count: 3
98+
# Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes, Max.
99+
Metrics/AbcSize:
100+
Exclude:
101+
- 'lib/termium/cli.rb'
102+
- 'lib/termium/core.rb'
103+
- 'lib/termium/entry_term.rb'
104+
105+
# Offense count: 4
106+
# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
107+
Metrics/MethodLength:
108+
Max: 23
109+
110+
# Offense count: 2
111+
# Configuration parameters: Mode, AllowedMethods, AllowedPatterns, AllowBangMethods, WaywardPredicates.
112+
# AllowedMethods: call
113+
# WaywardPredicates: infinite?, nonzero?
114+
Naming/PredicateMethod:
115+
Exclude:
116+
- 'lib/termium/abbreviation.rb'
117+
- 'lib/termium/entry_term.rb'
118+
119+
# Offense count: 4
120+
# Configuration parameters: NamePrefix, ForbiddenPrefixes, AllowedMethods, MethodDefinitionMacros, UseSorbetSigs.
121+
# NamePrefix: is_, has_, have_, does_
122+
# ForbiddenPrefixes: is_, has_, have_, does_
123+
# AllowedMethods: is_a?
124+
# MethodDefinitionMacros: define_method, define_singleton_method
125+
Naming/PredicatePrefix:
126+
Exclude:
127+
- 'lib/termium/textual_support.rb'
128+
129+
# Offense count: 4
130+
# This cop supports safe autocorrection (--autocorrect).
131+
RSpec/EmptyLineAfterFinalLet:
132+
Exclude:
133+
- 'spec/termium/extract_spec.rb'
134+
- 'spec/termium_spec.rb'
135+
136+
# Offense count: 1
137+
# Configuration parameters: CountAsOne.
138+
RSpec/ExampleLength:
139+
Max: 8
140+
141+
# Offense count: 1
142+
# Configuration parameters: AllowedPatterns.
143+
# AllowedPatterns: ^expect_, ^assert_
144+
RSpec/NoExpectationExample:
145+
Exclude:
146+
- 'spec/termium_spec.rb'
147+
148+
# Offense count: 2
149+
# This cop supports unsafe autocorrection (--autocorrect-all).
150+
Security/IoMethods:
151+
Exclude:
152+
- 'lib/termium/cli.rb'
153+
- 'spec/termium_spec.rb'
154+
155+
# Offense count: 1
156+
Style/ItAssignment:
157+
Exclude:
158+
- 'spec/spec_helper.rb'
159+
160+
# Offense count: 4
161+
# This cop supports safe autocorrection (--autocorrect).
162+
Style/RedundantFreeze:
163+
Exclude:
164+
- 'lib/termium/source.rb'
165+
- 'lib/termium/textual_support.rb'
166+
167+
# Offense count: 2
168+
# This cop supports safe autocorrection (--autocorrect).
169+
# Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline.
170+
# SupportedStyles: single_quotes, double_quotes
171+
Style/StringLiterals:
172+
Exclude:
173+
- 'termium.gemspec'
174+
175+
# Offense count: 1
176+
# This cop supports safe autocorrection (--autocorrect).
177+
# Configuration parameters: EnforcedStyleForMultiline.
178+
# SupportedStylesForMultiline: comma, consistent_comma, diff_comma, no_comma
179+
Style/TrailingCommaInArguments:
180+
Exclude:
181+
- 'spec/support/shared_examples.rb'
182+
183+
# Offense count: 2
184+
# This cop supports safe autocorrection (--autocorrect).
185+
# Configuration parameters: EnforcedStyleForMultiline.
186+
# SupportedStylesForMultiline: comma, consistent_comma, diff_comma, no_comma
187+
Style/TrailingCommaInHashLiteral:
188+
Exclude:
189+
- 'lib/termium/designation_operations.rb'

Gemfile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ gemspec
77
gem "canon"
88
gem "lutaml-model", github: "lutaml/lutaml-model", ref: "main"
99
gem "rake", "~> 13.0"
10-
gem "rspec", "~> 3.11"
10+
gem "rspec"
1111
gem "rubocop"
12-
gem "rubocop-performance", "~> 1.21", ">= 1.21.1"
12+
gem "rubocop-performance"
13+
gem "rubocop-rake"
14+
gem "rubocop-rspec"

Rakefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ RSpec::Core::RakeTask.new(:spec)
88
# require "rubocop/rake_task"
99
# RuboCop::RakeTask.new
1010

11-
task default: %i[spec] #rubocop
11+
task default: %i[spec] # rubocop

lib/termium.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,4 @@ class Error < StandardError; end
2020
autoload :Subject, "termium/subject"
2121
autoload :TextualSupport, "termium/textual_support"
2222
autoload :UniversalEntry, "termium/universal_entry"
23-
24-
end
23+
end

lib/termium/cli.rb

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ module Termium
77
class Cli < Thor
88
desc "convert", "Convert TERMIUM entries into a Glossarist dataset"
99

10-
option :input_file, aliases: :i, required: true, desc: "Path to TERMIUM Plus XML extract"
10+
option :input_file, aliases: :i, required: true,
11+
desc: "Path to TERMIUM Plus XML extract"
1112
option :output_file, aliases: :o, desc: "Output file path"
1213
option :date_accepted, desc: "Date of acceptance for the dataset"
1314

@@ -46,14 +47,15 @@ def convert
4647
input_path = input_file_as_path(options[:input_file])
4748

4849
puts "Reading TERMIUM export file: #{input_path.relative_path_from(Dir.pwd)}"
49-
termium_extract = Termium::Extract.from_xml(IO.read(input_path.expand_path))
50+
termium_extract = Termium::Extract.from_xml(File.read(input_path.expand_path))
5051

5152
puts "Size of TERMIUM dataset: #{termium_extract.core.size}"
5253

5354
puts "Converting to Glossarist..."
5455
convert_options = {}
5556
if options[:date_accepted]
56-
convert_options[:date_accepted] = Date.parse(options[:date_accepted]).iso8601
57+
convert_options[:date_accepted] =
58+
Date.parse(options[:date_accepted]).iso8601
5759
end
5860
glossarist_col = termium_extract.to_concept(convert_options)
5961
# pp glossarist_col.first

lib/termium/designation_operations.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ module DesignationOperations
66
PART_OF_SPEECH_CODE_MAPPING = {
77
"ADJ" => "adj",
88
"N" => "noun",
9-
"V" => "verb"
9+
"V" => "verb",
1010
}.freeze
1111
def part_of_speech
1212
value = parameter.detect do |x|
@@ -19,7 +19,7 @@ def part_of_speech
1919
GENDER_CODE_MAPPING = {
2020
"F" => "f",
2121
"M" => "m",
22-
"EPI" => "c" # this means "Epicine"
22+
"EPI" => "c", # this means "Epicine"
2323
}.freeze
2424
def gender
2525
value = parameter.detect do |x|

lib/termium/source.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
module Termium
44
# For <source>
55
class Source < Lutaml::Model::Serializable
6-
ISO_BIB_REGEX = /\AISO-([\d-]+)\s+\*\s+(\d{4})\s+.*/.freeze
7-
ISOIEC_BIB_REGEX = /\AISO-IEC-([\d-]+)\s+\*\s+(\d{4})\s+.*/.freeze
6+
ISO_BIB_REGEX = /\AISO-([\d-]+)\s+\*\s+(\d{4})\s+.*/
7+
ISOIEC_BIB_REGEX = /\AISO-IEC-([\d-]+)\s+\*\s+(\d{4})\s+.*/
88

99
attribute :order, :integer
1010
attribute :details, :string

lib/termium/textual_support.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def value_typed
2929
end
3030
end
3131

32-
EXAMPLE_REGEX = /\AEx[ea]mples?\s*:\s*/.freeze
32+
EXAMPLE_REGEX = /\AEx[ea]mples?\s*:\s*/
3333

3434
def is_example?
3535
value_cleaned.match(EXAMPLE_REGEX)
@@ -51,7 +51,7 @@ def value_example
5151
value_cleaned.gsub(EXAMPLE_REGEX, "")
5252
end
5353

54-
DEFINITION_REGEX = /\A<(.+?)>\s*/.freeze
54+
DEFINITION_REGEX = /\A<(.+?)>\s*/
5555

5656
def value_definition
5757
value_cleaned.gsub(DEFINITION_REGEX, "")

spec/support/shared_examples.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
output = serialized.to_xml(
99
prefix: true,
1010
declaration: true,
11-
encoding: "utf-8"
11+
encoding: "utf-8",
1212
)
1313

1414
expect(output).to be_xml_equivalent_to(input)

spec/termium/extract_spec.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,19 @@
33
RSpec.describe Termium::Extract do
44
context "with ISO-IEC_2382.xml" do
55
let(:fixture) { file_fixture("ISO-IEC_2382.xml") }
6+
67
it_behaves_like "a serializer"
78
end
89

910
context "with Characters.xml" do
1011
let(:fixture) { file_fixture("Characters.xml") }
12+
1113
it_behaves_like "a serializer"
1214
end
1315

1416
context "with Figures.xml" do
1517
let(:fixture) { file_fixture("Figures.xml") }
18+
1619
it_behaves_like "a serializer"
1720
end
1821
end

0 commit comments

Comments
 (0)