Skip to content

Commit

Permalink
Auto Formatter (#476)
Browse files Browse the repository at this point in the history
  • Loading branch information
jsarabia authored Jan 12, 2022
1 parent 3bd13b3 commit 0c4cda5
Show file tree
Hide file tree
Showing 53 changed files with 44 additions and 72 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@ package org.wycliffeassociates.otter.assets.initialization
import io.reactivex.Completable
import java.io.File
import org.slf4j.LoggerFactory
import org.wycliffeassociates.otter.common.domain.resourcecontainer.ImportException
import org.wycliffeassociates.otter.common.domain.resourcecontainer.ImportResourceContainer
import org.wycliffeassociates.otter.common.domain.resourcecontainer.ImportResult
import org.wycliffeassociates.otter.common.persistence.config.Installable
import org.wycliffeassociates.otter.common.persistence.repositories.IInstalledEntityRepository
import javax.inject.Inject
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ import org.yellowcouch.javazoom.RandomAccessDecoder
private const val MP3_BUFFER_SIZE = 24576

internal class MP3FileReader(
val file: File, start: Int? = null, end: Int? = null
val file: File,
start: Int? = null,
end: Int? = null
) : AudioFormatStrategy, AudioFileReader {

private var decoder: RandomAccessDecoder? = RandomAccessDecoder(file.absolutePath)
Expand Down Expand Up @@ -114,7 +116,6 @@ internal class MP3FileReader(
}

override fun open() {

}

override fun release() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,6 @@ open class CueChunk : RiffChunk {
val subchunkLabel = chunk.getText(CHUNK_LABEL_SIZE)
val subchunkSize = chunk.int


if (subchunkSize < 0) {
throw InvalidWavFileException("Chunk $subchunkLabel has a negative size of $subchunkSize")
}
Expand Down Expand Up @@ -210,7 +209,7 @@ open class CueChunk : RiffChunk {
addParsedCues(cueListBuilder)
}

open internal fun addParsedCues(cueListBuilder: CueListBuilder) {
internal open fun addParsedCues(cueListBuilder: CueListBuilder) {
cues as MutableList
cues.clear()
cues.addAll(cueListBuilder.build())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ internal class WavFileReader(val wav: WavFile, val start: Int? = null, val end:
fun computeBounds(wav: WavFile): Pair<Int, Int> {
if (wav.file.length() <= WAV_HEADER_SIZE) {
logger.info("Wav file ${wav.file.name} is just a header or empty, size is ${wav.file.length()}")
return Pair(0,0)
return Pair(0, 0)
}

val totalFrames = wav.totalFrames
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ enum class ImageRatio(val width: Int, val height: Int) {

override fun toString(): String {
return if (this != DEFAULT) {
"${width}x${height}"
"${width}x$height"
} else ""
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class SourceAudioAccessor(
return if (rc.media != null && media.chapterUrl.isNotEmpty()) {
val path = media.chapterUrl.replace("{chapter}", chapter.toString())
if (rc.accessor.fileExists(path)) {
val file = when(cache.containsKey(path)) {
val file = when (cache.containsKey(path)) {
true -> cache[path]!!
false -> {
val temp = File(dir, File(path).name).apply { createNewFile() }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
package org.wycliffeassociates.otter.common.domain.resourcecontainer.project.markdown

import java.io.BufferedReader
import java.util.regex.Pattern

// TODO: Add Help type enum to HelpResource? (tn, tq)
data class HelpResource(var title: String, var body: String)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ class LocaleLanguageTest {
Mockito.`when`(appPref.localeLanguage()).thenReturn(Single.just(spanish.slug))

Assert.assertEquals(localeLanguage.preferredLanguage, spanish)

}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ class TestBibleArtworkDataSource {
val image = dataSource.getArtwork(metadataMock, project, ratio4x3)

assertNotNull(
"Could not get artwork image (${ratioString}) for $project",
"Could not get artwork image ($ratioString) for $project",
image
)
assertTrue(
Expand All @@ -102,8 +102,8 @@ class TestBibleArtworkDataSource {

val dataSource = BibleArtworkDataSource(directoryProviderMock, imagesContainerName)
val notFoundImage = dataSource.getArtwork(metadataMock, genSlug)
val nonBibleNotFoundImage = dataSource.getArtwork(metadataMock, nonBibleProject)
val remoteImageNotFound = dataSource.getArtwork(metadataMock, remoteContentProject)
val nonBibleNotFoundImage = dataSource.getArtwork(metadataMock, nonBibleProject)
val remoteImageNotFound = dataSource.getArtwork(metadataMock, remoteContentProject)

assertNull(
"Project '$genSlug' should not have image in data source",
Expand All @@ -127,7 +127,7 @@ class TestBibleArtworkDataSource {
val image = dataSource.getArtwork(metadataMock, project, ratio16x9)

assertNotNull(
"Could not get default image (${ratioString}) for $project",
"Could not get default image ($ratioString) for $project",
image
)
assertFalse(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ class TestResourceContainerArtworkDataSource {
val image = dataSource.getArtwork(metadataMock, project, ratio16x9)

assertNotNull(
"Could not get default image (${ratioString}) for $project",
"Could not get default image ($ratioString) for $project",
image
)
assertFalse(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ class ProjectFilesAccessorTest {
)
}

ZipFile(target).use{ zip ->
ZipFile(target).use { zip ->
val zipEntries = zip.entries().toList()
val hasNoMedia = zipEntries.all { entry ->
File(entry.name).extension !in ProjectFilesAccessor.ignoredSourceMediaExtensions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ import org.wycliffeassociates.otter.common.data.workbook.ResourceGroup
import org.wycliffeassociates.otter.common.data.workbook.Take
import org.wycliffeassociates.otter.common.data.workbook.TakeHolder
import org.wycliffeassociates.otter.common.data.workbook.Workbook
import org.wycliffeassociates.otter.common.persistence.IDirectoryProvider
import org.wycliffeassociates.otter.common.persistence.repositories.WorkbookRepository.IDatabaseAccessors

class TestWorkbookRepository {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import javafx.scene.Node
import javafx.scene.control.ListView
import javafx.util.Duration

class ListAnimationMediator<T: Node> {
class ListAnimationMediator<T : Node> {

var listView: ListView<T>? = null
var node: T? = null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class ListViewPlaceHolder : ListView<Any?>() {
addClass("wa-list-view")
items.add(null)
setCellFactory {
object: ListCell<Any?>() {
object : ListCell<Any?>() {
override fun updateItem(item: Any?, empty: Boolean) {
super.updateItem(item, empty)
graphic = EmptyCardCell().apply {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ class AudioPlayerController(
logger.error("Error in startProgressUpdate", e)
}
.subscribe {
if (player?.isPlaying() == true){
if (player?.isPlaying() == true) {
isPlayingProperty.set(true)
} else {
isPlayingProperty.set(false)
Expand Down Expand Up @@ -170,7 +170,7 @@ class AudioPlayerController(

fun seek(location: Int) {
audioSlider.value = location.toDouble()

player?.let {
it.seek(location)
if (!it.isPlaying()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,6 @@ class SimpleAudioPlayer(
label {
hgrow = Priority.ALWAYS
text = title

}
tooltip(title)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ class ResumeBookBannerSkin(private val banner: ResumeBookBanner) : SkinBase<Resu
bookTitle.textProperty().bind(banner.bookTitleProperty)
sourceLanguageText.textProperty().bind(banner.sourceLanguageProperty)
targetLanguageText.textProperty().bind(banner.targetLanguageProperty)
resumeButton.apply{
resumeButton.apply {
textProperty().bind(banner.resumeTextProperty)
tooltip {
textProperty().bind(this@apply.textProperty())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ class AppBarButtonSkin(private val button: ToggleButton) : SkinBase<ToggleButton
}
btnLabel.apply {
textProperty().bind(button.textProperty())

}
btnIcon.apply {
graphicProperty().bind(button.graphicProperty())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ class SourceContentSkin(private val sourceContent: SourceContent) : SkinBase<Sou
}

private fun initControllers() {

}

private fun initAudioControls() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import org.wycliffeassociates.otter.common.device.AudioPlayerEvent
import org.wycliffeassociates.otter.common.device.IAudioPlayer
import org.wycliffeassociates.otter.common.device.IAudioPlayerListener


class AudioBufferPlayer(
private val player: SourceDataLine?,
private val errorRelay: PublishRelay<AudioError> = PublishRelay.create()
Expand Down Expand Up @@ -166,7 +165,6 @@ class AudioBufferPlayer(
}

override fun close() {

}

override fun release() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ class AudioConnectionFactory(
return playerConnectionFactory.getPlayer()
}


fun getRecorder(): IAudioRecorder {
return recorderConnectionFactory.getRecorder()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ class AudioDeviceProvider(private val audioFormat: AudioFormat) {
}.toList().map { it }
}


private fun getInputDevices(): List<Mixer.Info> {
val mixers = AudioSystem
.getMixerInfo()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class WaveformFrame(
fitToParentHeight()
hbox {
viewModel.waveformContainerNode = this@hbox
val disposable = viewModel.waveform
val disposable = viewModel.waveform
.observeOnFx()
.subscribe {
this@hbox.add(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ class VerseMarkerViewModel : ViewModel() {
audioPlayer.close()
return markers.writeMarkers()
}

fun saveAndQuit() {
compositeDisposable.clear()

Expand All @@ -184,7 +184,7 @@ class VerseMarkerViewModel : ViewModel() {
.doOnError { e ->
logger.error("Error in closing the maker app", e)
}
.delay(300, TimeUnit.MILLISECONDS) // exec after UI clean up
.delay(300, TimeUnit.MILLISECONDS) // exec after UI clean up
.subscribe {
runLater {
it.navigateBack()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@
*/
package integrationtest.projects

import com.fasterxml.jackson.annotation.JsonProperty
import com.fasterxml.jackson.annotation.JsonPropertyOrder
import com.fasterxml.jackson.databind.MappingIterator
import com.fasterxml.jackson.dataformat.csv.CsvMapper
import com.fasterxml.jackson.dataformat.csv.CsvSchema
Expand Down Expand Up @@ -161,8 +159,6 @@ class TestRcImport {
)
}



@Test
fun ulbSlugs() {
dbEnvProvider.get()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,8 @@ class LanguageDao(
val transactionDsl = DSL.using(config)
entities.forEach { entity ->
// Update region of the language entity
transactionDsl.
update(LANGUAGE_ENTITY)
transactionDsl
.update(LANGUAGE_ENTITY)
.set(LANGUAGE_ENTITY.REGION, entity.region)
.where(LANGUAGE_ENTITY.SLUG.eq(entity.slug))
.execute()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ class AppPreferencesRepository @Inject constructor(
return preferences.setLastResource(resource)
}


override fun getInputDevice(): Single<String> {
return preferences
.audioInputDevice()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,14 @@ class NavigationMediator : Component(), ScopedInstance {

init {
subscribe<PluginOpenedEvent> {
when(it.type) {
when (it.type) {
PluginType.RECORDER -> breadCrumbsBar.addItem(recorderBreadCrumb)
PluginType.EDITOR -> breadCrumbsBar.addItem(editorBreadCrumb)
PluginType.MARKER -> breadCrumbsBar.addItem(markerBreadCrumb)
}
}
subscribe<PluginClosedEvent> {
when(it.type) {
when (it.type) {
PluginType.RECORDER -> breadCrumbsBar.removeItem(recorderBreadCrumb)
PluginType.EDITOR -> breadCrumbsBar.removeItem(editorBreadCrumb)
PluginType.MARKER -> breadCrumbsBar.removeItem(markerBreadCrumb)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ class OtterExceptionHandler(
environment.getSystemData().forEach {
scope.setTag(it.first, it.second)
}
scope.addAttachment(Attachment(File(directoryProvider.logsDirectory,"orature.log").absolutePath))
scope.addAttachment(Attachment(File(directoryProvider.logsDirectory, "orature.log").absolutePath))

Sentry.captureException(error)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ class AppBar : Fragment() {
}
}

private inline fun <reified T: UIComponent> toggleOpen(isActive: Boolean) {
private inline fun <reified T : UIComponent> toggleOpen(isActive: Boolean) {
when (isActive) {
true -> fire(DrawerEvent(T::class, DrawerEventAction.OPEN))
false -> fire(DrawerEvent(T::class, DrawerEventAction.CLOSE))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package org.wycliffeassociates.otter.jvm.workbookapp.ui.components

import javafx.scene.control.ListCell
import org.kordamp.ikonli.javafx.FontIcon
import javax.sound.sampled.Mixer

class DeviceComboboxCell(private val icon: FontIcon) : ListCell<String>() {
val view = ComboboxButton()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ package org.wycliffeassociates.otter.jvm.workbookapp.ui.components.drawer
import tornadofx.*
import kotlin.reflect.KClass

class DrawerEvent<T: UIComponent>(val type: KClass<T>, val action: DrawerEventAction): FXEvent()
class DrawerEvent<T : UIComponent>(val type: KClass<T>, val action: DrawerEventAction) : FXEvent()
enum class DrawerEventAction {
OPEN,
CLOSE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ class InfoView : View() {
scrollpane {
addClass("app-drawer__scroll-pane")


vbox {
isFitToWidth = true

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ class SettingsView : View() {
label(messages["playbackSettings"]).apply {
addClass("app-drawer__subtitle--small")
}

combobox(viewModel.selectedOutputDeviceProperty, viewModel.outputDevices) {
addClass("wa-combobox")
fitToParentWidth()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ import tornadofx.FXEvent
import tornadofx.UIComponent
import kotlin.reflect.KClass

class ThemeColorEvent<T: UIComponent>(val type: KClass<T>, val data: ColorTheme): FXEvent()
class ThemeColorEvent<T : UIComponent>(val type: KClass<T>, val data: ColorTheme) : FXEvent()
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,4 @@ class BookCardData(val collection: Collection, artwork: Observable<Artwork>) {
)
}
}

}

Loading

0 comments on commit 0c4cda5

Please sign in to comment.