diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 873c1780f..f61e320c9 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -12,57 +12,53 @@ add a comment to it. You'll see exactly what is sent, the system is 100% transpa ## Issue reporting/feature requests * Search the [existing issues](https://github.com/TeamNewPipe/NewPipe/issues) first to make sure your issue/feature -hasn't been reported/requested before -* Check whether your issue/feature is already fixed/implemented -* Check if the issue still exists in the latest release/beta version -* If you are an Android/Java developer, you are always welcome to fix/implement an issue/a feature yourself. PRs welcome! +hasn't been reported/requested before. +* Check whether your issue/feature is already fixed/implemented. +* Check if the issue still exists in the latest release/beta version. +* If you are an Android/Java developer, you are always welcome to fix an issue or implement a feature yourself. PRs welcome! * We use English for development. Issues in other languages will be closed and ignored. * Please only add *one* issue at a time. Do not put multiple issues into one thread. -* When reporting a bug please give us a context, and a description how to reproduce it. -* Issues that only contain a generated bug report, but no description might be closed. +* Follow the template! Issues or feature requests not matching the template might be closed. ## Bug Fixing * If you want to help NewPipe to become free of bugs (this is our utopic goal for NewPipe), you can send us an email to -tnp@newpipe.schabi.org to let me know that you intend to help. We'll send you further instructions. You may, on request, -register at our [Sentry](https://sentry.schabi.org) instance (see section "Crash reporting" for more information. +tnp@newpipe.schabi.org to let us know that you intend to help. We'll send you further instructions. You may, on request, +register at our [Sentry](https://sentry.schabi.org) instance (see section "Crash reporting" for more information). ## Translation -* NewPipe can be translated via [Weblate](https://hosted.weblate.org/projects/newpipe/strings/). You can log in there +* NewPipe is translated via [Weblate](https://hosted.weblate.org/projects/newpipe/strings/). You can log in there with your GitHub account. +* If the language you want to translate is not on Weblate, you can add it: see [How to add a new language](https://github.com/TeamNewPipe/NewPipe/wiki/How-to-add-a-new-language-to-NewPipe) in the wiki. ## Code contribution -* Stick to NewPipe's style conventions (well, just look the other code and then do it the same way :)) -* Do not bring non-free software (e.g., binary blobs) into the project. Also, make sure you do not introduce Google +* Stick to NewPipe's style conventions: follow [checkStyle](https://github.com/checkstyle/checkstyle). It will run each time you build the project. +* Do not bring non-free software (e.g. binary blobs) into the project. Also, make sure you do not introduce Google libraries. -* Stick to [F-Droid contribution guidelines](https://f-droid.org/wiki/page/Inclusion_Policy) -* Make changes on a separate branch, not on the master branch. This is commonly known as *feature branch workflow*. You - may then send your changes as a pull request on GitHub. Patches to the email address mentioned in this document might - not be considered, GitHub is the primary platform. (This only affects you if you are a member of TeamNewPipe) +* Stick to [F-Droid contribution guidelines](https://f-droid.org/wiki/page/Inclusion_Policy). +* Make changes on a separate branch with a meaningful name, not on the master neither dev branch. This is commonly known as *feature branch workflow*. You + may then send your changes as a pull request (PR) on GitHub. * When submitting changes, you confirm that your code is licensed under the terms of the [GNU General Public License v3](https://www.gnu.org/licenses/gpl-3.0.html). * Please test (compile and run) your code before you submit changes! Ideally, provide test feedback in the PR description. Untested code will **not** be merged! * Try to figure out yourself why builds on our CI fail. * Make sure your PR is up-to-date with the rest of the code. Often, a simple click on "Update branch" will do the job, - but if not, you are asked to merge the master branch manually and resolve the problems on your own. That will make the + but if not, you are asked to rebase the dev branch manually and resolve the problems on your own. You can find help [on the wiki](https://github.com/TeamNewPipe/NewPipe/wiki/How-to-merge-a-PR). That will make the maintainers' jobs way easier. * Please show intention to maintain your features and code after you contributed it. Unmaintained code is a hassle for the core developers, and just adds work. If you do not intend to maintain features you contributed, please think again about submission, or clearly state that in the description of your PR. * Respond yourselves if someone requests changes or otherwise raises issues about your PRs. -* Check if your contributions align with the [fdroid inclusion guidelines](https://f-droid.org/en/docs/Inclusion_Policy/). -* Check if your submission can be build with the current fdroid build server setup. * Send PR that only cover one specific issue/solution/bug. Do not send PRs that are huge and consists of multiple independent solutions. ## Communication -* WE DO NOW HAVE A MAILING LIST: [newpipe@list.schabi.org](https://list.schabi.org/cgi-bin/mailman/listinfo/newpipe). * There is an IRC channel on Freenode which is regularly visited by the core team and other developers: [#newpipe](irc:irc.freenode.net/newpipe). [Click here for Webchat](https://webchat.freenode.net/?channels=newpipe)! * If you want to get in touch with the core team or one of our other contributors you can send an email to - tnp(at)schabi.org. Please do not send issue reports, they will be ignored and remain unanswered! Use the GitHub issue + tnp@newpipe.schabi.org. Please do not send issue reports, they will be ignored and remain unanswered! Use the GitHub issue tracker described above! -* Feel free to post suggestions, changes, ideas etc. on GitHub, IRC or the mailing list! +* Feel free to post suggestions, changes, ideas etc. on GitHub or IRC! diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md index 89fe58658..90134a204 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -7,22 +7,33 @@ assignees: '' --- -#### Is your feature request related to a problem? Please describe it -A clear and concise description of what the problem is. -Example: *I want to do X, but there is no way to do it.* -#### Describe the solution you'd like -A clear and concise description of what you want to happen. + + +#### Describe the feature you want + + + + +#### Is your feature request related to a problem? Please describe it + + + #### Additional context -Add any other context or screenshots about the feature request here. -Example: *Here's a photo of my cat!* + + + #### How will you/everyone benefit from this feature? -Convince us! How does it change your NewPipe experience and/or your life? + + + diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 9a1193767..f12eb2fe8 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1,10 +1,12 @@ #### What is it? -- [ ] Bug fix -- [ ] Feature +- [ ] Bug fix (user facing) +- [ ] Feature (user facing) +- [ ] Code base improvement (dev facing) +- [ ] Meta improvement to the project (dev facing) -#### Long description of the changes in your PR +#### Description of the changes in your PR - record videos - create clones diff --git a/app/build.gradle b/app/build.gradle index 92c00c372..baa11bd20 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -2,6 +2,7 @@ apply plugin: 'com.android.application' apply plugin: 'kotlin-android' apply plugin: 'kotlin-android-extensions' apply plugin: 'kotlin-kapt' +apply plugin: 'checkstyle' android { compileSdkVersion 28 @@ -12,8 +13,8 @@ android { resValue "string", "app_name", "NewPipe" minSdkVersion 19 targetSdkVersion 28 - versionCode 910 - versionName "0.19.1" + versionCode 920 + versionName "0.19.2" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" vectorDrawables.useSupportLibrary = true @@ -46,6 +47,7 @@ android { } else { applicationIdSuffix ".debug." + normalizedWorkingBranch resValue "string", "app_name", "NewPipe " + workingBranch + archivesBaseName = 'NewPipe_' + normalizedWorkingBranch } } } @@ -81,11 +83,53 @@ ext { icepickLibVersion = '3.2.0' stethoLibVersion = '1.5.0' markwonVersion = '4.2.1' + checkstyleVersion = '8.31' } +checkstyle { + configFile rootProject.file('checkstyle.xml') + ignoreFailures false + showViolations true + toolVersion = "${checkstyleVersion}" +} + +task runCheckstyle(type: Checkstyle) { + source 'src' + include '**/*.java' + exclude '**/gen/**' + exclude '**/R.java' + exclude '**/BuildConfig.java' + exclude 'main/java/us/shandian/giga/**' + + // empty classpath + classpath = files() + + showViolations true + + reports { + xml.enabled true + html.enabled true + } +} + +tasks.withType(Checkstyle).each { + checkstyleTask -> checkstyleTask.doLast { + reports.all { report -> + def outputFile = report.destination + if (outputFile.exists() && outputFile.text.contains("severity=\"error\"")) { + throw new GradleException("There were checkstyle errors! For more info check $outputFile") + } + } + } +} + +preBuild.dependsOn runCheckstyle + dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" + implementation "com.puppycrawl.tools:checkstyle:${checkstyleVersion}" + androidTestImplementation 'androidx.test.ext:junit:1.1.1' androidTestImplementation "android.arch.persistence.room:testing:1.1.1" androidTestImplementation('androidx.test.espresso:espresso-core:3.1.0', { @@ -164,4 +208,4 @@ static String getGitWorkingBranch() { // git was not found return "" } -} \ No newline at end of file +} diff --git a/app/src/androidTest/java/org/schabi/newpipe/database/AppDatabaseTest.kt b/app/src/androidTest/java/org/schabi/newpipe/database/AppDatabaseTest.kt index 2b7dcdf7c..917a83bf2 100644 --- a/app/src/androidTest/java/org/schabi/newpipe/database/AppDatabaseTest.kt +++ b/app/src/androidTest/java/org/schabi/newpipe/database/AppDatabaseTest.kt @@ -30,8 +30,9 @@ class AppDatabaseTest { private const val DEFAULT_SECOND_URL = "https://www.youtube.com/watch?v=ncQU6iBn5Fc" } - @get:Rule val testHelper = MigrationTestHelper(InstrumentationRegistry.getInstrumentation(), - AppDatabase::class.java.canonicalName, FrameworkSQLiteOpenHelperFactory()); + @get:Rule + val testHelper = MigrationTestHelper(InstrumentationRegistry.getInstrumentation(), + AppDatabase::class.java.canonicalName, FrameworkSQLiteOpenHelperFactory()) @Test fun migrateDatabaseFrom2to3() { @@ -72,7 +73,7 @@ class AppDatabaseTest { } testHelper.runMigrationsAndValidate(AppDatabase.DATABASE_NAME, Migrations.DB_VER_3, - true, Migrations.MIGRATION_2_3); + true, Migrations.MIGRATION_2_3) val migratedDatabaseV3 = getMigratedDatabase() val listFromDB = migratedDatabaseV3.streamDAO().all.blockingFirst() diff --git a/app/src/androidTest/java/org/schabi/newpipe/report/ErrorInfoTest.java b/app/src/androidTest/java/org/schabi/newpipe/report/ErrorInfoTest.java index 6e51136c0..ab20d2ff3 100644 --- a/app/src/androidTest/java/org/schabi/newpipe/report/ErrorInfoTest.java +++ b/app/src/androidTest/java/org/schabi/newpipe/report/ErrorInfoTest.java @@ -1,8 +1,9 @@ package org.schabi.newpipe.report; import android.os.Parcel; -import androidx.test.filters.LargeTest; + import androidx.test.ext.junit.runners.AndroidJUnit4; +import androidx.test.filters.LargeTest; import org.junit.Test; import org.junit.runner.RunWith; @@ -12,15 +13,16 @@ import org.schabi.newpipe.report.ErrorActivity.ErrorInfo; import static org.junit.Assert.assertEquals; /** - * Instrumented tests for {@link ErrorInfo} + * Instrumented tests for {@link ErrorInfo}. */ @RunWith(AndroidJUnit4.class) @LargeTest public class ErrorInfoTest { @Test - public void errorInfo_testParcelable() { - ErrorInfo info = ErrorInfo.make(UserAction.USER_REPORT, "youtube", "request", R.string.general_error); + public void errorInfoTestParcelable() { + ErrorInfo info = ErrorInfo.make(UserAction.USER_REPORT, "youtube", "request", + R.string.general_error); // Obtain a Parcel object and write the parcelable object to it: Parcel parcel = Parcel.obtain(); info.writeToParcel(parcel, 0); @@ -34,4 +36,4 @@ public class ErrorInfoTest { parcel.recycle(); } -} \ No newline at end of file +} diff --git a/app/src/debug/java/org/schabi/newpipe/DebugApp.java b/app/src/debug/java/org/schabi/newpipe/DebugApp.java index 66f73d1e9..4d763aeb1 100644 --- a/app/src/debug/java/org/schabi/newpipe/DebugApp.java +++ b/app/src/debug/java/org/schabi/newpipe/DebugApp.java @@ -3,6 +3,7 @@ package org.schabi.newpipe; import android.content.Context; import android.content.SharedPreferences; import android.preference.PreferenceManager; + import androidx.annotation.NonNull; import androidx.multidex.MultiDex; @@ -26,7 +27,7 @@ public class DebugApp extends App { private static final String TAG = DebugApp.class.toString(); @Override - protected void attachBaseContext(Context base) { + protected void attachBaseContext(final Context base) { super.attachBaseContext(base); MultiDex.install(this); } diff --git a/app/src/main/java/androidx/fragment/app/FragmentStatePagerAdapterMenuWorkaround.java b/app/src/main/java/androidx/fragment/app/FragmentStatePagerAdapterMenuWorkaround.java index 9fd32b735..11f457b6c 100644 --- a/app/src/main/java/androidx/fragment/app/FragmentStatePagerAdapterMenuWorkaround.java +++ b/app/src/main/java/androidx/fragment/app/FragmentStatePagerAdapterMenuWorkaround.java @@ -38,12 +38,15 @@ import java.util.ArrayList; * This is a copy from {@link androidx.fragment.app.FragmentStatePagerAdapter}. *

* It includes a workaround to fix the menu visibility when the adapter is restored. + *

*

* When restoring the state of this adapter, all the fragments' menu visibility were set to false, - * effectively disabling the menu from the user until he switched pages or another event that triggered the - * menu to be visible again happened. + * effectively disabling the menu from the user until he switched pages or another event + * that triggered the menu to be visible again happened. + *

*

- *
Check out the changes in: + * Check out the changes in: + *

*