From 1508e27b13557a9b8f55c325e37176967da79398 Mon Sep 17 00:00:00 2001 From: Abdelilah El Aissaoui Date: Wed, 5 Jan 2022 03:19:52 +0100 Subject: [PATCH] Fixed warnings and removed unused code --- src/main/kotlin/app/git/graph/GraphNode.kt | 54 ------------------- .../git/graph/UncommitedChangesGraphNode.kt | 2 - src/main/kotlin/app/ui/RepositoryOpen.kt | 3 +- src/main/kotlin/app/ui/UncommitedChanges.kt | 4 +- .../kotlin/app/ui/dialogs/SettingsDialog.kt | 2 - src/main/kotlin/app/ui/log/Log.kt | 4 -- 6 files changed, 2 insertions(+), 67 deletions(-) diff --git a/src/main/kotlin/app/git/graph/GraphNode.kt b/src/main/kotlin/app/git/graph/GraphNode.kt index e6afca3..1f90cd8 100644 --- a/src/main/kotlin/app/git/graph/GraphNode.kt +++ b/src/main/kotlin/app/git/graph/GraphNode.kt @@ -1,5 +1,3 @@ -@file:Suppress("unused") - package app.git.graph import org.eclipse.jgit.lib.AnyObjectId @@ -68,58 +66,6 @@ open class GraphNode(id: AnyObjectId?) : RevCommit(id), IGraphNode { return children.size } - /** - * Get the nth child from this commit's child list. - * - * @param nth - * child index to obtain. Must be in the range 0 through - * [.getChildCount]-1. - * @return the specified child. - * @throws ArrayIndexOutOfBoundsException - * an invalid child index was specified. - */ - fun getChild(nth: Int): GraphNode { - return children[nth] - } - - /** - * Determine if the given commit is a child (descendant) of this commit. - * - * @param c - * the commit to test. - * @return true if the given commit built on top of this commit. - */ - fun isChild(c: GraphNode): Boolean { - for (a in children) - if (a === c) - return true - - return false - } - - /** - * Get the number of refs for this commit. - * - * @return number of refs; always a positive value but can be 0. - */ - fun getRefCount(): Int { - return refs.size - } - - /** - * Get the nth Ref from this commit's ref list. - * - * @param nth - * ref index to obtain. Must be in the range 0 through - * [.getRefCount]-1. - * @return the specified ref. - * @throws ArrayIndexOutOfBoundsException - * an invalid ref index was specified. - */ - fun getRef(nth: Int): Ref { - return refs[nth] - } - /** {@inheritDoc} */ override fun reset() { diff --git a/src/main/kotlin/app/git/graph/UncommitedChangesGraphNode.kt b/src/main/kotlin/app/git/graph/UncommitedChangesGraphNode.kt index a564ed9..f1218db 100644 --- a/src/main/kotlin/app/git/graph/UncommitedChangesGraphNode.kt +++ b/src/main/kotlin/app/git/graph/UncommitedChangesGraphNode.kt @@ -1,5 +1,3 @@ -@file:Suppress("unused") - package app.git.graph import org.eclipse.jgit.lib.ObjectId diff --git a/src/main/kotlin/app/ui/RepositoryOpen.kt b/src/main/kotlin/app/ui/RepositoryOpen.kt index 1dd8b52..ab2abf3 100644 --- a/src/main/kotlin/app/ui/RepositoryOpen.kt +++ b/src/main/kotlin/app/ui/RepositoryOpen.kt @@ -91,13 +91,12 @@ fun RepositoryOpenPage(tabViewModel: TabViewModel) { when (diffSelected) { null -> { Log( - tabViewModel = tabViewModel, - repositoryState = repositoryState, logViewModel = tabViewModel.logViewModel, selectedItem = selectedItem, onItemSelected = { tabViewModel.newSelectedItem(it) }, + repositoryState = repositoryState, ) } else -> { diff --git a/src/main/kotlin/app/ui/UncommitedChanges.kt b/src/main/kotlin/app/ui/UncommitedChanges.kt index 0e6daba..edd335e 100644 --- a/src/main/kotlin/app/ui/UncommitedChanges.kt +++ b/src/main/kotlin/app/ui/UncommitedChanges.kt @@ -1,5 +1,3 @@ -@file:Suppress("UNUSED_PARAMETER") - package app.ui import androidx.compose.animation.AnimatedVisibility @@ -41,7 +39,7 @@ import app.viewmodels.StatusViewModel import org.eclipse.jgit.diff.DiffEntry import org.eclipse.jgit.lib.RepositoryState -@OptIn(ExperimentalAnimationApi::class, androidx.compose.ui.ExperimentalComposeUiApi::class) +@OptIn(ExperimentalAnimationApi::class, ExperimentalComposeUiApi::class) @Composable fun UncommitedChanges( statusViewModel: StatusViewModel, diff --git a/src/main/kotlin/app/ui/dialogs/SettingsDialog.kt b/src/main/kotlin/app/ui/dialogs/SettingsDialog.kt index 4bfe34a..0d64b68 100644 --- a/src/main/kotlin/app/ui/dialogs/SettingsDialog.kt +++ b/src/main/kotlin/app/ui/dialogs/SettingsDialog.kt @@ -1,5 +1,3 @@ -@file:Suppress("UNUSED_PARAMETER") - package app.ui.dialogs import androidx.compose.foundation.layout.* diff --git a/src/main/kotlin/app/ui/log/Log.kt b/src/main/kotlin/app/ui/log/Log.kt index b480a3c..9d436d1 100644 --- a/src/main/kotlin/app/ui/log/Log.kt +++ b/src/main/kotlin/app/ui/log/Log.kt @@ -1,7 +1,5 @@ @file:OptIn(ExperimentalComposeUiApi::class, ExperimentalFoundationApi::class) -@file:Suppress("UNUSED_PARAMETER") - package app.ui.log import androidx.compose.foundation.* @@ -34,7 +32,6 @@ import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp import app.extensions.* -import app.viewmodels.TabViewModel import app.git.graph.GraphNode import app.theme.* import app.ui.SelectedItem @@ -71,7 +68,6 @@ private const val CANVAS_MIN_WIDTH = 100 ) @Composable fun Log( - tabViewModel: TabViewModel, logViewModel: LogViewModel, selectedItem: SelectedItem, onItemSelected: (SelectedItem) -> Unit,