Skip to content

Commit

Permalink
feat: v2.1.0, attempt to fix waa edge-case, upgrade dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
jeroen-meijer committed Sep 23, 2024
1 parent afd454d commit b4fea23
Show file tree
Hide file tree
Showing 24 changed files with 1,574 additions and 1,527 deletions.
3 changes: 3 additions & 0 deletions .fvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"flutter": "3.24.1"
}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,6 @@ build/
**/coverage/
**/coverage_badge.svg
**/.test_coverage.dart

# FVM
.fvm/
80 changes: 39 additions & 41 deletions .mergify.yml
Original file line number Diff line number Diff line change
@@ -1,45 +1,43 @@
pull_request_rules:
- name: "Assign author"
conditions: []
actions:
assign:
users:
- "{{author}}"
- name: 'Assign author'
conditions: []
actions:
assign:
users:
- '{{author}}'

# Merge flow for contributors
- name: "Request review"
conditions:
- "author!=jeroen-meijer"
actions:
request_reviews:
users:
- "jeroen-meijer"
- name: "Merge when CI passes & has one approval"
conditions:
- "author!=jeroen-meijer"
- "label!=wip"
- "status-success~=kana_kit"
- "#approved-reviews-by>=1"
actions:
merge:
method: squash
strict: smart
commit_message: default
# Merge flow for contributors
- name: 'Request review'
conditions:
- 'author!=jeroen-meijer'
actions:
request_reviews:
users:
- 'jeroen-meijer'
- name: 'Merge when CI passes & has one approval'
conditions:
- 'author!=jeroen-meijer'
- 'label!=wip'
- 'status-success~=kana_kit'
- '#approved-reviews-by>=1'
actions:
merge:
method: squash
commit_message: default

# Merge flow for non-contributors
- name: "Merge when CI passes"
conditions:
- "author=jeroen-meijer"
- "label!=wip"
- "status-success~=kana_kit"
actions:
merge:
method: squash
strict: smart
commit_message: default
# Merge flow for non-contributors
- name: 'Merge when CI passes'
conditions:
- 'author=jeroen-meijer'
- 'label!=wip'
- 'status-success~=kana_kit'
actions:
merge:
method: squash
commit_message: default

- name: Delete branch post merge
conditions:
- merged
actions:
delete_head_branch: {}
- name: Delete branch post merge
conditions:
- merged
actions:
delete_head_branch: {}
10 changes: 0 additions & 10 deletions .metadata

This file was deleted.

5 changes: 3 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@
"mkdir",
"toukyou",
"zenkaku"
]
}
],
"dart.flutterSdkPath": ".fvm/versions/3.24.1"
}
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
## 2.0.0

- Fix シークヮーサー and シマウヮー conversion edge-cases (thanks to @Moseco and @HighLiuk)
- Change minimum required Dart version to `2.12.0`.
- Add CSpell spell checking config.
- Remove `package:equatable` dependency.
- Upgrade dependencies.
- Upgrade all dev dependencies and linter.

## 2.0.0

- Add NNBD support.
- Change minimum required Dart version to `2.12.0`.
- Change linter to `package:very_good_analysis`.
Expand Down
18 changes: 0 additions & 18 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -1,19 +1 @@
include: package:very_good_analysis/analysis_options.yaml
# linter:
# rules:
# await_only_futures: true
# prefer_const_constructors: true
# prefer_const_literals_to_create_immutables: true
# prefer_relative_imports: false
# prefer_single_quotes: true
# public_member_api_docs: true
# sort_child_properties_last: true
# sort_constructors_first: true
# unawaited_futures: true
# analyzer:
# strong-mode:
# implicit-casts: false
# errors:
# close_sinks: ignore
# exclude:
# - '**/.test_coverage.dart'
8 changes: 4 additions & 4 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
codecov:
require_ci_to_pass: true

coverage:
precision: 3
range: "99...100"
range: '99...100'

ignore:
- "**/*.g.dart"
- "lib/src/models/romanization/**"
- '**/*.g.dart'
- 'lib/src/models/romanization/**'
19 changes: 19 additions & 0 deletions cspell.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
ignoreWords:
- transform
words:
- codecov
- hankaku
- hepburn
- HighLiuk
- hira
- initializers
- japanese
- Moseco
- NNBD
- Ōsaka
- pubspec
- romaji
- Tōkyō
- unicode
- zenkaku
- Zenkaku
23 changes: 16 additions & 7 deletions lib/kana_kit.dart
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class KanaKit {
/// isRomaji('a!b&cーd'); // false (zenkaku punctuation is not allowed)
/// ```
bool isRomaji(String input) {
assert(input.isNotEmpty);
assert(input.isNotEmpty, 'input cannot be empty');

return input.chars.every(_isCharRomaji);
}
Expand All @@ -68,7 +68,7 @@ class KanaKit {
/// isJapanese('A泣き虫'); // false
/// ```
bool isJapanese(String input) {
assert(input.isNotEmpty);
assert(input.isNotEmpty, 'input cannot be empty');

return input.chars.every(_isCharJapanese);
}
Expand All @@ -85,7 +85,7 @@ class KanaKit {
/// isKana('あAア'); // false
/// ```
bool isKana(String input) {
assert(input.isNotEmpty);
assert(input.isNotEmpty, 'input cannot be empty');

return input.chars.every(_isCharKana);
}
Expand All @@ -100,7 +100,7 @@ class KanaKit {
/// isHiragana('あア'); // false
/// ```
bool isHiragana(String input) {
assert(input.isNotEmpty);
assert(input.isNotEmpty, 'input cannot be empty');

return input.chars.every(_isCharHiragana);
}
Expand All @@ -116,7 +116,7 @@ class KanaKit {
/// isKatakana('あア'); // false
/// ```
bool isKatakana(String input) {
assert(input.isNotEmpty);
assert(input.isNotEmpty, 'input cannot be empty');

return input.chars.every(_isCharKatakana);
}
Expand All @@ -133,7 +133,7 @@ class KanaKit {
/// isKanji('🐸'); // false
/// ```
bool isKanji(String input) {
assert(input.isNotEmpty);
assert(input.isNotEmpty, 'input cannot be empty');

return input.chars.every(_isCharKanji);
}
Expand All @@ -153,12 +153,17 @@ class KanaKit {
/// isMixed('あア'); // false
/// ```
bool isMixed(String input) {
assert(input.isNotEmpty);
assert(input.isNotEmpty, 'input cannot be empty');

final chars = input.chars;

final hasRomaji = chars.any(_isCharRomaji);
final hasKana = chars.any(_isCharHiragana) || chars.any(_isCharKatakana);

// FIXME: This can be simplified but I can't get my brain
// to do it right now.

// ignore: avoid_bool_literals_in_conditional_expressions
final hasKanji = !(!config.passKanji ? chars.any(_isCharKanji) : false);

return hasKana && hasRomaji && hasKanji;
Expand All @@ -173,6 +178,7 @@ class KanaKit {
/// characters will be converted to uppercase characters.
/// ignored.
///
// cspell: disable
/// ```dart
/// // With KanaKitConfig.upcaseKatakana == false (default)
/// toRomaji('ひらがな カタカナ'); // "hiragana katakana"
Expand All @@ -181,6 +187,7 @@ class KanaKit {
/// toRomaji('ひらがな カタカナ'); // "hiragana KATAKANA"
/// toRomaji('げーむ ゲーム'); // "ge-mu GEEMU"
/// ```
// cspell: enable
String toRomaji(String input) {
if (input.isEmpty) {
return input;
Expand Down Expand Up @@ -218,13 +225,15 @@ class KanaKit {
/// The [input] `String` cannot be null. If an empty `String` is provided,
/// an empty `String` will be returned immediately.
///
// cspell: disable
/// ```dart
/// toKana('onaji BUTTSUUJI'); // "おなじ ブッツウジ"
/// toKana('ONAJI buttsuuji'); // "オナジ ぶっつうじ"
/// toKana('座禅‘zazen’スタイル'); // "座禅「ざぜん」スタイル"
/// toKana('batsuge-mu'); // "ばつげーむ"
/// toKana('!?.:/,~-‘’“”[](){}'); // "!?。:・、〜ー「」『』[](){}"
/// ```
// cspell: enable
String toKana(String input) {
if (input.isEmpty) {
return input;
Expand Down
Loading

0 comments on commit b4fea23

Please sign in to comment.