Skip to content

Commit

Permalink
Update to latest lints and fix (#122)
Browse files Browse the repository at this point in the history
Also bump min SDK to Dart 3.1
  • Loading branch information
kevmoo authored Nov 8, 2023
1 parent 3279f5d commit 6b0888c
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 33 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/test-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
strategy:
fail-fast: false
matrix:
sdk: [2.19.0, dev]
sdk: [3.1.0, dev]
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
- uses: dart-lang/setup-dart@b64355ae6ca0b5d484f0106a033dd1388965d06d
Expand All @@ -47,7 +47,7 @@ jobs:
matrix:
# Add macos-latest and/or windows-latest if relevant for this package.
os: [ubuntu-latest]
sdk: [2.19.0, dev]
sdk: [3.1.0, dev]
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
- uses: dart-lang/setup-dart@b64355ae6ca0b5d484f0106a033dd1388965d06d
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 1.1.1-wip

* Require Dart `^3.1.0`

## 1.1.0

* Add `tryParseRadix`, `tryParseInt` and `tryParseHex` static methods
Expand Down
21 changes: 1 addition & 20 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -1,41 +1,22 @@
include: package:lints/recommended.yaml
include: package:dart_flutter_team_lints/analysis_options.yaml

analyzer:
language:
strict-casts: true

linter:
rules:
- avoid_catching_errors
- avoid_dynamic_calls
- avoid_private_typedef_functions
- avoid_returning_null
- avoid_unused_constructor_parameters
- cancel_subscriptions
- cascade_invocations
- comment_references
- directives_ordering
- join_return_with_assignment
- lines_longer_than_80_chars
- missing_whitespace_between_adjacent_strings
- no_adjacent_strings_in_list
- no_runtimeType_toString
- only_throw_errors
- package_api_docs
- prefer_asserts_in_initializer_lists
- prefer_const_constructors
- prefer_const_declarations
- prefer_expression_function_bodies
- prefer_interpolation_to_compose_strings
- prefer_relative_imports
- sort_pub_dependencies
- test_types_in_equals
- throw_in_finally
- type_annotate_public_apis
- unnecessary_lambdas
- unnecessary_null_aware_assignments
- unnecessary_parenthesis
- unnecessary_raw_strings
- unnecessary_statements
- use_is_even_rather_than_modulo
- use_string_buffers
4 changes: 2 additions & 2 deletions lib/src/int64.dart
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ class Int64 implements IntX {

// Returns the [Int64] representation of the specified value. Throws
// [ArgumentError] for non-integer arguments.
static Int64 _promote(value) {
static Int64 _promote(Object value) {
if (value is Int64) {
return value;
} else if (value is int) {
Expand Down Expand Up @@ -968,7 +968,7 @@ class Int64 implements IntX {

// Implementation of '~/', '%' and 'remainder'.

static Int64 _divide(Int64 a, other, int what) {
static Int64 _divide(Int64 a, Object other, int what) {
Int64 b = _promote(other);
if (b.isZero) {
throw UnsupportedError('Division by zero');
Expand Down
8 changes: 4 additions & 4 deletions lib/src/utilities.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ int validateRadix(int radix) =>
/// not a valid digit in any radix in the range 2 through 36.
int decodeDigit(int c) {
// Hex digit char codes
const int c0 = 48; // '0'.codeUnitAt(0)
const int ca = 97; // 'a'.codeUnitAt(0)
const c0 = 48; // '0'.codeUnitAt(0)
const ca = 97; // 'a'.codeUnitAt(0)

int digit = c ^ c0;
var digit = c ^ c0;
if (digit < 10) return digit;
int letter = (c | 0x20) - ca;
var letter = (c | 0x20) - ca;
if (letter >= 0) {
// Returns values above 36 for invalid digits.
// The value is checked against the actual radix where the return
Expand Down
6 changes: 3 additions & 3 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
name: fixnum
version: 1.1.0
version: 1.1.1-wip
description: >-
Library for 32- and 64-bit signed fixed-width integers with consistent
behavior between native and JS runtimes.
repository: https://github.com/dart-lang/fixnum

environment:
sdk: '>=2.19.0 <3.0.0'
sdk: ^3.1.0

dev_dependencies:
lints: ^2.0.0
dart_flutter_team_lints: ^2.0.0
test: ^1.16.0
2 changes: 0 additions & 2 deletions test/int64_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
//
// ignore_for_file: omit_local_variable_types

library int64test;

import 'package:fixnum/fixnum.dart';
import 'package:test/test.dart';

Expand Down
1 change: 1 addition & 0 deletions test/int_64_vm_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// BSD-style license that can be found in the LICENSE file.

@TestOn('vm')
library;

import 'package:fixnum/fixnum.dart';
import 'package:test/test.dart';
Expand Down

0 comments on commit 6b0888c

Please sign in to comment.