style: stricter linting

This commit is contained in:
Aleksey Kulikov 2021-10-23 12:31:18 +03:00
parent f3fbc80f8e
commit 4717aab57f
84 changed files with 773 additions and 653 deletions

View file

@ -118,7 +118,7 @@ void main() {
expect(config['core.bare'].value, 'false');
});
test('throws when variable isn\'t found', () {
test("throws when variable isn't found", () {
expect(
() => config['not.there'],
throwsA(
@ -192,7 +192,7 @@ void main() {
expect(
config.multivar(
variable: 'core.gitproxy',
regexp: 'for kernel.org\$',
regexp: r'for kernel.org$',
),
['proxy-command for kernel.org'],
);
@ -234,20 +234,20 @@ void main() {
expect(
config.multivar(
variable: 'core.gitproxy',
regexp: 'for kernel.org\$',
regexp: r'for kernel.org$',
),
['proxy-command for kernel.org'],
);
config.deleteMultivar(
variable: 'core.gitproxy',
regexp: 'for kernel.org\$',
regexp: r'for kernel.org$',
);
expect(
config.multivar(
variable: 'core.gitproxy',
regexp: 'for kernel.org\$',
regexp: r'for kernel.org$',
),
<String>[],
);

View file

@ -217,7 +217,7 @@ index e69de29..c217c63 100644
test('throws when trying to diff between null and tree', () {
final tree = repo.lookupTree(repo['b85d53c']);
expect(
() => repo.diff(a: null, b: tree),
() => repo.diff(b: tree),
throwsA(
isA<ArgumentError>().having(
(e) => e.message,

View file

@ -172,7 +172,9 @@ void main() {
test('returns string representation of object', () {
expect(
GitMergeFileFlag.defaults.toString(), 'GitMergeFileFlag.defaults');
GitMergeFileFlag.defaults.toString(),
'GitMergeFileFlag.defaults',
);
});
});
@ -413,7 +415,9 @@ void main() {
test('returns string representation of object', () {
expect(
GitFetchPrune.unspecified.toString(), 'GitFetchPrune.unspecified');
GitFetchPrune.unspecified.toString(),
'GitFetchPrune.unspecified',
);
});
});
@ -552,7 +556,9 @@ void main() {
test('returns string representation of object', () {
expect(
GitSubmoduleStatus.inHead.toString(), 'GitSubmoduleStatus.inHead');
GitSubmoduleStatus.inHead.toString(),
'GitSubmoduleStatus.inHead',
);
});
});
});

View file

@ -89,7 +89,7 @@ void main() {
odb.free();
});
test('returns list of all objects oid\'s in database', () {
test("returns list of all objects oid's in database", () {
final odb = repo.odb;
expect(odb.objects, isNot(isEmpty));

View file

@ -70,7 +70,7 @@ void main() {
});
test('prune() successfully prunes branches', () {
var pruned = <String>[];
final pruned = <String>[];
void updateTips(String refname, Oid oldOid, Oid newOid) {
pruned.add(refname);
}

View file

@ -315,7 +315,7 @@ void main() {
);
});
test('successfully returns remote repo\'s reference list', () {
test("successfully returns remote repo's reference list", () {
Remote.setUrl(
repo: repo,
remote: 'libgit2',
@ -329,7 +329,7 @@ void main() {
expect(refs.first['name'], 'HEAD');
expect(refs.first['symref'], 'refs/heads/master');
expect(
(refs.first['oid'] as Oid).sha,
(refs.first['oid']! as Oid).sha,
'49322bb17d3acc9146f98c97d078513228bbf3c0',
);
@ -337,8 +337,8 @@ void main() {
});
test(
'throws when trying to get remote repo\'s reference list with '
'invalid url', () {
"throws when trying to get remote repo's reference list with "
"invalid url", () {
Remote.setUrl(repo: repo, remote: 'libgit2', url: 'invalid');
final remote = repo.lookupRemote('libgit2');
@ -504,7 +504,7 @@ Total 69 (delta 0), reused 1 (delta 0), pack-reused 68
);
final remote = repo.lookupRemote('libgit2');
var sidebandOutput = StringBuffer();
final sidebandOutput = StringBuffer();
void sideband(String message) {
sidebandOutput.write(message);
}
@ -542,7 +542,7 @@ Total 69 (delta 0), reused 1 (delta 0), pack-reused 68
},
];
var updateTipsOutput = <Map<String, String>>[];
final updateTipsOutput = <Map<String, String>>[];
void updateTips(String refname, Oid oldOid, Oid newOid) {
updateTipsOutput.add({
'refname': refname,
@ -576,7 +576,7 @@ Total 69 (delta 0), reused 1 (delta 0), pack-reused 68
repo.createRemote(name: 'local', url: originDir.path);
final remote = repo.lookupRemote('local');
var updateRefOutput = <String, String>{};
final updateRefOutput = <String, String>{};
void updateRef(String refname, String message) {
updateRefOutput[refname] = message;
}

View file

@ -1,3 +1,5 @@
// ignore_for_file: avoid_positional_boolean_parameters
import 'dart:io';
import 'package:libgit2dart/libgit2dart.dart';
@ -101,13 +103,13 @@ void main() {
});
test('successfully clones repository with provided repository callback',
() async {
() {
final callbackPath =
Directory('${Directory.systemTemp.path}/callbackRepo');
if (await callbackPath.exists()) {
callbackPath.delete(recursive: true);
if (callbackPath.existsSync()) {
callbackPath.deleteSync(recursive: true);
}
callbackPath.create();
callbackPath.createSync();
Repository repository(String path, bool bare) =>
Repository.init(path: callbackPath.path);
@ -123,7 +125,7 @@ void main() {
expect(clonedRepo.path, '${callbackPath.path}/.git/');
clonedRepo.free();
callbackPath.delete(recursive: true);
callbackPath.deleteSync(recursive: true);
});
test('throws when cloning repository with invalid repository callback', () {

View file

@ -8,7 +8,7 @@ void main() {
late Repository repo;
group('Repository.open', () {
test('throws when repository isn\'t found at provided path', () {
test("throws when repository isn't found at provided path", () {
expect(
() => Repository.open(''),
throwsA(isA<LibGit2Error>()),
@ -71,7 +71,7 @@ void main() {
);
});
test('returns path to parent repo\'s .git folder for the repository', () {
test("returns path to parent repo's .git folder for the repository", () {
expect(
repo.commonDir,
'${Directory.current.path}/test/assets/empty_standard/.gitdir/',

View file

@ -13,7 +13,6 @@ void main() {
name: name,
email: email,
time: time,
offset: offset,
);
});
@ -80,7 +79,6 @@ void main() {
name: name,
email: email,
time: time,
offset: offset,
);
expect(signature == otherSignature, true);