jkf 0.4.3 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
data/.rubocop_todo.yml CHANGED
@@ -1,11 +1,460 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2016-02-24 04:22:16 +0900 using RuboCop version 0.37.2.
3
+ # on 2022-07-22 12:33:37 UTC using RuboCop version 1.32.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: 30
9
+ # Offense count: 3
10
+ # This cop supports safe autocorrection (--autocorrect).
11
+ # Configuration parameters: TreatCommentsAsGroupSeparators, ConsiderPunctuation, Include.
12
+ # Include: **/*.gemfile, **/Gemfile, **/gems.rb
13
+ Bundler/OrderedGems:
14
+ Exclude:
15
+ - 'Gemfile'
16
+
17
+ # Offense count: 5
18
+ # This cop supports safe autocorrection (--autocorrect).
19
+ Layout/EmptyLineAfterGuardClause:
20
+ Exclude:
21
+ - 'lib/jkf.rb'
22
+ - 'lib/jkf/converter/csa.rb'
23
+ - 'lib/jkf/parser/base.rb'
24
+ - 'lib/jkf/parser/ki2.rb'
25
+ - 'lib/jkf/parser/kif.rb'
26
+
27
+ # Offense count: 1
28
+ # This cop supports safe autocorrection (--autocorrect).
29
+ Layout/EmptyLineAfterMagicComment:
30
+ Exclude:
31
+ - 'jkf.gemspec'
32
+
33
+ # Offense count: 2
34
+ # This cop supports safe autocorrection (--autocorrect).
35
+ # Configuration parameters: AllowMultipleStyles, EnforcedHashRocketStyle, EnforcedColonStyle, EnforcedLastArgumentHashStyle.
36
+ # SupportedHashRocketStyles: key, separator, table
37
+ # SupportedColonStyles: key, separator, table
38
+ # SupportedLastArgumentHashStyles: always_inspect, always_ignore, ignore_implicit, ignore_explicit
39
+ Layout/HashAlignment:
40
+ Exclude:
41
+ - 'spec/jkf/converter/kif_spec.rb'
42
+
43
+ # Offense count: 35
44
+ # This cop supports safe autocorrection (--autocorrect).
45
+ Layout/HeredocIndentation:
46
+ Exclude:
47
+ - 'spec/jkf/converter/kif_spec.rb'
48
+ - 'spec/jkf/parser/csa_spec.rb'
49
+ - 'spec/jkf/parser/ki2_spec.rb'
50
+ - 'spec/jkf/parser/kif_spec.rb'
51
+
52
+ # Offense count: 2
53
+ # This cop supports safe autocorrection (--autocorrect).
54
+ # Configuration parameters: EnforcedStyle.
55
+ # SupportedStyles: symmetrical, new_line, same_line
56
+ Layout/MultilineHashBraceLayout:
57
+ Exclude:
58
+ - 'spec/jkf/parser/ki2_spec.rb'
59
+ - 'spec/jkf/parser/kif_spec.rb'
60
+
61
+ # Offense count: 10
62
+ # This cop supports safe autocorrection (--autocorrect).
63
+ # Configuration parameters: EnforcedStyle.
64
+ # SupportedStyles: require_no_space, require_space
65
+ Layout/SpaceInLambdaLiteral:
66
+ Exclude:
67
+ - 'lib/jkf/parser/csa.rb'
68
+ - 'lib/jkf/parser/ki2.rb'
69
+
70
+ # Offense count: 58
71
+ # This cop supports safe autocorrection (--autocorrect).
72
+ # Configuration parameters: AllowInHeredoc.
73
+ Layout/TrailingWhitespace:
74
+ Exclude:
75
+ - 'lib/jkf/converter/base.rb'
76
+ - 'lib/jkf/parser/kifuable.rb'
77
+ - 'spec/jkf/converter/kif_spec.rb'
78
+ - 'spec/jkf/parser/csa_spec.rb'
79
+ - 'spec/jkf/parser/kif_spec.rb'
80
+
81
+ # Offense count: 2
82
+ # Configuration parameters: AllowSafeAssignment.
83
+ Lint/AssignmentInCondition:
84
+ Exclude:
85
+ - 'lib/jkf/converter/kifuable.rb'
86
+ - 'lib/jkf/parser/base.rb'
87
+
88
+ # Offense count: 22
89
+ # Configuration parameters: IgnoreLiteralBranches, IgnoreConstantBranches.
90
+ Lint/DuplicateBranch:
91
+ Exclude:
92
+ - 'lib/jkf/parser/csa.rb'
93
+ - 'lib/jkf/parser/ki2.rb'
94
+ - 'lib/jkf/parser/kif.rb'
95
+ - 'lib/jkf/parser/kifuable.rb'
96
+
97
+ # Offense count: 2
98
+ # Configuration parameters: AllowKeywordBlockArguments.
99
+ Lint/UnderscorePrefixedVariableName:
100
+ Exclude:
101
+ - 'lib/jkf/parser/kif.rb'
102
+ - 'lib/jkf/parser/kifuable.rb'
103
+
104
+ # Offense count: 1
105
+ # This cop supports safe autocorrection (--autocorrect).
106
+ Lint/UnifiedInteger:
107
+ Exclude:
108
+ - 'lib/jkf/parser/kif.rb'
109
+
110
+ # Offense count: 51
111
+ # Configuration parameters: IgnoredMethods, CountRepeatedAttributes.
10
112
  Metrics/AbcSize:
11
- Max: 127
113
+ Max: 50
114
+
115
+ # Offense count: 13
116
+ # Configuration parameters: CountBlocks.
117
+ Metrics/BlockNesting:
118
+ Max: 8
119
+
120
+ # Offense count: 5
121
+ # Configuration parameters: CountComments, CountAsOne.
122
+ Metrics/ClassLength:
123
+ Max: 738
124
+
125
+ # Offense count: 21
126
+ # Configuration parameters: IgnoredMethods.
127
+ Metrics/CyclomaticComplexity:
128
+ Max: 18
129
+
130
+ # Offense count: 91
131
+ # Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods.
132
+ Metrics/MethodLength:
133
+ Max: 64
134
+
135
+ # Offense count: 2
136
+ # Configuration parameters: CountComments, CountAsOne.
137
+ Metrics/ModuleLength:
138
+ Max: 558
139
+
140
+ # Offense count: 1
141
+ # Configuration parameters: CountKeywordArgs, MaxOptionalParameters.
142
+ Metrics/ParameterLists:
143
+ Max: 6
144
+
145
+ # Offense count: 31
146
+ # Configuration parameters: IgnoredMethods.
147
+ Metrics/PerceivedComplexity:
148
+ Max: 24
149
+
150
+ # Offense count: 1
151
+ Naming/AccessorMethodName:
152
+ Exclude:
153
+ - 'lib/jkf/parser/csa.rb'
154
+
155
+ # Offense count: 34
156
+ # Configuration parameters: ForbiddenDelimiters.
157
+ # ForbiddenDelimiters: (?-mix:(^|\s)(EO[A-Z]{1}|END)(\s|$))
158
+ Naming/HeredocDelimiterNaming:
159
+ Exclude:
160
+ - 'spec/jkf/parser/csa_spec.rb'
161
+ - 'spec/jkf/parser/ki2_spec.rb'
162
+ - 'spec/jkf/parser/kif_spec.rb'
163
+
164
+ # Offense count: 17
165
+ # Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames.
166
+ # AllowedNames: at, by, db, id, in, io, ip, of, on, os, pp, to
167
+ Naming/MethodParameterName:
168
+ Exclude:
169
+ - 'lib/jkf/converter/kif.rb'
170
+ - 'lib/jkf/converter/kifuable.rb'
171
+ - 'lib/jkf/parser/ki2.rb'
172
+ - 'lib/jkf/parser/kif.rb'
173
+ - 'lib/jkf/parser/kifuable.rb'
174
+ - 'spec/spec_helper.rb'
175
+
176
+ # Offense count: 43
177
+ # Configuration parameters: Prefixes.
178
+ # Prefixes: when, with, without
179
+ RSpec/ContextWording:
180
+ Exclude:
181
+ - 'spec/jkf/parser/csa_spec.rb'
182
+ - 'spec/jkf/parser/ki2_spec.rb'
183
+ - 'spec/jkf/parser/kif_spec.rb'
184
+
185
+ # Offense count: 8
186
+ # This cop supports unsafe autocorrection (--autocorrect-all).
187
+ # Configuration parameters: SkipBlocks, EnforcedStyle.
188
+ # SupportedStyles: described_class, explicit
189
+ RSpec/DescribedClass:
190
+ Exclude:
191
+ - 'spec/jkf/converter/csa_spec.rb'
192
+ - 'spec/jkf/converter/ki2_spec.rb'
193
+ - 'spec/jkf/converter/kif_spec.rb'
194
+ - 'spec/jkf/parser/csa_spec.rb'
195
+ - 'spec/jkf/parser/ki2_spec.rb'
196
+ - 'spec/jkf/parser/kif_spec.rb'
197
+ - 'spec/jkf_spec.rb'
198
+
199
+ # Offense count: 45
200
+ # Configuration parameters: CountAsOne.
201
+ RSpec/ExampleLength:
202
+ Max: 51
203
+
204
+ # Offense count: 1
205
+ RSpec/MultipleExpectations:
206
+ Max: 2
207
+
208
+ # Offense count: 1
209
+ # Configuration parameters: AllowSubject.
210
+ RSpec/MultipleMemoizedHelpers:
211
+ Max: 6
212
+
213
+ # Offense count: 48
214
+ # Configuration parameters: IgnoreSharedExamples.
215
+ RSpec/NamedSubject:
216
+ Exclude:
217
+ - 'spec/jkf/converter/kif_spec.rb'
218
+ - 'spec/jkf/parser/csa_spec.rb'
219
+ - 'spec/jkf/parser/ki2_spec.rb'
220
+ - 'spec/jkf/parser/kif_spec.rb'
221
+ - 'spec/jkf_spec.rb'
222
+
223
+ # Offense count: 8
224
+ RSpec/NestedGroups:
225
+ Max: 4
226
+
227
+ # Offense count: 2
228
+ # This cop supports safe autocorrection (--autocorrect).
229
+ # Configuration parameters: EnforcedStyle, ProceduralMethods, FunctionalMethods, IgnoredMethods, AllowBracesOnProceduralOneLiners, BracesRequiredMethods.
230
+ # SupportedStyles: line_count_based, semantic, braces_for_chaining, always_braces
231
+ # ProceduralMethods: benchmark, bm, bmbm, create, each_with_object, measure, new, realtime, tap, with_object
232
+ # FunctionalMethods: let, let!, subject, watch
233
+ # IgnoredMethods: lambda, proc, it
234
+ Style/BlockDelimiters:
235
+ Exclude:
236
+ - 'spec/jkf/converter/kif_spec.rb'
237
+
238
+ # Offense count: 10
239
+ # This cop supports unsafe autocorrection (--autocorrect-all).
240
+ # Configuration parameters: EnforcedStyle.
241
+ # SupportedStyles: nested, compact
242
+ Style/ClassAndModuleChildren:
243
+ Exclude:
244
+ - 'lib/jkf/converter/base.rb'
245
+ - 'lib/jkf/converter/csa.rb'
246
+ - 'lib/jkf/converter/ki2.rb'
247
+ - 'lib/jkf/converter/kif.rb'
248
+ - 'lib/jkf/converter/kifuable.rb'
249
+ - 'lib/jkf/parser/base.rb'
250
+ - 'lib/jkf/parser/csa.rb'
251
+ - 'lib/jkf/parser/ki2.rb'
252
+ - 'lib/jkf/parser/kif.rb'
253
+ - 'lib/jkf/parser/kifuable.rb'
254
+
255
+ # Offense count: 1
256
+ # This cop supports unsafe autocorrection (--autocorrect-all).
257
+ # Configuration parameters: EnforcedStyle.
258
+ # SupportedStyles: allowed_in_returns, forbidden
259
+ Style/DoubleNegation:
260
+ Exclude:
261
+ - 'lib/jkf/parser/kif.rb'
262
+
263
+ # Offense count: 4
264
+ # This cop supports safe autocorrection (--autocorrect).
265
+ Style/Encoding:
266
+ Exclude:
267
+ - 'jkf.gemspec'
268
+ - 'lib/jkf/parser/csa.rb'
269
+ - 'lib/jkf/parser/ki2.rb'
270
+ - 'lib/jkf/parser/kif.rb'
271
+
272
+ # Offense count: 2
273
+ # This cop supports safe autocorrection (--autocorrect).
274
+ Style/ExpandPathArguments:
275
+ Exclude:
276
+ - 'jkf.gemspec'
277
+ - 'spec/spec_helper.rb'
278
+
279
+ # Offense count: 6
280
+ # This cop supports safe autocorrection (--autocorrect).
281
+ # Configuration parameters: EnforcedStyle.
282
+ # SupportedStyles: format, sprintf, percent
283
+ Style/FormatString:
284
+ Exclude:
285
+ - 'lib/jkf/converter/csa.rb'
286
+ - 'lib/jkf/converter/kif.rb'
287
+ - 'lib/jkf/converter/kifuable.rb'
288
+
289
+ # Offense count: 9
290
+ # This cop supports safe autocorrection (--autocorrect).
291
+ # Configuration parameters: MaxUnannotatedPlaceholdersAllowed, IgnoredMethods.
292
+ # SupportedStyles: annotated, template, unannotated
293
+ Style/FormatStringToken:
294
+ EnforcedStyle: unannotated
295
+
296
+ # Offense count: 27
297
+ # This cop supports unsafe autocorrection (--autocorrect-all).
298
+ # Configuration parameters: EnforcedStyle.
299
+ # SupportedStyles: always, always_true, never
300
+ Style/FrozenStringLiteralComment:
301
+ Enabled: false
302
+
303
+ # Offense count: 1
304
+ # Configuration parameters: MinBodyLength, AllowConsecutiveConditionals.
305
+ Style/GuardClause:
306
+ Exclude:
307
+ - 'lib/jkf/parser/base.rb'
308
+
309
+ # Offense count: 3
310
+ # Configuration parameters: MinBranchesCount.
311
+ Style/HashLikeCase:
312
+ Exclude:
313
+ - 'lib/jkf/converter/csa.rb'
314
+ - 'lib/jkf/converter/kif.rb'
315
+ - 'lib/jkf/converter/kifuable.rb'
316
+
317
+ # Offense count: 4
318
+ # This cop supports safe autocorrection (--autocorrect).
319
+ Style/IfUnlessModifier:
320
+ Exclude:
321
+ - 'lib/jkf/converter/csa.rb'
322
+ - 'lib/jkf/parser/kif.rb'
323
+
324
+ # Offense count: 10
325
+ # This cop supports safe autocorrection (--autocorrect).
326
+ # Configuration parameters: EnforcedStyle.
327
+ # SupportedStyles: line_count_dependent, lambda, literal
328
+ Style/Lambda:
329
+ Exclude:
330
+ - 'lib/jkf/parser/csa.rb'
331
+ - 'lib/jkf/parser/ki2.rb'
332
+
333
+ # Offense count: 6
334
+ # This cop supports safe autocorrection (--autocorrect).
335
+ # Configuration parameters: EnforcedStyle.
336
+ # SupportedStyles: both, prefix, postfix
337
+ Style/NegatedIf:
338
+ Exclude:
339
+ - 'lib/jkf/converter/ki2.rb'
340
+ - 'lib/jkf/converter/kif.rb'
341
+ - 'lib/jkf/parser/csa.rb'
342
+ - 'lib/jkf/parser/ki2.rb'
343
+ - 'lib/jkf/parser/kif.rb'
344
+
345
+ # Offense count: 1
346
+ # This cop supports safe autocorrection (--autocorrect).
347
+ # Configuration parameters: EnforcedStyle, MinBodyLength.
348
+ # SupportedStyles: skip_modifier_ifs, always
349
+ Style/Next:
350
+ Exclude:
351
+ - 'lib/jkf/converter/kifuable.rb'
352
+
353
+ # Offense count: 10
354
+ # This cop supports unsafe autocorrection (--autocorrect-all).
355
+ # Configuration parameters: EnforcedStyle, IgnoredMethods.
356
+ # SupportedStyles: predicate, comparison
357
+ Style/NumericPredicate:
358
+ Exclude:
359
+ - 'spec/**/*'
360
+ - 'lib/jkf/converter/csa.rb'
361
+ - 'lib/jkf/converter/ki2.rb'
362
+ - 'lib/jkf/converter/kifuable.rb'
363
+ - 'lib/jkf/parser/base.rb'
364
+ - 'lib/jkf/parser/csa.rb'
365
+
366
+ # Offense count: 3
367
+ # This cop supports safe autocorrection (--autocorrect).
368
+ # Configuration parameters: PreferredDelimiters.
369
+ Style/PercentLiteralDelimiters:
370
+ Exclude:
371
+ - 'Guardfile'
372
+ - 'lib/jkf/parser/kifuable.rb'
373
+
374
+ # Offense count: 5
375
+ # This cop supports safe autocorrection (--autocorrect).
376
+ Style/RedundantAssignment:
377
+ Exclude:
378
+ - 'lib/jkf/parser/csa.rb'
379
+ - 'lib/jkf/parser/ki2.rb'
380
+ - 'lib/jkf/parser/kif.rb'
381
+
382
+ # Offense count: 1
383
+ # This cop supports safe autocorrection (--autocorrect).
384
+ # Configuration parameters: AllowMultipleReturnValues.
385
+ Style/RedundantReturn:
386
+ Exclude:
387
+ - 'lib/jkf/parser/base.rb'
388
+
389
+ # Offense count: 1
390
+ # This cop supports safe autocorrection (--autocorrect).
391
+ # Configuration parameters: EnforcedStyle, AllowInnerSlashes.
392
+ # SupportedStyles: slashes, percent_r, mixed
393
+ Style/RegexpLiteral:
394
+ Exclude:
395
+ - 'Guardfile'
396
+
397
+ # Offense count: 1
398
+ # This cop supports safe autocorrection (--autocorrect).
399
+ # Configuration parameters: EnforcedStyle.
400
+ # SupportedStyles: implicit, explicit
401
+ Style/RescueStandardError:
402
+ Exclude:
403
+ - 'lib/jkf.rb'
404
+
405
+ # Offense count: 2
406
+ # This cop supports unsafe autocorrection (--autocorrect-all).
407
+ # Configuration parameters: ConvertCodeThatCanStartToReturnNil, AllowedMethods, MaxChainLength.
408
+ # AllowedMethods: present?, blank?, presence, try, try!
409
+ Style/SafeNavigation:
410
+ Exclude:
411
+ - 'lib/jkf/converter/kifuable.rb'
412
+ - 'lib/jkf/parser/kif.rb'
413
+
414
+ # Offense count: 1
415
+ # This cop supports safe autocorrection (--autocorrect).
416
+ # Configuration parameters: AllowIfMethodIsEmpty.
417
+ Style/SingleLineMethods:
418
+ Exclude:
419
+ - 'lib/jkf/parser/base.rb'
420
+
421
+ # Offense count: 4
422
+ # This cop supports unsafe autocorrection (--autocorrect-all).
423
+ Style/SlicingWithRange:
424
+ Exclude:
425
+ - 'lib/jkf/parser/ki2.rb'
426
+ - 'lib/jkf/parser/kif.rb'
427
+
428
+ # Offense count: 14
429
+ # This cop supports unsafe autocorrection (--autocorrect-all).
430
+ # Configuration parameters: Mode.
431
+ Style/StringConcatenation:
432
+ Exclude:
433
+ - 'lib/jkf/converter/csa.rb'
434
+ - 'lib/jkf/converter/ki2.rb'
435
+ - 'lib/jkf/converter/kif.rb'
436
+ - 'lib/jkf/converter/kifuable.rb'
437
+ - 'lib/jkf/parser/kif.rb'
438
+ - 'spec/jkf/converter/csa_spec.rb'
439
+
440
+ # Offense count: 4001
441
+ # This cop supports safe autocorrection (--autocorrect).
442
+ # Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline.
443
+ # SupportedStyles: single_quotes, double_quotes
444
+ Style/StringLiterals:
445
+ Enabled: false
446
+
447
+ # Offense count: 5
448
+ # This cop supports safe autocorrection (--autocorrect).
449
+ # Configuration parameters: WordRegex.
450
+ # SupportedStyles: percent, brackets
451
+ Style/WordArray:
452
+ EnforcedStyle: percent
453
+ MinSize: 3
454
+
455
+ # Offense count: 16
456
+ # This cop supports safe autocorrection (--autocorrect).
457
+ # Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns, IgnoredPatterns.
458
+ # URISchemes: http, https
459
+ Layout/LineLength:
460
+ Max: 122
data/CHANGELOG.md ADDED
@@ -0,0 +1,46 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [Unreleased]
9
+
10
+ ## [0.5.0] - 2023-06-18
11
+
12
+ ### Changed
13
+
14
+ * Set required Ruby version to 2.7; this will be updated to 3.0 or
15
+ later in the next release.
16
+
17
+ ### Fixed
18
+
19
+ * Remove `Fixnum` usage with integrated `Integer` for Ruby 3.2 or
20
+ later.
21
+
22
+ ### Others
23
+
24
+ * Remove Rake version constraint
25
+ * Support development on Guix
26
+ * Enable RubyGems MFA required to true (for maintainers)
27
+
28
+ Documents:
29
+
30
+ * Fixed readme usages
31
+ * Update English readme; introduce translation management
32
+ * Update readme links about CI or code coverage services
33
+
34
+ CI:
35
+
36
+ * Migrate CI from Travis CI to GitHub Actions
37
+ * Migrate from Code Climate to SimpleCov
38
+
39
+ Lint tool:
40
+
41
+ * Update RuboCop versin and config
42
+ * Lint source codes with RuboCop
43
+
44
+ and,
45
+
46
+ * Add this changelog
data/Gemfile CHANGED
@@ -2,18 +2,20 @@ source "https://rubygems.org"
2
2
 
3
3
  gemspec
4
4
 
5
- gem "rake", "~> 10.0"
5
+ gem "rake"
6
6
 
7
7
  group :development do
8
8
  gem "yard", require: false
9
9
  gem "redcarpet", require: false
10
10
 
11
- gem "rubocop", "~> 0.37.2", require: false
11
+ gem "rubocop", "~> 1.32.0", require: false
12
12
  gem "guard-rubocop", require: false
13
+ gem "rubocop-rake", "~> 0.6.0", require: false
14
+ gem "rubocop-rspec", "~> 2.12", require: false
13
15
  end
14
16
 
15
17
  group :test do
16
- gem "codeclimate-test-reporter", require: nil
17
18
  gem "rspec", "~> 3.0", require: false
18
19
  gem "guard-rspec", require: false
20
+ gem "simplecov", require: false
19
21
  end
data/README.en.md CHANGED
@@ -1,32 +1,39 @@
1
1
  # Jkf
2
- [![Gem Version](https://badge.fury.io/rb/jkf.svg)](https://badge.fury.io/rb/jkf) [![Build Status](https://travis-ci.org/iyuuya/jkf.svg?branch=master)](https://travis-ci.org/iyuuya/jkf) [![Code Climate](https://codeclimate.com/github/iyuuya/jkf/badges/gpa.svg)](https://codeclimate.com/github/iyuuya/jkf) [![Test Coverage](https://codeclimate.com/github/iyuuya/jkf/badges/coverage.svg)](https://codeclimate.com/github/iyuuya/jkf/coverage) [![Inline docs](http://inch-ci.org/github/iyuuya/jkf.svg?branch=develop)](http://inch-ci.org/github/iyuuya/jkf)
3
-
4
-
5
- jkf is json-kifu-format( https://github.com/na2hiro/json-kifu-format ) library for ruby.
6
-
7
- ### Feature
8
-
9
- * KIF, KI2, CSA to JKF
10
- * JKF to KIF, KI2, CSA
2
+ [![Gem
3
+ Version](https://badge.fury.io/rb/jkf.svg)](https://badge.fury.io/rb/jkf)
4
+ [![Build
5
+ Status](https://travis-ci.org/iyuuya/jkf.svg?branch=master)](https://travis-ci.org/iyuuya/jkf)
6
+ [![CI](https://github.com/iyuuya/jkf/actions/workflows/ci.yml/badge.svg)](https://github.com/iyuuya/jkf/actions/workflows/ci.yml)
7
+ [![Inline
8
+ docs](http://inch-ci.org/github/iyuuya/jkf.svg?branch=develop)](http://inch-ci.org/github/iyuuya/jkf)
9
+
10
+ jkf is a Ruby port of
11
+ [json-kifu-format](https://github.com/na2hiro/json-kifu-format).
12
+ It supports both of the conversion from KIF, KI2, or CSA to jkf, and the one
13
+ from jkf to KIF, KI2, or CSA.
11
14
 
12
15
  ## Installation
13
16
 
14
- Add this line to your application's Gemfile:
17
+ If you install this gem to your application (with Bundler), add this to
18
+ Gemfile.
15
19
 
16
20
  ```ruby
17
21
  gem 'jkf'
18
22
  ```
19
23
 
20
- And then execute:
24
+ Then run bundle to install this gem.
21
25
 
22
26
  $ bundle
23
27
 
24
- Or install it yourself as:
28
+ Or directly install with gem install command.
25
29
 
26
30
  $ gem install jkf
27
31
 
28
32
  ## Usage
29
33
 
34
+ This gem has the Parser and the Converter for each formats: KIF, KI2, and
35
+ CSA.
36
+
30
37
  ```ruby
31
38
  kif_parser = Jkf::Parser::Kif.new
32
39
  ki2_parser = Jkf::Parser::Ki2.new
@@ -39,6 +46,9 @@ ki2_converter = Jkf::Converter::Ki2.new
39
46
  csa_converter = Jkf::Converter::Csa.new
40
47
  ```
41
48
 
49
+ `parser#parse(str)` to convert into jkf.
50
+ `#convert(jkf)` to convert into each formats from jkf.
51
+
42
52
  ```ruby
43
53
  jkf = kif_parser.parse(kif_str) #=> Hash
44
54
  jkf = ki2_parser.parse(ki2_str) #=> Hash
@@ -46,16 +56,20 @@ jkf = csa_parser.parse(csa_str) #=> Hash
46
56
  ```
47
57
 
48
58
  ```ruby
49
- kif = kif_converter.parse(jkf) #=> String
50
- ki2 = ki2_converter.parse(jkf) #=> String
51
- csa = csa_converter.parse(jkf) #=> String
59
+ kif = kif_converter.convert(jkf) #=> String
60
+ ki2 = ki2_converter.convert(jkf) #=> String
61
+ csa = csa_converter.convert(jkf) #=> String
52
62
  ```
53
63
 
54
64
  ## Contributing
55
65
 
56
- Bug reports and pull requests are welcome on GitHub at https://github.com/iyuuya/jkf.
66
+ Feel free to report bugs or send pull requests at
67
+ [GitHub](https://github.com/iyuuya/jkf).
68
+
69
+ If you work on Guix, run tests by `guix shell`.
57
70
 
58
71
  ## License
59
72
 
60
- The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
73
+ This gem is licensed under the [MIT
74
+ License](http://opensource.org/licenses/MIT).
61
75
 
data/README.md CHANGED
@@ -1,5 +1,5 @@
1
1
  # Jkf
2
- [![Gem Version](https://badge.fury.io/rb/jkf.svg)](https://badge.fury.io/rb/jkf) [![Build Status](https://travis-ci.org/iyuuya/jkf.svg?branch=master)](https://travis-ci.org/iyuuya/jkf) [![Code Climate](https://codeclimate.com/github/iyuuya/jkf/badges/gpa.svg)](https://codeclimate.com/github/iyuuya/jkf) [![Test Coverage](https://codeclimate.com/github/iyuuya/jkf/badges/coverage.svg)](https://codeclimate.com/github/iyuuya/jkf/coverage) [![Inline docs](http://inch-ci.org/github/iyuuya/jkf.svg?branch=develop)](http://inch-ci.org/github/iyuuya/jkf)
2
+ [![Gem Version](https://badge.fury.io/rb/jkf.svg)](https://badge.fury.io/rb/jkf) [![Build Status](https://travis-ci.org/iyuuya/jkf.svg?branch=master)](https://travis-ci.org/iyuuya/jkf) [![CI](https://github.com/iyuuya/jkf/actions/workflows/ci.yml/badge.svg)](https://github.com/iyuuya/jkf/actions/workflows/ci.yml) [![Inline docs](http://inch-ci.org/github/iyuuya/jkf.svg?branch=develop)](http://inch-ci.org/github/iyuuya/jkf)
3
3
 
4
4
  jkfはJSON棋譜フォーマット( https://github.com/na2hiro/json-kifu-format )をRubyに移植したものです。
5
5
  KIF, KI2, CSAをパースしJKFへ変換、JKFからKIF, KI2, CSAへの変換に対応しています。
@@ -45,9 +45,9 @@ jkf = csa_parser.parse(csa_str) #=> Hash
45
45
  ```
46
46
 
47
47
  ```ruby
48
- kif = kif_converter.parse(jkf) #=> String
49
- ki2 = ki2_converter.parse(jkf) #=> String
50
- csa = csa_converter.parse(jkf) #=> String
48
+ kif = kif_converter.convert(jkf) #=> String
49
+ ki2 = ki2_converter.convert(jkf) #=> String
50
+ csa = csa_converter.convert(jkf) #=> String
51
51
  ```
52
52
 
53
53
  ## Contributing
@@ -55,6 +55,8 @@ csa = csa_converter.parse(jkf) #=> String
55
55
  バグレポートやプルリクエストはGithubでよろしくお願いします。
56
56
  https://github.com/iyuuya/jkf.
57
57
 
58
+ Guixで開発されている場合は`guix shell`で`rake test`によるテスト実行ができます。
59
+
58
60
  ## License
59
61
 
60
62
  ライセンスはMITです。
data/Rakefile CHANGED
@@ -4,3 +4,8 @@ require "rspec/core/rake_task"
4
4
  RSpec::Core::RakeTask.new(:spec)
5
5
 
6
6
  task default: :spec
7
+
8
+ desc "translate documents"
9
+ task :translate do
10
+ sh "po4a po4a.cfg"
11
+ end
data/jkf.gemspec CHANGED
@@ -14,8 +14,11 @@ Gem::Specification.new do |spec|
14
14
  spec.homepage = "https://github.com/iyuuya/jkf"
15
15
  spec.license = "MIT"
16
16
 
17
+ spec.required_ruby_version = '>= 2.7'
18
+
17
19
  spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
18
20
  spec.bindir = "exe"
19
21
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
22
  spec.require_paths = ["lib"]
23
+ spec.metadata['rubygems_mfa_required'] = 'true'
21
24
  end
@@ -90,7 +90,7 @@ module Jkf::Converter
90
90
  end
91
91
 
92
92
  def convert_time(time)
93
- sec = time["now"]["m"] * 60 + time["now"]["s"]
93
+ sec = (time["now"]["m"] * 60) + time["now"]["s"]
94
94
  "T#{sec}\n"
95
95
  end
96
96
 
@@ -110,7 +110,7 @@ module Jkf::Converter
110
110
  def ljust(str, n)
111
111
  len = 0
112
112
  str.each_codepoint { |codepoint| len += codepoint > 255 ? 2 : 1 }
113
- str + " " * (n - len)
113
+ str + (" " * (n - len))
114
114
  end
115
115
 
116
116
  def pos2str(pos)