Skip to content

Commit b3ab73f

Browse files
Merge branch 'migrate-pedantic-to-lints'
2 parents 2271a59 + a8f817f commit b3ab73f

File tree

16 files changed

+30
-37
lines changed

16 files changed

+30
-37
lines changed

benchmark/lib/benchmark.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import 'dart:io';
22

33
import 'package:meta/meta.dart';
4-
import 'package:objectbox/objectbox.dart';
54

65
import 'model.dart';
76
import 'objectbox.g.dart';

generator/analysis_options.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
include: package:pedantic/analysis_options.yaml
1+
include: package:lints/recommended.yaml
22

33
linter:
44
rules:

generator/pubspec.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ dependencies:
1919
pubspec_parse: ^1.0.0
2020
yaml: ^3.0.0
2121

22+
dev_dependencies:
23+
lints: ^1.0.1
24+
2225
# NOTE: remove before publishing
2326
dependency_overrides:
2427
objectbox:

objectbox/analysis_options.yaml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
include: package:pedantic/analysis_options.yaml
2-
# Effective dart has some things we don't use so let's stick with pedantic for now
3-
# include: package:effective_dart/analysis_options.yaml
1+
include: package:lints/recommended.yaml
2+
# https://dart.dev/guides/language/analysis-options
43

54
linter:
65
# Some additional rules from pub.dev analyzer and package:effective_dart
@@ -28,13 +27,11 @@ analyzer:
2827
errors:
2928
public_member_api_docs: error
3029
type_annotate_public_apis: error
30+
# Note: pana ignores these exclude rules, better add ignore_for_file comments.
3131
exclude:
3232
- example/**
3333
- generator/**
3434
- benchmark/**
35-
- lib/src/modelinfo/enums.dart
36-
- lib/src/native/bindings/objectbox-c.dart
37-
- lib/flatbuffers/** # Not really our code
3835
strong-mode:
3936
implicit-casts: false
4037
implicit-dynamic: false

objectbox/lib/src/annotations.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import 'package:objectbox/objectbox.dart';
1+
import '../objectbox.dart';
22

33
/// Entity annotation is used on a class to let ObjectBox know it should store
44
/// it - making the class a "persistable Entity".

objectbox/lib/src/modelinfo/enums.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
// Note: the enums in this file are copied from native/bindings/objectbox-c.dart
22
// to avoid package:ffi import which would break compatibility with web.
33

4+
// ignore_for_file: public_member_api_docs, constant_identifier_names
5+
46
import '../annotations.dart';
57

68
/// Maps [OBXPropertyType] to its string representation (name).

objectbox/lib/src/native/bindings/bindings.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,12 +116,12 @@ Object? _dartAPIInitException;
116116

117117
/// A couple of native functions we need as callbacks to pass back to native.
118118
/// Unfortunately, ffigen keeps those private.
119-
typedef _native_close = Int32 Function(Pointer<Void> ptr);
119+
typedef _NativeClose = Int32 Function(Pointer<Void> ptr);
120120

121121
late final native_query_close =
122-
_lib!.lookup<NativeFunction<_native_close>>('obx_query_close');
122+
_lib!.lookup<NativeFunction<_NativeClose>>('obx_query_close');
123123
late final native_query_prop_close =
124-
_lib!.lookup<NativeFunction<_native_close>>('obx_query_prop_close');
124+
_lib!.lookup<NativeFunction<_NativeClose>>('obx_query_prop_close');
125125

126126
/// Keeps `this` alive until this call, preventing finalizers to run.
127127
/// Necessary for objects with a finalizer attached because the optimizer may

objectbox/lib/src/native/bindings/nativemem.dart

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@ import 'dart:io';
55
66
/// memset(ptr, value, num) sets the first num bytes of the block of memory
77
/// pointed by ptr to the specified value (interpreted as an uint8).
8-
final _dart_memset memset =
9-
_stdlib.lookupFunction<_c_memset, _dart_memset>('memset');
8+
final _DartMemset memset =
9+
_stdlib.lookupFunction<_CMemset, _DartMemset>('memset');
1010

11-
final _dart_memcpy? _memcpyNative = _lookupMemcpyOrNull();
11+
final _DartMemcpy? _memcpyNative = _lookupMemcpyOrNull();
1212

13-
_dart_memcpy? _lookupMemcpyOrNull() {
13+
_DartMemcpy? _lookupMemcpyOrNull() {
1414
try {
15-
return _stdlib.lookupFunction<_c_memcpy, _dart_memcpy>('memcpy');
15+
return _stdlib.lookupFunction<_CMemcpy, _DartMemcpy>('memcpy');
1616
} catch (_) {
1717
return null;
1818
}
@@ -22,7 +22,7 @@ _dart_memcpy? _lookupMemcpyOrNull() {
2222
/// and a Dart implementation is used.
2323
final isMemcpyNotAvailable = _memcpyNative == null;
2424

25-
final _dart_memcpy _memcpyDart = (dest, src, length) {
25+
final _DartMemcpy _memcpyDart = (dest, src, length) {
2626
dest
2727
.asTypedList(length)
2828
.setAll(0, src.asTypedList(length).getRange(0, length));
@@ -35,14 +35,14 @@ final _dart_memcpy _memcpyDart = (dest, src, length) {
3535
/// (e.g. for Flutter on iOS 15 simulator), then a Dart implementation is used
3636
/// to copy data via asTypedList (which is much slower).
3737
/// https://github.com/objectbox/objectbox-dart/issues/313
38-
final _dart_memcpy memcpy = _memcpyNative ?? _memcpyDart;
38+
final _DartMemcpy memcpy = _memcpyNative ?? _memcpyDart;
3939

4040
// FFI signature
41-
typedef _dart_memset = void Function(Pointer<Uint8>, int, int);
42-
typedef _c_memset = Void Function(Pointer<Uint8>, Int32, IntPtr);
41+
typedef _DartMemset = void Function(Pointer<Uint8>, int, int);
42+
typedef _CMemset = Void Function(Pointer<Uint8>, Int32, IntPtr);
4343

44-
typedef _dart_memcpy = void Function(Pointer<Uint8>, Pointer<Uint8>, int);
45-
typedef _c_memcpy = Void Function(Pointer<Uint8>, Pointer<Uint8>, IntPtr);
44+
typedef _DartMemcpy = void Function(Pointer<Uint8>, Pointer<Uint8>, int);
45+
typedef _CMemcpy = Void Function(Pointer<Uint8>, Pointer<Uint8>, IntPtr);
4646

4747
final DynamicLibrary _stdlib = Platform.isWindows // no .process() on windows
4848
? DynamicLibrary.open('vcruntime140.dll') // required by objectbox.dll

objectbox/lib/src/native/bindings/objectbox-c.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// ignore_for_file: non_constant_identifier_names
1+
// ignore_for_file: non_constant_identifier_names, public_member_api_docs, prefer_expression_function_bodies, avoid_positional_boolean_parameters, constant_identifier_names, camel_case_types, file_names
22

33
// AUTO GENERATED FILE, DO NOT EDIT.
44
//

objectbox/lib/src/native/box.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import 'bindings/bindings.dart';
1616
import 'bindings/flatbuffers.dart';
1717
import 'bindings/helpers.dart';
1818
import 'query/query.dart';
19-
import 'transaction.dart';
2019

2120
/// Box put (write) mode.
2221
enum PutMode {

0 commit comments

Comments
 (0)