r4fterman/pdf.forms

View on GitHub

Showing 2,278 of 2,280 total issues

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

    private void addClicked(final ActionEvent evt) {
        final ButtonGroup newButtonGroup = new ButtonGroup(IWidget.RADIO_BUTTON);
        newButtonGroup.setName(createNonExistingButtonGroupName(newButtonGroup.getName()));
        radioButtonGroups.add(newButtonGroup);

src/main/java/org/pdf/forms/gui/windows/CheckBoxButtonGroupOrganiser.java on lines 189..195

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 40.

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

        for (int pageNumber = 0; pageNumber < numberOfPages; pageNumber++) {
            widgets.put(pageNumber, documentProperties.getPage(pageNumber + 1).getWidgets());
        }
Severity: Minor
Found in src/main/java/org/pdf/forms/gui/designer/gui/DesignerPanel.java and 1 other location - About 30 mins to fix
src/main/java/org/pdf/forms/gui/commands/PublishPdfCommand.java on lines 60..62

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 40.

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 4 locations. Consider refactoring.
Open

    private static void alignRight(final Set<IWidget> selectedWidgets) {
        final int rightPoint = calculateRightPoint(selectedWidgets);
        for (final IWidget widget: selectedWidgets) {
            widget.setX(rightPoint - widget.getBounds().width);
        }
src/main/java/org/pdf/forms/gui/commands/AlignBottomCommand.java on lines 34..39
src/main/java/org/pdf/forms/gui/commands/AlignRightCommand.java on lines 35..40
src/main/java/org/pdf/forms/widgets/utils/WidgetAlignmentAndOrder.java on lines 182..187

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 40.

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

                                .add(layout.createParallelGroup(GroupLayout.LEADING, false)
                                        .add(layout.createSequentialGroup()
                                                .add(typeLabel)
                                                .addPreferredGap(LayoutStyle.RELATED)
                                                .add(typeBox, 0, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
src/main/java/org/pdf/forms/gui/properties/object/value/ValuePanel.java on lines 68..72

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 40.

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 4 locations. Consider refactoring.
Open

    private void alignBottom(final Set<IWidget> selectedWidgets) {
        final int bottomPoint = calculateBottomPoint(selectedWidgets);
        for (final IWidget widget: selectedWidgets) {
            widget.setY(bottomPoint - widget.getBounds().height);
        }
src/main/java/org/pdf/forms/gui/commands/AlignRightCommand.java on lines 35..40
src/main/java/org/pdf/forms/widgets/utils/WidgetAlignmentAndOrder.java on lines 182..187
src/main/java/org/pdf/forms/widgets/utils/WidgetAlignmentAndOrder.java on lines 196..201

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 40.

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

                                .add(layout.createParallelGroup(GroupLayout.LEADING)
                                        .add(projectPageLabel, GroupLayout.DEFAULT_SIZE, 380, Short.MAX_VALUE)
                                        .add(pdfFormDesignerLabel, GroupLayout.DEFAULT_SIZE, 380, Short.MAX_VALUE)
                                        .add(usedLibrariesLabel)
Severity: Minor
Found in src/main/java/org/pdf/forms/gui/windows/AboutPanel.java and 1 other location - About 30 mins to fix
src/main/java/org/pdf/forms/gui/windows/BugReportPanel.java on lines 116..119

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 40.

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 void setListBoxOptionsToPanel(final Set<IWidget> widgets) {
        final ListFieldPanel fieldPanel = new ListFieldPanel(IWidget.LIST_BOX);
        fieldPanel.setDesignerPanel(designerPanel);
        fieldPanel.setProperties(widgets);

src/main/java/org/pdf/forms/gui/properties/object/ObjectPropertiesPanel.java on lines 109..115

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 40.

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 (widgetType == IWidget.CHECK_BOX) {
            final IMainFrame mainFrame = designerPanel.getMainFrame();
            return widgetFactory.createCheckBoxWidget(
                    mainFrame.getFormsDocument().getPage(mainFrame.getCurrentPage()),
                    bounds);
src/main/java/org/pdf/forms/gui/designer/listeners/DesignerMouseListener.java on lines 189..194

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 40.

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 (widgetType == IWidget.RADIO_BUTTON) {
            final IMainFrame mainFrame = designerPanel.getMainFrame();
            return widgetFactory.createRadioButtonWidget(
                    mainFrame.getFormsDocument().getPage(mainFrame.getCurrentPage()),
                    bounds);
src/main/java/org/pdf/forms/gui/designer/listeners/DesignerMouseListener.java on lines 196..201

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 40.

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

                                .add(layout.createParallelGroup(GroupLayout.LEADING)
                                        .add(attachmentScrollPane, GroupLayout.DEFAULT_SIZE, 631, Short.MAX_VALUE)
                                        .add(reproduceScrollPane, GroupLayout.DEFAULT_SIZE, 631, Short.MAX_VALUE)
                                        .add(nameLabel)
Severity: Minor
Found in src/main/java/org/pdf/forms/gui/windows/BugReportPanel.java and 1 other location - About 30 mins to fix
src/main/java/org/pdf/forms/gui/windows/AboutPanel.java on lines 91..94

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 40.

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 void setComboBoxOptionsToPanel(final Set<IWidget> widgets) {
        final ListFieldPanel fieldPanel = new ListFieldPanel(IWidget.COMBO_BOX);
        fieldPanel.setDesignerPanel(designerPanel);
        fieldPanel.setProperties(widgets);

src/main/java/org/pdf/forms/gui/properties/object/ObjectPropertiesPanel.java on lines 101..107

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 40.

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 calculateRectangleToDraw has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private Rectangle calculateRectangleToDraw(
            final Rectangle rectangle,
            final int componentWidth,
            final int componentHeight) {
        int x = rectangle.x;
Severity: Minor
Found in src/main/java/org/pdf/forms/gui/designer/gui/DesignerSelectionBox.java - About 25 mins to fix

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 sendToBack has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private void sendToBack(
            final List<IWidget> allWidgets,
            final int size,
            final Set<IWidget> selectedWidgets) {
        final Set<IWidget> copiedSet = Set.copyOf(selectedWidgets);
Severity: Minor
Found in src/main/java/org/pdf/forms/gui/commands/SendToBackCommand.java - About 25 mins to fix

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 updateFont has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public static void updateFont(
            final Set<IWidget> widgets,
            final String fontName,
            final String fontSize,
            final int fontStyle) {
Severity: Minor
Found in src/main/java/org/pdf/forms/gui/properties/PropertyChanger.java - About 25 mins to fix

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 dragOver has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    @Override
    public void dragOver(final DropTargetDragEvent event) {
        // This is where the ghost image is drawn.
        // Even if the mouse is not moving, this method is still invoked 10 times per second
        final Point point = event.getLocation();
Severity: Minor
Found in src/main/java/org/pdf/forms/gui/hierarchy/tree/CDropTargetListener.java - About 25 mins to fix

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 addBorder has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private void addBorder(
            final IWidget widget,
            final BaseField baseField) {
        final Widget model = widget.getWidgetModel();
        final Optional<BorderProperties> borderProperties = model.getProperties().getBorder();
Severity: Minor
Found in src/main/java/org/pdf/forms/writer/Writer.java - About 25 mins to fix

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 getTargetIndex has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private int getTargetIndex(
            final IWidget targetUserObject,
            final List<IWidget> sourceWidgetList,
            final List<IWidget> targetWidgetList,
            final int sourceIndex) {
Severity: Minor
Found in src/main/java/org/pdf/forms/gui/hierarchy/tree/CDropTargetListener.java - About 25 mins to fix

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 dropTransferable has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private boolean dropTransferable(
            final Transferable transferable,
            final DataFlavor flavor,
            final DropTargetDropEvent event) {
        try {
Severity: Minor
Found in src/main/java/org/pdf/forms/gui/hierarchy/tree/CDropTargetListener.java - About 25 mins to fix

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 dragOverWidget has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private void dragOverWidget(
            final DropTargetDragEvent event,
            final DefaultMutableTreeNode targetNode,
            final DefaultMutableTreeNode sourceNode,
            final Object targetUserObject) {
Severity: Minor
Found in src/main/java/org/pdf/forms/gui/hierarchy/tree/CDropTargetListener.java - About 25 mins to fix

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 dropWidget has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private void dropWidget(
            final DefaultMutableTreeNode sourceNode,
            final IWidget sourceUserObject,
            final DefaultMutableTreeNode targetNode,
            final IWidget targetUserObject) {
Severity: Minor
Found in src/main/java/org/pdf/forms/gui/hierarchy/tree/CDropTargetListener.java - About 25 mins to fix

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

Severity
Category
Status
Source
Language