Showing 116 of 116 total issues
File GUIController.java
has 523 lines of code (exceeds 250 allowed). Consider refactoring. Open
/*
* Copyright 2016 Patrick Favre-Bulle
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Method onCreate
has 187 lines of code (exceeds 25 allowed). Consider refactoring. Open
public void onCreate(final Stage stage, IPreferenceStore store, ResourceBundle bundle) {
this.bundle = bundle;
this.preferenceStore = store;
setupLayout();
File Arguments.java
has 439 lines of code (exceeds 250 allowed). Consider refactoring. Open
/*
* Copyright 2016 Patrick Favre-Bulle
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Method equals
has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring. Open
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
- 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 execute
has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring. Open
public void execute(Arguments args, boolean blockingWaitForFinish, HandlerCallback callback) {
beginMs = System.currentTimeMillis();
handlerCallback = callback;
logStringBuilder.append("registered image readers:\n").append(getRegisteredImageReadersAndWriters()).append("\n");
- 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 runImageOptimizer
has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring. Open
public static Result runImageOptimizer(File rawFile, ImageType processedType, String[] args, boolean keepOriginal, String outExtension) throws IOException {
if (Arguments.getImageType(rawFile) == processedType && rawFile.exists() && rawFile.isFile()) {
String id = UUID.randomUUID().toString().substring(0, 8);
File outFile = getFileWithPostFix(rawFile, "_optimized_" + id, outExtension);
- 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 parse
has 128 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static Arguments parse(String[] args) {
ResourceBundle strings = ResourceBundle.getBundle("bundles.strings", Locale.getDefault());
Options options = setupOptions(strings);
CommandLineParser parser = new DefaultParser();
Method build
has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring. Open
public Arguments build() throws InvalidArgumentException {
if (!internalSkipParamValidation) {
ResourceBundle bundle = ResourceBundle.getBundle("bundles.strings", Locale.getDefault());
if (platform.isEmpty()) {
- 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 parse
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
public static Arguments parse(String[] args) {
ResourceBundle strings = ResourceBundle.getBundle("bundles.strings", Locale.getDefault());
Options options = setupOptions(strings);
CommandLineParser parser = new DefaultParser();
- 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 execute
has 93 lines of code (exceeds 25 allowed). Consider refactoring. Open
public void execute(Arguments args, boolean blockingWaitForFinish, HandlerCallback callback) {
beginMs = System.currentTimeMillis();
handlerCallback = callback;
logStringBuilder.append("registered image readers:\n").append(getRegisteredImageReadersAndWriters()).append("\n");
Method onJobFinished
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
synchronized void onJobFinished(Result result) {
if (!canceled) {
currentJobCount++;
if (result != null) {
- 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
Builder
has 26 methods (exceeds 20 allowed). Consider refactoring. Open
public static class Builder {
private File dst;
private float srcScale;
private File src = null;
private EScaleMode scaleType = DEFAULT_SCALE_TYPE;
Method saveToFile
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
public List<File> saveToFile(File targetFile, LoadedImage imageData, Dimension targetDimension, boolean isNinePatch) throws Exception {
List<File> files = new ArrayList<>(2);
List<ImageType.ECompression> compressionList = Arguments.getOutCompressionForType(args.outputCompressionMode, Arguments.getImageType(imageData.getSourceFile()));
for (ImageType.ECompression compression : compressionList) {
- 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 convert
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
@Override
public Result convert(File srcImage, Arguments args) {
try {
File destinationFolder = args.dst;
LoadedImage imageData = ImageUtil.loadImage(srcImage);
- 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 handle
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
@Override
public void handle(ActionEvent event) {
directoryChooser.setTitle(bundle.getString("main.dirchooser.titel"));
File dir = new File(textFieldPath.getText());
- 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 getFromUI
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
public Arguments getFromUI(boolean skipValidation) throws InvalidArgumentException {
float scale = Arguments.DEFAULT_SCALE;
try {
scale = rbFactor.isSelected() ? (float) scaleSlider.getValue() : Float.valueOf(textFieldDp.getText());
Method resize
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
@Override
public void resize(BufferedImage srcImage, BufferedImage destImage)
throws NullPointerException {
super.performChecks(srcImage, destImage);
Method main
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static void main(String[] rawArgs) {
if (rawArgs.length < 1) {
new GUI().launchApp(rawArgs);
return;
Method runImageOptimizer
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static Result runImageOptimizer(File rawFile, ImageType processedType, String[] args, boolean keepOriginal, String outExtension) throws IOException {
if (Arguments.getImageType(rawFile) == processedType && rawFile.exists() && rawFile.isFile()) {
String id = UUID.randomUUID().toString().substring(0, 8);
File outFile = getFileWithPostFix(rawFile, "_optimized_" + id, outExtension);
Method doFilter
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public BufferedImage doFilter(BufferedImage img, BufferedImage dest, int dstWidth, int dstHeight) {
BufferedImage ret = img;
int w, h;
w = img.getWidth();
- 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"