r4fterman/pdf.forms

View on GitHub

Showing 2,278 of 2,280 total issues

Method drawMulitipleSelectionBox has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public void drawMulitipleSelectionBox(
            final Graphics2D g2,
            final Set<IWidget> selectedWidgets,
            final boolean drawNodes) {

Severity: Minor
Found in src/main/java/org/pdf/forms/widgets/utils/WidgetSelection.java - About 1 hr to fix

    Method initComponents has 32 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private void initComponents() {
            final JPanel panel = createBordersPanel();
            final JPanel backgroundPanel = createBackgroundPanel();
    
            final GroupLayout layout = new GroupLayout(this);

      Method write has 32 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          @Override
          public PdfFormField write(
                  final IWidget widget,
                  final Rectangle pageSize,
                  final int currentPage,
      Severity: Minor
      Found in src/main/java/org/pdf/forms/writer/PdfListBoxWriter.java - About 1 hr to fix

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

            private String createNonExistingButtonGroupName(final String buttonGroupName) {
                for (final ButtonGroup buttonGroup: radioButtonGroups) {
                    if (buttonGroup.getName().equals(buttonGroupName)) {
                        final char c = buttonGroupName.charAt(buttonGroupName.length() - 1);
                        final int number = Integer.parseInt(String.valueOf(c));
        src/main/java/org/pdf/forms/gui/windows/CheckBoxButtonGroupOrganiser.java on lines 197..206

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

        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

            @Override
            public boolean equals(final Object o) {
                if (o instanceof ObjectProperties) {
                    final ObjectProperties that = (ObjectProperties) o;
                    return Objects.equals(field, that.field)
        Severity: Major
        Found in src/main/java/org/pdf/forms/model/des/ObjectProperties.java and 1 other location - About 1 hr to fix
        src/main/java/org/pdf/forms/model/des/Page.java on lines 110..121

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

        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

            @Override
            public boolean equals(final Object o) {
                if (o instanceof Page) {
                    final Page page = (Page) o;
                    return Objects.equals(property, page.property)
        Severity: Major
        Found in src/main/java/org/pdf/forms/model/des/Page.java and 1 other location - About 1 hr to fix
        src/main/java/org/pdf/forms/model/des/ObjectProperties.java on lines 58..69

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

        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

            private String createNonExistingButtonGroupName(final String buttonGroupName) {
                for (final ButtonGroup buttonGroup: checkBoxButtonGroups) {
                    if (buttonGroup.getName().equals(buttonGroupName)) {
                        final char c = buttonGroupName.charAt(buttonGroupName.length() - 1);
                        final int number = Integer.parseInt(String.valueOf(c));
        src/main/java/org/pdf/forms/gui/windows/RadioButtonGroupOrganiser.java on lines 206..215

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

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

            public int getResizeType(
                    final int mouseX,
                    final int mouseY,
                    final Set<IWidget> selectedWidgets) {
                if (selectionBoxBounds == null || selectedWidgets.isEmpty()) {
        Severity: Minor
        Found in src/main/java/org/pdf/forms/widgets/utils/WidgetSelection.java - About 1 hr 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 openFile has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

            private void openFile(
                    final String filePath,
                    final Component component) {
                if (filePath == null) {
                    return;
        Severity: Minor
        Found in src/main/java/org/pdf/forms/gui/DefaultTransferHandler.java - About 1 hr 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 dropData has 31 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            private boolean dropData(
                    final JComponent srcComponent,
                    final Transferable transferable,
                    final DataFlavor[] flavors) {
                // Ok, now try to display the content of the drop.
        Severity: Minor
        Found in src/main/java/org/pdf/forms/gui/DefaultTransferHandler.java - About 1 hr to fix

          Method setupDockingPanes has 31 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private void setupDockingPanes() {
                  desk.addDockable(designerPanel);
                  dockableNames.put("Designer", designerPanel);
          
                  final WindowConfiguration windowConfiguration = windowConfigurationFile.getWindowConfiguration();
          Severity: Minor
          Found in src/main/java/org/pdf/forms/gui/VLFrame.java - About 1 hr to fix

            Method executeCommand has 30 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                @Override
                public void executeCommand(final int type) {
                    switch (type) {
                        case FIRSTPAGE:
                            designer.displayPreviewPage(1);

              Method executeCommand has 30 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  @Override
                  public void executeCommand(final int type) {
                      switch (type) {
                          case FIRSTPAGE:
                              designer.displayDesignerPage(1);

                Method writeExternalPDFPagesToPDF has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    private void writeExternalPDFPagesToPDF(
                            final File fileToWriteTo,
                            final Map<Integer, List<IWidget>> widgetsByPageNumber,
                            final List<org.pdf.forms.model.des.Page> pages,
                            final Optional<String> javaScript,
                Severity: Minor
                Found in src/main/java/org/pdf/forms/writer/Writer.java - About 1 hr to fix

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

                          for (int i = size; i >= 0; i--) {
                              final IWidget widget = allWidgets.get(i);
                              if (newSet.remove(widget)) {
                                  if (i > 0) {
                                      allWidgets.add(i - 1, allWidgets.remove(i));
                  src/main/java/org/pdf/forms/gui/commands/SendBackwardCommand.java on lines 51..59

                  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

                  Method setVerticalAlignment has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      @Override
                      public void setVerticalAlignment(final int alignment) {
                          if (alignment == SwingConstants.CENTER) {
                              setUI(new BasicTextFieldUI());
                              return;
                  Severity: Minor
                  Found in src/main/java/org/pdf/forms/widgets/components/PdfTextField.java - About 1 hr to fix

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

                            for (int i = size; i >= 0; i--) {
                                final IWidget widget = allWidgets.get(i);
                                if (newSet.remove(widget)) {
                                    if (i > 0) {
                                        allWidgets.add(i - 1, allWidgets.remove(i));
                    src/main/java/org/pdf/forms/widgets/utils/WidgetAlignmentAndOrder.java on lines 110..118

                    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

                            if ("mixed".equals(verticalAlignmentToUse)) {
                                verticalAlignmentButtonGroup.clearSelection();
                            } else if ("top".equals(verticalAlignmentToUse)) {
                                verticalAlignTop.setSelected(true);
                            } else if ("bottom".equals(verticalAlignmentToUse)) {
                    src/main/java/org/pdf/forms/gui/toolbars/WidgetPropertiesToolBar.java on lines 305..315

                    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

                            if ("mixed".equals(horizontalAlignmentToUse)) {
                                alignmentGroup.clearSelection();
                            } else if ("left".equals(horizontalAlignmentToUse)) {
                                alignLeft.setSelected(true);
                            } else if ("center".equals(horizontalAlignmentToUse)) {
                    src/main/java/org/pdf/forms/gui/properties/paragraph/ParagraphPropertiesPanel.java on lines 386..396

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

                        private static int calculateBottomPoint(final Set<IWidget> widgets) {
                            if (widgets.isEmpty()) {
                                return 0;
                            }
                    
                    
                    src/main/java/org/pdf/forms/gui/commands/AlignRightCommand.java on lines 42..57
                    src/main/java/org/pdf/forms/widgets/utils/WidgetAlignmentAndOrder.java on lines 244..259

                    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

                    Severity
                    Category
                    Status
                    Source
                    Language