DeflatedPickle/Quiver

View on GitHub

Showing 96 of 96 total issues

Similar blocks of code found in 2 locations. Consider refactoring.
Open

/* Copyright (c) 2020 DeflatedPickle under the MIT license */

package com.deflatedpickle.quiver.foldertree

import com.deflatedpickle.haruhi.component.PluginPanel
filetable/src/main/kotlin/com/deflatedpickle/quiver/filetable/Component.kt on lines 1..16

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 87.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

        ).apply {
            isOpaque = false
            viewport.isOpaque = false

            border = BorderFactory.createEmptyBorder()
core/src/main/kotlin/com/deflatedpickle/quiver/frontend/dialog/NewDialog.kt on lines 383..389

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 85.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

        }).apply {
            isOpaque = false
            viewport.isOpaque = false

            border = BorderFactory.createEmptyBorder()
core/src/main/kotlin/com/deflatedpickle/quiver/frontend/dialog/UsagesDialog.kt on lines 147..154

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 85.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Method getTreeCellRendererComponent has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

                tree: JTree?,
                value: Any?,
                selected: Boolean,
                expanded: Boolean,
                leaf: Boolean,

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

        private val copyFilePath = copyPathItem.add("File") {
            this.getFile()?.absolutePath?.let { copyText(it) }
        }
    core/src/main/kotlin/com/deflatedpickle/quiver/frontend/menu/FilePopupMenu.kt on lines 59..61

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 82.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

            @Suppress("UNCHECKED_CAST")
            val registry = RegistryUtil.get("export") as Registry<String, ExportStep>
    packexport/src/main/kotlin/com/deflatedpickle/quiver/packexport/ExportPackDialog.kt on lines 56..57

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 82.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

        private val copyName = copyItem.add("Name") {
            this.getFile()?.nameWithoutExtension?.let { copyText(it) }
        }
    core/src/main/kotlin/com/deflatedpickle/quiver/frontend/menu/FilePopupMenu.kt on lines 68..70

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 82.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

            @Suppress("UNCHECKED_CAST")
            val registry = RegistryUtil.get("export") as Registry<String, ExportStep>
    packexport/src/main/kotlin/com/deflatedpickle/quiver/packexport/PackExportPlugin.kt on lines 112..113

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 82.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

                                    SyntaxTheme.load(
                                        this::class.java.getResourceAsStream("/${settings.theme.id}")
                                    ).apply(TextViewer.component)
    textviewer/src/main/kotlin/com/deflatedpickle/quiver/textviewer/TextViewerPlugin.kt on lines 82..84

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 80.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

                    if (selected.isFile) {
                        Quiver.selectedFile!!.delete()
                        // Replace the selected file with the dropped one
                        FileUtils.moveFile(selected, Quiver.selectedFile)
                        EventReplaceFile.trigger(Quiver.selectedFile!!)
    filepanel/src/main/kotlin/com/deflatedpickle/quiver/filepanel/widget/ReplaceButton.kt on lines 77..82

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 80.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

                            SyntaxTheme.load(
                                this::class.java.getResourceAsStream("/${settings.theme.id}")
                            ).apply(TextViewer.component)
    textviewer/src/main/kotlin/com/deflatedpickle/quiver/textviewer/TextViewerPlugin.kt on lines 98..100

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 80.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

                    if (fileList[0].isFile && Quiver.selectedFile != null) {
                        Quiver.selectedFile!!.delete()
                        // Replace the selected file with the dropped one
                        FileUtils.moveFile(file, Quiver.selectedFile)
                        EventReplaceFile.trigger(Quiver.selectedFile!!)
    filepanel/src/main/kotlin/com/deflatedpickle/quiver/filepanel/widget/ReplaceButton.kt on lines 40..45

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 80.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Avoid deeply nested control flow statements.
    Open

                                if (ps.assets.minecraft.textures.gui.container != null) dir("container") {
                                    if (ps.assets.minecraft.textures.gui.container.creativeInventory) dir("creative_inventory") {}
                                }
    Severity: Major
    Found in core/src/main/kotlin/com/deflatedpickle/quiver/backend/util/PackUtil.kt - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                              if (image.width == image.height) {
                                  return image.width
                              }
      Severity: Major
      Found in core/src/main/kotlin/com/deflatedpickle/quiver/backend/util/PackUtil.kt - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                                            textures = if (isSelected("assets/minecraft/textures")) PackUtil.PackStructure.Minecraft.Textures(
                                                block = isSelected("assets/minecraft/textures/block"),
                                                colourmap = isSelected("assets/minecraft/textures/colourmap"),
                                                effect = isSelected("assets/minecraft/textures/effect"),
                                                entity = isSelected("assets/minecraft/textures/entity"),

          Avoid deeply nested control flow statements.
          Open

                                              models = if (isSelected("assets/minecraft/models")) PackUtil.PackStructure.Minecraft.Models(
                                                  block = isSelected("assets/minecraft/models/block"),
                                                  item = isSelected("assets/minecraft/models/item")
                                              ) else null,

            Avoid deeply nested control flow statements.
            Open

                                        if (ps.assets.minecraft.textures.gui.presets) dir("presets") {}
            Severity: Major
            Found in core/src/main/kotlin/com/deflatedpickle/quiver/backend/util/PackUtil.kt - About 45 mins to fix

              Method getTableCellRendererComponent has 6 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                                  table: JTable,
                                  value: Any,
                                  isSelected: Boolean,
                                  hasFocus: Boolean,
                                  row: Int,

                Avoid deeply nested control flow statements.
                Open

                                                    shaders = if (isSelected("assets/minecraft/shaders")) PackUtil.PackStructure.Minecraft.Shaders(
                                                        post = isSelected("assets/minecraft/shaders/post"),
                                                        program = isSelected("assets/minecraft/shaders/program")
                                                    ) else null,

                  Avoid deeply nested control flow statements.
                  Open

                                              if (ps.assets.minecraft.textures.gui.advancements != null) dir("advancements") {
                                                  if (ps.assets.minecraft.textures.gui.advancements.backgrounds) dir("backgrounds") {}
                                              }
                  Severity: Major
                  Found in core/src/main/kotlin/com/deflatedpickle/quiver/backend/util/PackUtil.kt - About 45 mins to fix
                    Severity
                    Category
                    Status
                    Source
                    Language