mirror of
https://github.com/SkinnyMind/libgit2dart.git
synced 2025-05-04 20:29:08 -04:00
style: no implicit casts and dynamic
This commit is contained in:
parent
7b14ee6b9b
commit
f3fbc80f8e
11 changed files with 49 additions and 36 deletions
|
@ -6,5 +6,8 @@ linter:
|
|||
- directives_ordering
|
||||
- lines_longer_than_80_chars
|
||||
analyzer:
|
||||
strong-mode:
|
||||
implicit-casts: false
|
||||
implicit-dynamic: false
|
||||
exclude:
|
||||
- lib/src/bindings/libgit2_bindings.dart
|
||||
|
|
|
@ -37,7 +37,7 @@ void head({
|
|||
);
|
||||
|
||||
for (final p in pathPointers as List) {
|
||||
calloc.free(p);
|
||||
calloc.free(p as Pointer);
|
||||
}
|
||||
calloc.free(strArray as Pointer);
|
||||
calloc.free(optsC);
|
||||
|
@ -72,7 +72,7 @@ void index({
|
|||
);
|
||||
|
||||
for (final p in pathPointers as List) {
|
||||
calloc.free(p);
|
||||
calloc.free(p as Pointer);
|
||||
}
|
||||
calloc.free(strArray as Pointer);
|
||||
calloc.free(optsC);
|
||||
|
@ -109,7 +109,7 @@ void tree({
|
|||
);
|
||||
|
||||
for (final p in pathPointers as List) {
|
||||
calloc.free(p);
|
||||
calloc.free(p as Pointer);
|
||||
}
|
||||
calloc.free(strArray as Pointer);
|
||||
calloc.free(optsC);
|
||||
|
|
|
@ -91,7 +91,7 @@ List revParseExt({
|
|||
calloc.free(referenceOut);
|
||||
throw LibGit2Error(libgit2.git_error_last());
|
||||
} else {
|
||||
var result = [];
|
||||
var result = <Pointer>[];
|
||||
result.add(objectOut.value);
|
||||
if (referenceOut.value != nullptr) {
|
||||
result.add(referenceOut.value);
|
||||
|
|
|
@ -70,7 +70,7 @@ void apply({
|
|||
final error = libgit2.git_stash_apply(repoPointer, index, options);
|
||||
|
||||
for (final p in pathPointers as List) {
|
||||
calloc.free(p);
|
||||
calloc.free(p as Pointer);
|
||||
}
|
||||
calloc.free(strArray as Pointer);
|
||||
calloc.free(optsC);
|
||||
|
@ -125,7 +125,7 @@ void pop({
|
|||
final error = libgit2.git_stash_pop(repoPointer, index, options);
|
||||
|
||||
for (final p in pathPointers as List) {
|
||||
calloc.free(p);
|
||||
calloc.free(p as Pointer);
|
||||
}
|
||||
calloc.free(strArray as Pointer);
|
||||
calloc.free(optsC);
|
||||
|
|
|
@ -58,28 +58,36 @@ class Oid {
|
|||
0);
|
||||
}
|
||||
|
||||
bool operator <(other) {
|
||||
return (other is Oid) &&
|
||||
(bindings.compare(aPointer: _oidPointer, bPointer: other._oidPointer) ==
|
||||
-1);
|
||||
bool operator <(Oid other) {
|
||||
return bindings.compare(
|
||||
aPointer: _oidPointer,
|
||||
bPointer: other._oidPointer,
|
||||
) ==
|
||||
-1;
|
||||
}
|
||||
|
||||
bool operator <=(other) {
|
||||
return (other is Oid) &&
|
||||
(bindings.compare(aPointer: _oidPointer, bPointer: other._oidPointer) ==
|
||||
-1);
|
||||
bool operator <=(Oid other) {
|
||||
return bindings.compare(
|
||||
aPointer: _oidPointer,
|
||||
bPointer: other._oidPointer,
|
||||
) ==
|
||||
-1;
|
||||
}
|
||||
|
||||
bool operator >(other) {
|
||||
return (other is Oid) &&
|
||||
(bindings.compare(aPointer: _oidPointer, bPointer: other._oidPointer) ==
|
||||
1);
|
||||
bool operator >(Oid other) {
|
||||
return bindings.compare(
|
||||
aPointer: _oidPointer,
|
||||
bPointer: other._oidPointer,
|
||||
) ==
|
||||
1;
|
||||
}
|
||||
|
||||
bool operator >=(other) {
|
||||
return (other is Oid) &&
|
||||
(bindings.compare(aPointer: _oidPointer, bPointer: other._oidPointer) ==
|
||||
1);
|
||||
bool operator >=(Oid other) {
|
||||
return bindings.compare(
|
||||
aPointer: _oidPointer,
|
||||
bPointer: other._oidPointer,
|
||||
) ==
|
||||
1;
|
||||
}
|
||||
|
||||
@override // coverage:ignore-line
|
||||
|
|
|
@ -648,7 +648,7 @@ class Repository {
|
|||
Index revertCommit({
|
||||
required Commit revertCommit,
|
||||
required Commit ourCommit,
|
||||
mainline = 0,
|
||||
int mainline = 0,
|
||||
}) {
|
||||
return Index(commit_bindings.revertCommit(
|
||||
repoPointer: _repoPointer,
|
||||
|
@ -986,7 +986,7 @@ class Repository {
|
|||
head.free();
|
||||
ref.free();
|
||||
|
||||
return [analysisSet, mergePreference];
|
||||
return <Object>[analysisSet, mergePreference];
|
||||
}
|
||||
|
||||
/// Merges the given commit [oid] into HEAD, writing the results into the
|
||||
|
|
|
@ -23,9 +23,11 @@ class RevParse {
|
|||
repoPointer: repo.pointer,
|
||||
spec: spec,
|
||||
);
|
||||
object = Commit(pointers[0].cast<git_commit>());
|
||||
object = Commit(pointers[0].cast<git_commit>() as Pointer<git_commit>);
|
||||
if (pointers.length == 2) {
|
||||
reference = Reference(pointers[1].cast<git_reference>());
|
||||
reference = Reference(
|
||||
pointers[1].cast<git_reference>() as Pointer<git_reference>,
|
||||
);
|
||||
} else {
|
||||
reference = null;
|
||||
}
|
||||
|
|
|
@ -46,7 +46,7 @@ void main() {
|
|||
});
|
||||
|
||||
test('returns a list of remote branches', () {
|
||||
expect(repo.branchesRemote, []);
|
||||
expect(repo.branchesRemote, <Branch>[]);
|
||||
});
|
||||
|
||||
test('throws when trying to return list and error occurs', () {
|
||||
|
|
|
@ -199,7 +199,7 @@ void main() {
|
|||
});
|
||||
|
||||
test('returns empty list if multivar not found', () {
|
||||
expect(config.multivar(variable: 'not.there'), []);
|
||||
expect(config.multivar(variable: 'not.there'), <String>[]);
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -249,7 +249,7 @@ void main() {
|
|||
variable: 'core.gitproxy',
|
||||
regexp: 'for kernel.org\$',
|
||||
),
|
||||
[],
|
||||
<String>[],
|
||||
);
|
||||
});
|
||||
|
||||
|
@ -265,7 +265,7 @@ void main() {
|
|||
|
||||
config.deleteMultivar(variable: 'core.gitproxy', regexp: '');
|
||||
|
||||
expect(config.multivar(variable: 'core.gitproxy'), []);
|
||||
expect(config.multivar(variable: 'core.gitproxy'), <String>[]);
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -148,7 +148,7 @@ void main() {
|
|||
walker.reset();
|
||||
final commits = walker.walk();
|
||||
|
||||
expect(commits, []);
|
||||
expect(commits, <Commit>[]);
|
||||
|
||||
walker.free();
|
||||
});
|
||||
|
|
|
@ -30,7 +30,7 @@ void main() {
|
|||
|
||||
group('Worktree', () {
|
||||
test('successfully creates worktree at provided path', () {
|
||||
expect(repo.worktrees, []);
|
||||
expect(repo.worktrees, <String>[]);
|
||||
|
||||
final worktree = repo.createWorktree(
|
||||
name: worktreeName,
|
||||
|
@ -58,7 +58,7 @@ void main() {
|
|||
final head = repo.revParseSingle('HEAD');
|
||||
final worktreeBranch = repo.createBranch(name: 'v1', target: head);
|
||||
final ref = repo.lookupReference('refs/heads/v1');
|
||||
expect(repo.worktrees, []);
|
||||
expect(repo.worktrees, <String>[]);
|
||||
|
||||
final worktree = repo.createWorktree(
|
||||
name: worktreeName,
|
||||
|
@ -75,7 +75,7 @@ void main() {
|
|||
worktreeDir.deleteSync(recursive: true);
|
||||
worktree.prune();
|
||||
|
||||
expect(repo.worktrees, []);
|
||||
expect(repo.worktrees, <String>[]);
|
||||
expect(worktreeBranch.isCheckedOut, false);
|
||||
expect(branches.any((branch) => branch.name == 'v1'), true);
|
||||
|
||||
|
@ -162,7 +162,7 @@ void main() {
|
|||
});
|
||||
|
||||
test('successfully prunes worktree', () {
|
||||
expect(repo.worktrees, []);
|
||||
expect(repo.worktrees, <String>[]);
|
||||
|
||||
final worktree = repo.createWorktree(
|
||||
name: worktreeName,
|
||||
|
@ -177,7 +177,7 @@ void main() {
|
|||
expect(worktree.isValid, false);
|
||||
|
||||
worktree.prune();
|
||||
expect(repo.worktrees, []);
|
||||
expect(repo.worktrees, <String>[]);
|
||||
|
||||
worktree.free();
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue