vauvenal5 / yaga

Nextcloud Yaga - A Nextcloud first gallery app for Android.
https://vauvenal5.github.io/yaga-docs/
GNU General Public License v3.0
138 stars 10 forks source link

add stricter linting #146

Closed Leptopoda closed 3 years ago

Leptopoda commented 3 years ago

Why?

there are a lot of places where you could set properties final or const the later one should be a lot more performant.

what have I done?

I've added the dart-lint package and fixed most linting errors.

You seem to like having your deps sorted but flutter still at the top. Usually flutter prefers everything to be alphabetically. As your style doesn't make a difference I've disabled the rule sort_pub_dependencies. There are also some errors with invalid_return_type_for_catch_error this is that when an error gets caught (see below) the function will return null. As I didn't want to change any program logic I've also disabled that rule for now and we can back to it when going to null safety by returning String?.

String _myFunction() {
  try {
  return 'helloWorld';
  } catch (e) {
  print(e);
  }
}

Also I've changed everywhere you where accessing object members through this.. This does not adhere to the dart coding style.

What works?

I've run the app and it seems to work normally but please verify. I've changed a lot of code so please test. I've tried running the tests but they seem broken (even before I've started my work). Regarding the tests you try to access fields undefined in your classes/objects.

What needs to be done?

Not related to my PR but I didn't fix every linting error. I'm to unfamiliar with the codebase to fix the tests (although I might have a read sometime in the future).

vauvenal5 commented 3 years ago

First of all thx for the contribution.

Second I will try to review it this weekend and merge it. However, the merge will be done against the dev branch since master is always representing the released version.

Regarding testing, there is a huge gap between existing functionality and existing tests. I have to close this as soon as possible, see #8.

Edit: Test contributions are also very welcome ;-)