Showing 15 of 32 total issues
File MainWindowController.java
has 298 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
/*
JaKoImage2PDF is a program for converting images to PDFs with the use of iText 7
Copyright (C) 2018 Nikita Hasert
This program is free software: you can redistribute it and/or modify
MainWindowController
has 26 methods (exceeds 20 allowed). Consider refactoring. Open
Open
public class MainWindowController extends FileListViewController {
@FXML
public Button directoryButton;
@FXML
public Button buildButton;
Method buildPDF
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public void buildPDF(ActionEvent actionEvent) {
File saveFile = mainWindowController.mainWindow.openSaveFileChooser(
directoryIterator.getParentDirectory(),
directoryIterator.getParentDirectory().getName() + ".pdf"
);
Method build
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
override fun build(directoryIterator: DirectoryIterator, imageToPdfOptions: ImageToPdfOptions, progressUpdater: ProgressUpdater): Boolean {
directoryIterator.resetIndex()
val imagePdf = if (imageToPdfOptions.getPdfOptions().useCustomLocation) createPdf(imageToPdfOptions)
else createPdf(
Method displayDirectory
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private void displayDirectory(int index, MainWindowController mainWindowController) {
DirectoryIterator imageFilesIterator = DirectoryIterator.DirectoryIteratorFactory.createDirectoryIterator(
new IteratorOptions()
);
Method setupImageListCellContextMenu
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private fun setupImageListCellContextMenu(file: File) {
contextMenu = ContextMenu()
contextMenu.id = "listCellContextMenu"
val deleteItem = setupMenuItem(
Method startPdfBuilderThread
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private void startPdfBuilderThread(PdfBuilder pdfBuilder) {
CallClosure callClosure = new CallClosure(
() -> {
runLater(() -> disableInput(true));
return Unit.INSTANCE;
Method pdfVersionToIndex
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Open
private int pdfVersionToIndex(PdfVersion pdfVersion) {
if (pdfVersion.equals(PDF_1_0)) return 0;
else if (pdfVersion.equals(PDF_1_1)) return 1;
else if (pdfVersion.equals(PDF_1_2)) return 2;
else if (pdfVersion.equals(PDF_1_3)) return 3;
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method createBuildPdfTask
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
pdfBuilder: PdfBuilder,
directoryIterator: DirectoryIterator,
imageToPdfOptions: ImageToPdfOptions,
progressUpdater: ProgressUpdater,
callClosure: CallClosure
Avoid too many return
statements within this method. Open
Open
if (pdfVersion.equals(PDF_1_0)) return 0;
Avoid too many return
statements within this method. Open
Open
else if (pdfVersion.equals(PDF_1_4)) return 4;
Avoid too many return
statements within this method. Open
Open
else if (pdfVersion.equals(PDF_1_2)) return 2;
Avoid too many return
statements within this method. Open
Open
else if (pdfVersion.equals(PDF_1_3)) return 3;
Avoid too many return
statements within this method. Open
Open
else if (pdfVersion.equals(PDF_1_1)) return 1;
Method buildPdf
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
public void buildPdf(ActionEvent actionEvent) {
if (!valuesSetForBuilding()) return;
if (mainWindow.imageToPdfOptions.getPdfOptions().getUseCustomLocation()) {
if (userWantsMultiplePDFs()) buildMultiplePdf();
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"