mirror of
https://github.com/SkinnyMind/libgit2dart.git
synced 2025-05-05 04:39:07 -04:00
style: stricter linting
This commit is contained in:
parent
ae5d895957
commit
7148fbf194
8 changed files with 15 additions and 9 deletions
|
@ -23,6 +23,7 @@ linter:
|
||||||
- avoid_setters_without_getters
|
- avoid_setters_without_getters
|
||||||
- avoid_slow_async_io
|
- avoid_slow_async_io
|
||||||
- avoid_type_to_string
|
- avoid_type_to_string
|
||||||
|
- avoid_unused_constructor_parameters
|
||||||
- avoid_void_async
|
- avoid_void_async
|
||||||
- cast_nullable_to_non_nullable
|
- cast_nullable_to_non_nullable
|
||||||
- directives_ordering
|
- directives_ordering
|
||||||
|
@ -32,6 +33,7 @@ linter:
|
||||||
- lines_longer_than_80_chars
|
- lines_longer_than_80_chars
|
||||||
- missing_whitespace_between_adjacent_strings
|
- missing_whitespace_between_adjacent_strings
|
||||||
- noop_primitive_operations
|
- noop_primitive_operations
|
||||||
|
- omit_local_variable_types
|
||||||
- parameter_assignments
|
- parameter_assignments
|
||||||
- prefer_const_constructors
|
- prefer_const_constructors
|
||||||
- prefer_constructors_over_static_methods
|
- prefer_constructors_over_static_methods
|
||||||
|
@ -41,10 +43,11 @@ linter:
|
||||||
- prefer_null_aware_method_calls
|
- prefer_null_aware_method_calls
|
||||||
- require_trailing_commas
|
- require_trailing_commas
|
||||||
- sort_constructors_first
|
- sort_constructors_first
|
||||||
|
- sort_pub_dependencies
|
||||||
|
- sort_unnamed_constructors_first
|
||||||
- type_annotate_public_apis
|
- type_annotate_public_apis
|
||||||
|
- unawaited_futures
|
||||||
- use_named_constants
|
- use_named_constants
|
||||||
- use_raw_strings
|
- use_raw_strings
|
||||||
- use_setters_to_change_properties
|
- use_setters_to_change_properties
|
||||||
- use_string_buffers
|
- use_string_buffers
|
||||||
- sort_unnamed_constructors_first
|
|
||||||
- sort_pub_dependencies
|
|
||||||
|
|
|
@ -132,7 +132,7 @@ List<Object> initOptions({
|
||||||
optsC.ref.target_directory = directory.toNativeUtf8().cast<Int8>();
|
optsC.ref.target_directory = directory.toNativeUtf8().cast<Int8>();
|
||||||
}
|
}
|
||||||
|
|
||||||
List<Pointer<Int8>> pathPointers = [];
|
var pathPointers = <Pointer<Int8>>[];
|
||||||
Pointer<Pointer<Int8>> strArray = nullptr;
|
Pointer<Pointer<Int8>> strArray = nullptr;
|
||||||
if (paths != null) {
|
if (paths != null) {
|
||||||
pathPointers = paths.map((e) => e.toNativeUtf8().cast<Int8>()).toList();
|
pathPointers = paths.map((e) => e.toNativeUtf8().cast<Int8>()).toList();
|
||||||
|
|
|
@ -336,6 +336,7 @@ bool apply({
|
||||||
if (hunkIndex != null) {
|
if (hunkIndex != null) {
|
||||||
_counter = 0;
|
_counter = 0;
|
||||||
const except = -1;
|
const except = -1;
|
||||||
|
// ignore: omit_local_variable_types
|
||||||
final git_apply_hunk_cb callback = Pointer.fromFunction(_hunkCb, except);
|
final git_apply_hunk_cb callback = Pointer.fromFunction(_hunkCb, except);
|
||||||
payload = calloc<Int32>()..value = hunkIndex;
|
payload = calloc<Int32>()..value = hunkIndex;
|
||||||
opts.ref.payload = payload.cast();
|
opts.ref.payload = payload.cast();
|
||||||
|
@ -369,6 +370,7 @@ Pointer<git_index> applyToTree({
|
||||||
if (hunkIndex != null) {
|
if (hunkIndex != null) {
|
||||||
_counter = 0;
|
_counter = 0;
|
||||||
const except = -1;
|
const except = -1;
|
||||||
|
// ignore: omit_local_variable_types
|
||||||
final git_apply_hunk_cb callback = Pointer.fromFunction(_hunkCb, except);
|
final git_apply_hunk_cb callback = Pointer.fromFunction(_hunkCb, except);
|
||||||
payload = calloc<Int32>()..value = hunkIndex;
|
payload = calloc<Int32>()..value = hunkIndex;
|
||||||
opts.ref.payload = payload.cast();
|
opts.ref.payload = payload.cast();
|
||||||
|
|
|
@ -160,6 +160,7 @@ int _stashCb(
|
||||||
/// Loop over all the stashed states.
|
/// Loop over all the stashed states.
|
||||||
List<Stash> list(Pointer<git_repository> repo) {
|
List<Stash> list(Pointer<git_repository> repo) {
|
||||||
const except = -1;
|
const except = -1;
|
||||||
|
// ignore: omit_local_variable_types
|
||||||
final git_stash_cb callBack = Pointer.fromFunction(_stashCb, except);
|
final git_stash_cb callBack = Pointer.fromFunction(_stashCb, except);
|
||||||
libgit2.git_stash_foreach(repo, callBack, nullptr);
|
libgit2.git_stash_foreach(repo, callBack, nullptr);
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,7 @@ class Patch {
|
||||||
}) {
|
}) {
|
||||||
libgit2.git_libgit2_init();
|
libgit2.git_libgit2_init();
|
||||||
|
|
||||||
final int flagsInt = flags.fold(0, (acc, e) => acc | e.value);
|
final flagsInt = flags.fold(0, (int acc, e) => acc | e.value);
|
||||||
|
|
||||||
if (a is Blob?) {
|
if (a is Blob?) {
|
||||||
if (b is Blob?) {
|
if (b is Blob?) {
|
||||||
|
|
|
@ -70,7 +70,7 @@ class Repository {
|
||||||
}) {
|
}) {
|
||||||
libgit2.git_libgit2_init();
|
libgit2.git_libgit2_init();
|
||||||
|
|
||||||
int flagsInt = flags.fold(0, (acc, e) => acc | e.value);
|
var flagsInt = flags.fold(0, (int acc, e) => acc | e.value);
|
||||||
|
|
||||||
if (bare) {
|
if (bare) {
|
||||||
flagsInt |= GitRepositoryInit.bare.value;
|
flagsInt |= GitRepositoryInit.bare.value;
|
||||||
|
@ -1162,7 +1162,7 @@ class Repository {
|
||||||
String? directory,
|
String? directory,
|
||||||
List<String>? paths,
|
List<String>? paths,
|
||||||
}) {
|
}) {
|
||||||
final int strat = strategy.fold(0, (acc, e) => acc | e.value);
|
final strat = strategy.fold(0, (int acc, e) => acc | e.value);
|
||||||
|
|
||||||
if (refName == null) {
|
if (refName == null) {
|
||||||
checkout_bindings.index(
|
checkout_bindings.index(
|
||||||
|
@ -1274,7 +1274,7 @@ class Repository {
|
||||||
int contextLines = 3,
|
int contextLines = 3,
|
||||||
int interhunkLines = 0,
|
int interhunkLines = 0,
|
||||||
}) {
|
}) {
|
||||||
final int flagsInt = flags.fold(0, (acc, e) => acc | e.value);
|
final flagsInt = flags.fold(0, (int acc, e) => acc | e.value);
|
||||||
|
|
||||||
if (a is Tree && b is Tree) {
|
if (a is Tree && b is Tree) {
|
||||||
return Diff(
|
return Diff(
|
||||||
|
|
|
@ -40,7 +40,7 @@ class Stash {
|
||||||
String? message,
|
String? message,
|
||||||
Set<GitStash> flags = const {GitStash.defaults},
|
Set<GitStash> flags = const {GitStash.defaults},
|
||||||
}) {
|
}) {
|
||||||
final int flagsInt = flags.fold(0, (acc, e) => acc | e.value);
|
final flagsInt = flags.fold(0, (int acc, e) => acc | e.value);
|
||||||
|
|
||||||
return Oid(
|
return Oid(
|
||||||
bindings.save(
|
bindings.save(
|
||||||
|
|
|
@ -302,7 +302,7 @@ void main() {
|
||||||
expect(repo.getAttribute(path: 'invalid', name: 'not-there'), null);
|
expect(repo.getAttribute(path: 'invalid', name: 'not-there'), null);
|
||||||
|
|
||||||
final attrFile = await File('${repo.workdir}.gitattributes').create();
|
final attrFile = await File('${repo.workdir}.gitattributes').create();
|
||||||
attrFile.writeAsString('*.dart text\n*.jpg -text\n*.sh eol=lf\n');
|
await attrFile.writeAsString('*.dart text\n*.jpg -text\n*.sh eol=lf\n');
|
||||||
|
|
||||||
await File('${repo.workdir}file.dart').create();
|
await File('${repo.workdir}file.dart').create();
|
||||||
await File('${repo.workdir}file.sh').create();
|
await File('${repo.workdir}file.sh').create();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue