r4fterman/pdf.forms

View on GitHub

Showing 2,278 of 2,280 total issues

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

    private void initComponents() {
        final JLabel nameLabel = new JLabel("Name:");

        nameField = new JTextField();
        nameField.addFocusListener(new FocusAdapter() {

    Method writeJavaScript has 39 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private void writeJavaScript(
                final PdfWriter writer,
                final Rectangle pageSize,
                final int currentPage,
                final GlobalPdfWriter globalPdfWriter,
    Severity: Minor
    Found in src/main/java/org/pdf/forms/writer/Writer.java - About 1 hr to fix

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

      package org.pdf.forms.readers.des;
      
      import java.io.File;
      import java.io.IOException;
      import java.nio.file.Files;
      src/main/java/org/pdf/forms/readers/custom/CustomComponentsFileReader.java on lines 1..39
      src/main/java/org/pdf/forms/readers/properties/CustomPropertiesFileReader.java on lines 1..39

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

      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

      package org.pdf.forms.readers.custom;
      
      import java.io.File;
      import java.io.IOException;
      import java.nio.file.Files;
      src/main/java/org/pdf/forms/readers/des/DesignerProjectFileReader.java on lines 1..39
      src/main/java/org/pdf/forms/readers/properties/CustomPropertiesFileReader.java on lines 1..39

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

      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

      package org.pdf.forms.readers.properties;
      
      import java.io.File;
      import java.io.IOException;
      import java.nio.file.Files;
      src/main/java/org/pdf/forms/readers/custom/CustomComponentsFileReader.java on lines 1..39
      src/main/java/org/pdf/forms/readers/des/DesignerProjectFileReader.java on lines 1..39

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

      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 dragOver has 38 lines of code (exceeds 25 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();

        Method setFontProperties has 38 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            protected void setFontProperties(final IPdfComponent component) {
                final Optional<FontProperties> font = getWidgetModel().getProperties().getFont();
                if (font.isEmpty()) {
                    return;
                }
        Severity: Minor
        Found in src/main/java/org/pdf/forms/widgets/Widget.java - About 1 hr to fix

          Method initializeWindow has 38 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private ToolBarContainer initializeWindow(
                      final Rule horizontalRuler,
                      final Rule verticalRuler,
                      final FontHandler fontHandler) {
                  addWindowListener(new FrameCloser());
          Severity: Minor
          Found in src/main/java/org/pdf/forms/gui/VLFrame.java - About 1 hr to fix

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

                private RadioButtonWidget createRadioButton(
                        final Widget widget,
                        final Rectangle bounds) {
                    final PdfRadioButton pdfRadioButton = new PdfRadioButton();
                    pdfRadioButton.setBackground(IDesigner.PAGE_COLOR);
            src/main/java/org/pdf/forms/widgets/utils/WidgetFactory.java on lines 205..217

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

            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 CheckBoxWidget createCheckBox(
                        final Widget widget,
                        final Rectangle bounds) {
                    final PdfCheckBox cb = new PdfCheckBox();
                    cb.setBackground(IDesigner.PAGE_COLOR);
            src/main/java/org/pdf/forms/widgets/utils/WidgetFactory.java on lines 263..278

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

            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 handleButtonGroups has 37 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                private void handleButtonGroups(
                        final PdfWriter writer,
                        final List<IWidget> widgets,
                        final Rectangle pageSize,
                        final int currentPage,
            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

                  private BaseFont getBaseFont(final Font font) throws IOException, DocumentException {
                      final Optional<String> absoluteFontPath = fontHandler.getAbsoluteFontPath(font);
                      if (absoluteFontPath.isPresent()) {
                          final String fontPath = absoluteFontPath.get();
                          try {
              Severity: Major
              Found in src/main/java/org/pdf/forms/writer/PdfButtonWriter.java and 1 other location - About 1 hr to fix
              src/main/java/org/pdf/forms/writer/PdfComboBoxWriter.java on lines 200..216

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

              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 FontProperties) {
                          final FontProperties that = (FontProperties) o;
                          return Objects.equals(valueFontName, that.valueFontName)
              src/main/java/org/pdf/forms/model/des/Properties.java on lines 77..89

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

              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 BaseFont getBaseFont(final Font font) throws IOException, DocumentException {
                      final Optional<String> absoluteFontPath = fontHandler.getAbsoluteFontPath(font);
                      if (absoluteFontPath.isPresent()) {
                          final String fontPath = absoluteFontPath.get();
                          try {
              Severity: Major
              Found in src/main/java/org/pdf/forms/writer/PdfComboBoxWriter.java and 1 other location - About 1 hr to fix
              src/main/java/org/pdf/forms/writer/PdfButtonWriter.java on lines 121..138

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

              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 Properties) {
                          final Properties that = (Properties) o;
                          return Objects.equals(font, that.font)
              Severity: Major
              Found in src/main/java/org/pdf/forms/model/des/Properties.java and 1 other location - About 1 hr to fix
              src/main/java/org/pdf/forms/gui/properties/font/FontProperties.java on lines 53..65

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

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

                  private void addBorderProperties() {
                      final BorderProperties borderProperties = new BorderProperties();
              
                      final Borders borders = borderProperties.getBorders();
                      borders.setBorderStyle("None");
              Severity: Major
              Found in src/main/java/org/pdf/forms/widgets/TextWidget.java and 5 other locations - About 1 hr to fix
              src/main/java/org/pdf/forms/widgets/CheckBoxWidget.java on lines 154..167
              src/main/java/org/pdf/forms/widgets/ComboBoxWidget.java on lines 162..175
              src/main/java/org/pdf/forms/widgets/ListBoxWidget.java on lines 165..178
              src/main/java/org/pdf/forms/widgets/RadioButtonWidget.java on lines 144..157
              src/main/java/org/pdf/forms/widgets/TextFieldWidget.java on lines 165..178

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

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

                  private void addBorderProperties() {
                      final BorderProperties borderProperties = new BorderProperties();
              
                      final Borders borders = borderProperties.getBorders();
                      borders.setBorderStyle("None");
              Severity: Major
              Found in src/main/java/org/pdf/forms/widgets/CheckBoxWidget.java and 5 other locations - About 1 hr to fix
              src/main/java/org/pdf/forms/widgets/ComboBoxWidget.java on lines 162..175
              src/main/java/org/pdf/forms/widgets/ListBoxWidget.java on lines 165..178
              src/main/java/org/pdf/forms/widgets/RadioButtonWidget.java on lines 144..157
              src/main/java/org/pdf/forms/widgets/TextFieldWidget.java on lines 165..178
              src/main/java/org/pdf/forms/widgets/TextWidget.java on lines 122..135

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

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

                  private Rectangle convertJavaCoordsToPdfCoords(
                          final java.awt.Rectangle bounds,
                          final Rectangle pageSize) {
                      final int javaX1 = bounds.x - IMainFrame.INSET;
                      final int javaY1 = bounds.y - IMainFrame.INSET;
              Severity: Major
              Found in src/main/java/org/pdf/forms/writer/PdfComboBoxWriter.java and 7 other locations - About 1 hr to fix
              src/main/java/org/pdf/forms/writer/PdfButtonWriter.java on lines 107..119
              src/main/java/org/pdf/forms/writer/PdfCheckBoxWriter.java on lines 166..179
              src/main/java/org/pdf/forms/writer/PdfImageWriter.java on lines 64..77
              src/main/java/org/pdf/forms/writer/PdfListBoxWriter.java on lines 202..214
              src/main/java/org/pdf/forms/writer/PdfTextFieldWriter.java on lines 176..188
              src/main/java/org/pdf/forms/writer/PdfTextWriter.java on lines 106..118
              src/main/java/org/pdf/forms/writer/Writer.java on lines 557..569

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

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

                  private Rectangle convertJavaCoordsToPdfCoords(
                          final java.awt.Rectangle bounds,
                          final Rectangle pageSize) {
                      final int javaX1 = bounds.x - IMainFrame.INSET;
                      final int javaY1 = bounds.y - IMainFrame.INSET;
              Severity: Major
              Found in src/main/java/org/pdf/forms/writer/PdfListBoxWriter.java and 7 other locations - About 1 hr to fix
              src/main/java/org/pdf/forms/writer/PdfButtonWriter.java on lines 107..119
              src/main/java/org/pdf/forms/writer/PdfCheckBoxWriter.java on lines 166..179
              src/main/java/org/pdf/forms/writer/PdfComboBoxWriter.java on lines 186..198
              src/main/java/org/pdf/forms/writer/PdfImageWriter.java on lines 64..77
              src/main/java/org/pdf/forms/writer/PdfTextFieldWriter.java on lines 176..188
              src/main/java/org/pdf/forms/writer/PdfTextWriter.java on lines 106..118
              src/main/java/org/pdf/forms/writer/Writer.java on lines 557..569

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

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

                  private void addBorderProperties() {
                      final BorderProperties borderProperties = new BorderProperties();
              
                      final Borders borders = borderProperties.getBorders();
                      borders.setBorderStyle("None");
              Severity: Major
              Found in src/main/java/org/pdf/forms/widgets/ComboBoxWidget.java and 5 other locations - About 1 hr to fix
              src/main/java/org/pdf/forms/widgets/CheckBoxWidget.java on lines 154..167
              src/main/java/org/pdf/forms/widgets/ListBoxWidget.java on lines 165..178
              src/main/java/org/pdf/forms/widgets/RadioButtonWidget.java on lines 144..157
              src/main/java/org/pdf/forms/widgets/TextFieldWidget.java on lines 165..178
              src/main/java/org/pdf/forms/widgets/TextWidget.java on lines 122..135

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

              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