Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: marketplace #5226

Draft
wants to merge 7 commits into
base: nextgen
Choose a base branch
from
Draft

feat: marketplace #5226

wants to merge 7 commits into from

Conversation

1zun4
Copy link
Member

@1zun4 1zun4 commented Jan 8, 2025

As command:
image

GUI will be implemented by another PR.

# Conflicts:
#	src/main/kotlin/net/ccbluex/liquidbounce/api/ClientApi.kt
#	src/main/kotlin/net/ccbluex/liquidbounce/api/oauth/ClientAccount.kt
#	src/main/kotlin/net/ccbluex/liquidbounce/api/services/auth/OAuthClient.kt
@1zun4 1zun4 added this to the 0.24.0 milestone Jan 8, 2025
Comment on lines +88 to +95
suspend fun createMarketplaceItemRevision(
session: OAuthSession,
id: Int,
file: File,
version: String,
changelog: String? = null,
dependencies: String? = null
) {

Check warning

Code scanning / detekt

The more parameters a function has the more complex it is. Long parameter lists are often used to control complex algorithms and violate the Single Responsibility Principle. Prefer functions with short parameter lists. Warning

The function createMarketplaceItemRevision(session: OAuthSession, id: Int, file: File, version: String, changelog: String?, dependencies: String?) has too many parameters. The current threshold is set to 6.
* You should have received a copy of the GNU General Public License
* along with LiquidBounce. If not, see <https://www.gnu.org/licenses/>.
*/
package net.ccbluex.liquidbounce.features.command.commands.client.marketplace

Check warning

Code scanning / detekt

Kotlin source files should be stored in the directory corresponding to its package statement. Warning

The package declaration does not match the actual file location.

val type = try {
MarketplaceItemType.valueOf(typeStr.uppercase())
} catch (e: IllegalArgumentException) {

Check warning

Code scanning / detekt

The caught exception is swallowed. The original exception could be lost. Warning

The caught exception is swallowed. The original exception could be lost.
*/
object UploadRevisionCommand : CommandFactory {

override fun createCommand() = CommandBuilder

Check warning

Code scanning / detekt

One method should have one responsibility. Long methods tend to handle many things at once. Prefer smaller methods to make them easier to understand. Warning

The function createCommand is too long (81). The maximum length is 60.
)
)
)
} catch (e: Exception) {

Check warning

Code scanning / detekt

The caught exception is swallowed. The original exception could be lost. Warning

The caught exception is swallowed. The original exception could be lost.
updateItem(itemId)
} catch (e: Exception) {
logger.error("Failed to update subscribed item $itemId", e)
e.printStackTrace()

Check warning

Code scanning / detekt

Do not print a stack trace. These debug statements should be removed or replaced with a logger. Warning

Do not print a stack trace. These debug statements should be removed or replaced with a logger.
}
}

private suspend fun updateItem(itemId: Int) {

Check warning

Code scanning / detekt

Excessive nesting leads to hidden complexity. Prefer extracting code to make it easier to understand. Warning

Function updateItem is nested too deeply.
@sqlerrorthing
Copy link
Contributor

sqlerrorthing commented Jan 8, 2025

why is it marked as a draft? please show the preview <3

import okhttp3.RequestBody.Companion.asRequestBody
import java.io.File

object MarketplaceApi : BaseApi(API_V3_ENDPOINT) {

Check warning

Code scanning / detekt

Too many functions inside a/an file/class/object/interface always indicate a violation of the single responsibility principle. Maybe the file/class/object/interface wants to manage too many things at once. Extract functionality which clearly belongs together. Warning

Object 'MarketplaceApi' with '19' functions detected. Defined threshold inside objects is set to '11'
Comment on lines +64 to +72
suspend fun getMarketplaceItems(
page: Int = 1,
limit: Int = 10,
query: String? = null,
type: MarketplaceItemType? = null,
uid: String? = null,
branch: String? = null,
unapproved: Boolean = false
): PaginatedResponse<MarketplaceItem> {

Check warning

Code scanning / detekt

The more parameters a function has the more complex it is. Long parameter lists are often used to control complex algorithms and violate the Single Responsibility Principle. Prefer functions with short parameter lists. Warning

The function getMarketplaceItems(page: Int, limit: Int, query: String?, type: MarketplaceItemType?, uid: String?, branch: String?, unapproved: Boolean) has too many parameters. The current threshold is set to 6.
Comment on lines +77 to +84
suspend fun getFeaturedMarketplaceItems(
page: Int = 1,
limit: Int = 10,
query: String? = null,
type: MarketplaceItemType? = null,
uid: String? = null,
branch: String? = null
): PaginatedResponse<MarketplaceItem> {

Check warning

Code scanning / detekt

The more parameters a function has the more complex it is. Long parameter lists are often used to control complex algorithms and violate the Single Responsibility Principle. Prefer functions with short parameter lists. Warning

The function getFeaturedMarketplaceItems(page: Int, limit: Int, query: String?, type: MarketplaceItemType?, uid: String?, branch: String?) has too many parameters. The current threshold is set to 6.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants