Skip to content

Commit 7d5647b

Browse files
committed
ktlint: Fix standard_argument-list-wrapping violations
Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
1 parent 9b7874f commit 7d5647b

28 files changed

Lines changed: 306 additions & 122 deletions

.editorconfig

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ ktlint_code_style = android_studio
1010
# https://pinterest.github.io/ktlint/latest/rules/standard/#function-naming
1111
ktlint_function_naming_ignore_when_annotated_with = Composable
1212

13-
ktlint_standard_argument-list-wrapping = disabled
1413
ktlint_standard_backing-property-naming = disabled
1514
ktlint_standard_chain-method-continuation = disabled
1615
ktlint_standard_class-signature = disabled

app/src/androidTest/java/org/schabi/newpipe/database/DatabaseMigrationTest.kt

Lines changed: 28 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -176,28 +176,32 @@ class DatabaseMigrationTest {
176176

177177
databaseInV7.run {
178178
insert(
179-
"search_history", SQLiteDatabase.CONFLICT_FAIL,
179+
"search_history",
180+
SQLiteDatabase.CONFLICT_FAIL,
180181
ContentValues().apply {
181182
put("service_id", serviceId)
182183
put("search", defaultSearch1)
183184
}
184185
)
185186
insert(
186-
"search_history", SQLiteDatabase.CONFLICT_FAIL,
187+
"search_history",
188+
SQLiteDatabase.CONFLICT_FAIL,
187189
ContentValues().apply {
188190
put("service_id", serviceId)
189191
put("search", defaultSearch2)
190192
}
191193
)
192194
insert(
193-
"search_history", SQLiteDatabase.CONFLICT_FAIL,
195+
"search_history",
196+
SQLiteDatabase.CONFLICT_FAIL,
194197
ContentValues().apply {
195198
put("service_id", otherServiceId)
196199
put("search", defaultSearch1)
197200
}
198201
)
199202
insert(
200-
"search_history", SQLiteDatabase.CONFLICT_FAIL,
203+
"search_history",
204+
SQLiteDatabase.CONFLICT_FAIL,
201205
ContentValues().apply {
202206
put("service_id", otherServiceId)
203207
put("search", defaultSearch2)
@@ -207,13 +211,17 @@ class DatabaseMigrationTest {
207211
}
208212

209213
testHelper.runMigrationsAndValidate(
210-
AppDatabase.DATABASE_NAME, Migrations.DB_VER_8,
211-
true, Migrations.MIGRATION_7_8
214+
AppDatabase.DATABASE_NAME,
215+
Migrations.DB_VER_8,
216+
true,
217+
Migrations.MIGRATION_7_8
212218
)
213219

214220
testHelper.runMigrationsAndValidate(
215-
AppDatabase.DATABASE_NAME, Migrations.DB_VER_9,
216-
true, Migrations.MIGRATION_8_9
221+
AppDatabase.DATABASE_NAME,
222+
Migrations.DB_VER_9,
223+
true,
224+
Migrations.MIGRATION_8_9
217225
)
218226

219227
val migratedDatabaseV8 = getMigratedDatabase()
@@ -235,41 +243,47 @@ class DatabaseMigrationTest {
235243
val remoteUid2: Long
236244
databaseInV8.run {
237245
localUid1 = insert(
238-
"playlists", SQLiteDatabase.CONFLICT_FAIL,
246+
"playlists",
247+
SQLiteDatabase.CONFLICT_FAIL,
239248
ContentValues().apply {
240249
put("name", DEFAULT_NAME + "1")
241250
put("is_thumbnail_permanent", false)
242251
put("thumbnail_stream_id", -1)
243252
}
244253
)
245254
localUid2 = insert(
246-
"playlists", SQLiteDatabase.CONFLICT_FAIL,
255+
"playlists",
256+
SQLiteDatabase.CONFLICT_FAIL,
247257
ContentValues().apply {
248258
put("name", DEFAULT_NAME + "2")
249259
put("is_thumbnail_permanent", false)
250260
put("thumbnail_stream_id", -1)
251261
}
252262
)
253263
delete(
254-
"playlists", "uid = ?",
264+
"playlists",
265+
"uid = ?",
255266
Array(1) { localUid1 }
256267
)
257268
remoteUid1 = insert(
258-
"remote_playlists", SQLiteDatabase.CONFLICT_FAIL,
269+
"remote_playlists",
270+
SQLiteDatabase.CONFLICT_FAIL,
259271
ContentValues().apply {
260272
put("service_id", DEFAULT_SERVICE_ID)
261273
put("url", DEFAULT_URL)
262274
}
263275
)
264276
remoteUid2 = insert(
265-
"remote_playlists", SQLiteDatabase.CONFLICT_FAIL,
277+
"remote_playlists",
278+
SQLiteDatabase.CONFLICT_FAIL,
266279
ContentValues().apply {
267280
put("service_id", DEFAULT_SECOND_SERVICE_ID)
268281
put("url", DEFAULT_SECOND_URL)
269282
}
270283
)
271284
delete(
272-
"remote_playlists", "uid = ?",
285+
"remote_playlists",
286+
"uid = ?",
273287
Array(1) { remoteUid2 }
274288
)
275289
close()

app/src/androidTest/java/org/schabi/newpipe/database/FeedDAOTest.kt

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,21 @@ class FeedDAOTest {
4040
private val stream7 = StreamEntity(7, serviceId, "https://youtube.com/watch?v=7", "stream 7", StreamType.VIDEO_STREAM, 1000, "channel-4", "https://youtube.com/channel/4", "https://i.ytimg.com/vi/1/hqdefault.jpg", 100, "2023-08-10", OffsetDateTime.parse("2023-08-10T00:00:00Z"))
4141

4242
private val allStreams = listOf(
43-
stream1, stream2, stream3, stream4, stream5, stream6, stream7
43+
stream1,
44+
stream2,
45+
stream3,
46+
stream4,
47+
stream5,
48+
stream6,
49+
stream7
4450
)
4551

4652
@Before
4753
fun createDb() {
4854
val context = ApplicationProvider.getApplicationContext<Context>()
4955
db = Room.inMemoryDatabaseBuilder(
50-
context, AppDatabase::class.java
56+
context,
57+
AppDatabase::class.java
5158
).build()
5259
feedDAO = db.feedDAO()
5360
streamDAO = db.streamDAO()
@@ -64,7 +71,10 @@ class FeedDAOTest {
6471
fun testUnlinkStreamsOlderThan_KeepOne() {
6572
setupUnlinkDelete("2023-08-15T00:00:00Z")
6673
val streams = feedDAO.getStreams(
67-
FeedGroupEntity.GROUP_ALL_ID, includePlayed = true, includePartiallyPlayed = true, null
74+
FeedGroupEntity.GROUP_ALL_ID,
75+
includePlayed = true,
76+
includePartiallyPlayed = true,
77+
null
6878
)
6979
.blockingGet()
7080
val allowedStreams = listOf(stream3, stream5, stream6, stream7)
@@ -75,7 +85,10 @@ class FeedDAOTest {
7585
fun testUnlinkStreamsOlderThan_KeepMultiple() {
7686
setupUnlinkDelete("2023-08-01T00:00:00Z")
7787
val streams = feedDAO.getStreams(
78-
FeedGroupEntity.GROUP_ALL_ID, includePlayed = true, includePartiallyPlayed = true, null
88+
FeedGroupEntity.GROUP_ALL_ID,
89+
includePlayed = true,
90+
includePartiallyPlayed = true,
91+
null
7992
)
8093
.blockingGet()
8194
val allowedStreams = listOf(stream3, stream4, stream5, stream6, stream7)

app/src/androidTest/java/org/schabi/newpipe/local/playlist/LocalPlaylistManagerTest.kt

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,12 @@ class LocalPlaylistManagerTest {
3333
fun createPlaylist() {
3434
val NEWPIPE_URL = "https://newpipe.net/"
3535
val stream = StreamEntity(
36-
serviceId = 1, url = NEWPIPE_URL, title = "title",
37-
streamType = StreamType.VIDEO_STREAM, duration = 1, uploader = "uploader",
36+
serviceId = 1,
37+
url = NEWPIPE_URL,
38+
title = "title",
39+
streamType = StreamType.VIDEO_STREAM,
40+
duration = 1,
41+
uploader = "uploader",
3842
uploaderUrl = NEWPIPE_URL
3943
)
4044

@@ -58,14 +62,22 @@ class LocalPlaylistManagerTest {
5862
@Test()
5963
fun createPlaylist_nonExistentStreamsAreUpserted() {
6064
val stream = StreamEntity(
61-
serviceId = 1, url = "https://newpipe.net/", title = "title",
62-
streamType = StreamType.VIDEO_STREAM, duration = 1, uploader = "uploader",
65+
serviceId = 1,
66+
url = "https://newpipe.net/",
67+
title = "title",
68+
streamType = StreamType.VIDEO_STREAM,
69+
duration = 1,
70+
uploader = "uploader",
6371
uploaderUrl = "https://newpipe.net/"
6472
)
6573
database.streamDAO().insert(stream)
6674
val upserted = StreamEntity(
67-
serviceId = 1, url = "https://newpipe.net/2", title = "title2",
68-
streamType = StreamType.VIDEO_STREAM, duration = 1, uploader = "uploader",
75+
serviceId = 1,
76+
url = "https://newpipe.net/2",
77+
title = "title2",
78+
streamType = StreamType.VIDEO_STREAM,
79+
duration = 1,
80+
uploader = "uploader",
6981
uploaderUrl = "https://newpipe.net/"
7082
)
7183

app/src/androidTest/java/org/schabi/newpipe/util/StreamItemAdapterTest.kt

Lines changed: 36 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -156,41 +156,51 @@ class StreamItemAdapterTest {
156156

157157
helper.assertInvalidResponse(getResponse(mapOf(Pair("content-length", "mp3"))), 0)
158158
helper.assertInvalidResponse(
159-
getResponse(mapOf(Pair("Content-Disposition", "filename=\"train.png\""))), 1
159+
getResponse(mapOf(Pair("Content-Disposition", "filename=\"train.png\""))),
160+
1
160161
)
161162
helper.assertInvalidResponse(
162-
getResponse(mapOf(Pair("Content-Disposition", "form-data; name=\"data.csv\""))), 2
163+
getResponse(mapOf(Pair("Content-Disposition", "form-data; name=\"data.csv\""))),
164+
2
163165
)
164166
helper.assertInvalidResponse(
165-
getResponse(mapOf(Pair("Content-Disposition", "form-data; filename=\"data.csv\""))), 3
167+
getResponse(mapOf(Pair("Content-Disposition", "form-data; filename=\"data.csv\""))),
168+
3
166169
)
167170
helper.assertInvalidResponse(
168-
getResponse(mapOf(Pair("Content-Disposition", "form-data; name=\"fieldName\"; filename*=\"filename.jpg\""))), 4
171+
getResponse(mapOf(Pair("Content-Disposition", "form-data; name=\"fieldName\"; filename*=\"filename.jpg\""))),
172+
4
169173
)
170174

171175
helper.assertValidResponse(
172176
getResponse(mapOf(Pair("Content-Disposition", "filename=\"train.ogg\""))),
173-
5, MediaFormat.OGG
177+
5,
178+
MediaFormat.OGG
174179
)
175180
helper.assertValidResponse(
176181
getResponse(mapOf(Pair("Content-Disposition", "some-form-data; filename=\"audio.flac\""))),
177-
6, MediaFormat.FLAC
182+
6,
183+
MediaFormat.FLAC
178184
)
179185
helper.assertValidResponse(
180186
getResponse(mapOf(Pair("Content-Disposition", "form-data; name=\"audio.aiff\"; filename=\"audio.aiff\""))),
181-
7, MediaFormat.AIFF
187+
7,
188+
MediaFormat.AIFF
182189
)
183190
helper.assertValidResponse(
184191
getResponse(mapOf(Pair("Content-Disposition", "form-data; name=\"alien?\"; filename*=UTF-8''%CE%B1%CE%BB%CE%B9%CF%B5%CE%BD.m4a"))),
185-
8, MediaFormat.M4A
192+
8,
193+
MediaFormat.M4A
186194
)
187195
helper.assertValidResponse(
188196
getResponse(mapOf(Pair("Content-Disposition", "form-data; name=\"audio.mp3\"; filename=\"audio.opus\"; filename*=UTF-8''alien.opus"))),
189-
9, MediaFormat.OPUS
197+
9,
198+
MediaFormat.OPUS
190199
)
191200
helper.assertValidResponse(
192201
getResponse(mapOf(Pair("Content-Disposition", "form-data; name=\"audio.mp3\"; filename=\"audio.opus\"; filename*=\"UTF-8''alien.opus\""))),
193-
10, MediaFormat.OPUS
202+
10,
203+
MediaFormat.OPUS
194204
)
195205
}
196206

@@ -213,16 +223,24 @@ class StreamItemAdapterTest {
213223
helper.assertInvalidResponse(getResponse(mapOf()), 7)
214224

215225
helper.assertValidResponse(
216-
getResponse(mapOf(Pair("Content-Type", "audio/flac"))), 8, MediaFormat.FLAC
226+
getResponse(mapOf(Pair("Content-Type", "audio/flac"))),
227+
8,
228+
MediaFormat.FLAC
217229
)
218230
helper.assertValidResponse(
219-
getResponse(mapOf(Pair("Content-Type", "audio/wav"))), 9, MediaFormat.WAV
231+
getResponse(mapOf(Pair("Content-Type", "audio/wav"))),
232+
9,
233+
MediaFormat.WAV
220234
)
221235
helper.assertValidResponse(
222-
getResponse(mapOf(Pair("Content-Type", "audio/opus"))), 10, MediaFormat.OPUS
236+
getResponse(mapOf(Pair("Content-Type", "audio/opus"))),
237+
10,
238+
MediaFormat.OPUS
223239
)
224240
helper.assertValidResponse(
225-
getResponse(mapOf(Pair("Content-Type", "audio/aiff"))), 11, MediaFormat.AIFF
241+
getResponse(mapOf(Pair("Content-Type", "audio/aiff"))),
242+
11,
243+
MediaFormat.AIFF
226244
)
227245
}
228246

@@ -345,7 +363,8 @@ class StreamItemAdapterTest {
345363
index: Int
346364
) {
347365
assertFalse(
348-
"invalid header returns valid value", retrieveMediaFormat(streams[index], response)
366+
"invalid header returns valid value",
367+
retrieveMediaFormat(streams[index], response)
349368
)
350369
assertNull("Media format extracted although stated otherwise", wrapper.getFormat(index))
351370
}
@@ -359,7 +378,8 @@ class StreamItemAdapterTest {
359378
format: MediaFormat
360379
) {
361380
assertTrue(
362-
"header was not recognized", retrieveMediaFormat(streams[index], response)
381+
"header was not recognized",
382+
retrieveMediaFormat(streams[index], response)
363383
)
364384
assertEquals("Wrong media format extracted", format, wrapper.getFormat(index))
365385
}

app/src/main/java/org/schabi/newpipe/NewVersionWorker.kt

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ class NewVersionWorker(
4646
// Show toast stating that the app is up-to-date if the update check was manual.
4747
ContextCompat.getMainExecutor(applicationContext).execute {
4848
Toast.makeText(
49-
applicationContext, R.string.app_update_unavailable_toast,
49+
applicationContext,
50+
R.string.app_update_unavailable_toast,
5051
Toast.LENGTH_SHORT
5152
).show()
5253
}
@@ -58,7 +59,11 @@ class NewVersionWorker(
5859
val intent = Intent(Intent.ACTION_VIEW, apkLocationUrl?.toUri())
5960
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
6061
val pendingIntent = PendingIntentCompat.getActivity(
61-
applicationContext, 0, intent, 0, false
62+
applicationContext,
63+
0,
64+
intent,
65+
0,
66+
false
6267
)
6368
val channelId = applicationContext.getString(R.string.app_update_notification_channel_id)
6469
val notificationBuilder = NotificationCompat.Builder(applicationContext, channelId)
@@ -71,7 +76,8 @@ class NewVersionWorker(
7176
)
7277
.setContentText(
7378
applicationContext.getString(
74-
R.string.app_update_available_notification_text, versionName
79+
R.string.app_update_available_notification_text,
80+
versionName
7581
)
7682
)
7783

0 commit comments

Comments
 (0)