Skip to content

Commit a386884

Browse files
authored
Merge pull request #24 from koral--/release_0010
Release 0.0.10
2 parents f8d72a4 + d083a5f commit a386884

File tree

5 files changed

+25
-22
lines changed

5 files changed

+25
-22
lines changed

CHANGELOG.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
1+
# 0.0.10
2+
3+
* Code cleanup
4+
* Dependency updates
5+
16
# 0.0.9
27

3-
Dependency updates
8+
* Dependency updates
49

510
# 0.0.8
611

7-
Dependency updates
8-
Code simplifications
12+
* Dependency updates
13+
* Code simplifications
914

1015
# 0.0.7
1116

example/pubspec.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ publish_to: 'none'
66
version: 1.0.0+1
77

88
environment:
9-
sdk: ">=3.3.1 <4.0.0"
9+
sdk: ">=3.3.4 <4.0.0"
1010
flutter: 3.19.6
1111

1212
dependencies:
@@ -21,7 +21,7 @@ dev_dependencies:
2121
sdk: flutter
2222

2323
flutter_lints: ^4.0.0
24-
custom_lint: ^0.6.0
24+
custom_lint: ^0.6.4
2525
plural_lint:
2626
path: ../
2727

lib/src/rules/plural_lint_rule.dart

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import 'dart:io';
2-
31
import 'package:analyzer/error/listener.dart';
42
import 'package:custom_lint_builder/custom_lint_builder.dart';
53
import 'package:meta/meta.dart';
@@ -31,23 +29,25 @@ abstract class PluralLintRule extends LintRule {
3129
ErrorReporter reporter,
3230
CustomLintContext context,
3331
) {
34-
final file = File(reporter.source.uri.path);
32+
final filePath = resolver.path;
3533
final plurals = <(List<String>, int)>[];
36-
final jsonParseResult =
37-
JsonDefinition(plurals.add).build().parse(file.readAsStringSync());
34+
final jsonParseResult = JsonDefinition(plurals.add)
35+
.build()
36+
.parse(resolver.source.contents.data);
3837
if (jsonParseResult is Failure) {
3938
print(
40-
'Ignoring ARB: $file. JSON parsing error: ${jsonParseResult.message}');
39+
'Ignoring ARB: $filePath. JSON parsing error: ${jsonParseResult.message}');
4140
return;
4241
}
4342
final json = jsonParseResult.value;
4443
final locale = json['@@locale'] ??
4544
json['_locale'] ??
46-
basenameWithoutExtension(file.path).split('_').skip(1).join('_');
45+
basenameWithoutExtension(filePath).split('_').skip(1).join('_');
4746

4847
final quantitiesForLocale = CldrData().pluralRules()[locale];
4948
if (quantitiesForLocale == null) {
50-
print('Ignoring ARB: $file. No CLDR plural rules for locale: $locale');
49+
print(
50+
'Ignoring ARB: $filePath. No CLDR plural rules for locale: $locale');
5151
return;
5252
}
5353

pubspec.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: plural_lint
22
description: >
33
Plural_lint is a developer tool to check plural translations in your project.
44
It detects both missing and unused plural quantities in the ARB files.
5-
version: 0.0.9
5+
version: 0.0.10
66
repository: https://github.com/koral--/plural_lint
77
issue_tracker: https://github.com/koral--/plural_lint/issues
88
topics:
@@ -13,20 +13,20 @@ topics:
1313
- i18n
1414

1515
environment:
16-
sdk: '>=3.3.1 <4.0.0'
16+
sdk: '>=3.3.4 <4.0.0'
1717

1818
dependencies:
19-
analyzer: ^6.2.0
19+
analyzer: ^6.4.1
2020
analyzer_plugin: ^0.11.3
21-
custom_lint_builder: ^0.6.0
21+
custom_lint_builder: ^0.6.4
2222
petitparser: ^6.0.1
2323
xml: ^6.3.0
2424
path: ^1.8.3
2525
meta: ^1.11.0
2626
resource_portable: ^3.1.0
2727

2828
dev_dependencies:
29-
test: ^1.24.8
29+
test: ^1.25.2
3030
lints: ^4.0.0
3131
custom_lint: ^0.6.0
3232
flutter:

test/rules/plural_lint_test.dart

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,7 @@ void main() {
3939
output,
4040
contains(
4141
'lib/l10n/intl_fr.arb:4:16 • These quantities: [few] are not used in locale: fr • unused_quantity • INFO'));
42-
expect(
43-
output,
44-
contains(
45-
"/lib/l10n/intl_zz.arb'. No CLDR plural rules for locale: zz"));
42+
expect(output,
43+
contains('/lib/l10n/intl_zz.arb. No CLDR plural rules for locale: zz'));
4644
});
4745
}

0 commit comments

Comments
 (0)