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

    @Override
    public void setUnderlineType(final int type) {
        switch (type) {
            case IWidget.UNDERLINE_SINGLE:
                standardUnderline = true;
src/main/java/org/pdf/forms/widgets/components/PdfCaption.java on lines 77..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 140.

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

    private void initComponents() {
        addComponentListener(new ComponentAdapter() {
            @Override
            public void componentShown(final ComponentEvent evt) {
                shown();

    File WidgetAlignmentAndOrder.java has 255 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    package org.pdf.forms.widgets.utils;
    
    import java.awt.*;
    import java.util.HashSet;
    import java.util.List;

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

          private void addLayoutProperties() {
              final LayoutProperties layoutProperties = getWidgetModel().getProperties().getLayout();
      
              final SizeAndPosition sizeAndPosition = layoutProperties.getSizeAndPosition();
              sizeAndPosition.setX(1);
      Severity: Major
      Found in src/main/java/org/pdf/forms/widgets/ButtonWidget.java and 2 other locations - About 2 hrs to fix
      src/main/java/org/pdf/forms/widgets/ImageWidget.java on lines 79..97
      src/main/java/org/pdf/forms/widgets/TextWidget.java on lines 102..120

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

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

          private void addLayoutProperties() {
              final LayoutProperties layoutProperties = getWidgetModel().getProperties().getLayout();
      
              final SizeAndPosition sizeAndPosition = layoutProperties.getSizeAndPosition();
              sizeAndPosition.setX(1);
      Severity: Major
      Found in src/main/java/org/pdf/forms/widgets/TextWidget.java and 2 other locations - About 2 hrs to fix
      src/main/java/org/pdf/forms/widgets/ButtonWidget.java on lines 112..130
      src/main/java/org/pdf/forms/widgets/ImageWidget.java on lines 79..97

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

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

          private void addLayoutProperties() {
              final LayoutProperties layoutProperties = getWidgetModel().getProperties().getLayout();
      
              final SizeAndPosition sizeAndPosition = layoutProperties.getSizeAndPosition();
              sizeAndPosition.setX(1);
      Severity: Major
      Found in src/main/java/org/pdf/forms/widgets/ImageWidget.java and 2 other locations - About 2 hrs to fix
      src/main/java/org/pdf/forms/widgets/ButtonWidget.java on lines 112..130
      src/main/java/org/pdf/forms/widgets/TextWidget.java on lines 102..120

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

      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 void underlineWord(
                  final Graphics graphics,
                  final String text,
                  final FontMetrics fontMetrics,
                  final int x,
      src/main/java/org/pdf/forms/widgets/components/PdfCaption.java on lines 54..75
      src/main/java/org/pdf/forms/widgets/components/PdfTextField.java on lines 61..80

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

      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 void underlineWord(
                  final Graphics graphics,
                  final String text,
                  final FontMetrics f,
                  final int x,
      src/main/java/org/pdf/forms/widgets/components/PdfButton.java on lines 58..76
      src/main/java/org/pdf/forms/widgets/components/PdfTextField.java on lines 61..80

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

      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 void underlineWord(
                  final Graphics graphics,
                  final String text,
                  final FontMetrics f,
                  final int x,
      src/main/java/org/pdf/forms/widgets/components/PdfButton.java on lines 58..76
      src/main/java/org/pdf/forms/widgets/components/PdfCaption.java on lines 54..75

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

      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.model.properties;
      
      import java.util.ArrayList;
      import java.util.List;
      import java.util.Objects;
      src/main/java/org/pdf/forms/model/properties/CustomFonts.java on lines 1..47
      src/main/java/org/pdf/forms/model/properties/RecentDesFiles.java on lines 1..47

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

      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.model.properties;
      
      import java.util.ArrayList;
      import java.util.List;
      import java.util.Objects;
      src/main/java/org/pdf/forms/model/properties/CustomFonts.java on lines 1..47
      src/main/java/org/pdf/forms/model/properties/RecentPdfFiles.java on lines 1..47

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

      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.model.properties;
      
      import java.util.ArrayList;
      import java.util.List;
      import java.util.Objects;
      src/main/java/org/pdf/forms/model/properties/RecentDesFiles.java on lines 1..47
      src/main/java/org/pdf/forms/model/properties/RecentPdfFiles.java on lines 1..47

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

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

          private void initComponents() {
              final JLabel label = new JLabel("Radio Button Groups");
      
              buttonGroupsList = new JList<>();
              buttonGroupsList.setModel(new DefaultListModel<>());

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

            private void initComponents() {
                final JLabel label = new JLabel("CheckBox Button Groups");
        
                buttonGroupsList = new JList<>(new DefaultListModel<>());
        
        

          Method writeJavaScript has a Cognitive Complexity of 15 (exceeds 5 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

          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

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

          package org.pdf.forms.model.des;
          
          import java.util.ArrayList;
          import java.util.List;
          import java.util.Objects;
          src/main/java/org/pdf/forms/model/des/CheckBoxGroups.java on lines 1..48
          src/main/java/org/pdf/forms/model/des/Widgets.java on lines 1..47

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

          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.model.des;
          
          import java.util.ArrayList;
          import java.util.List;
          import java.util.Objects;
          Severity: Major
          Found in src/main/java/org/pdf/forms/model/des/CheckBoxGroups.java and 2 other locations - About 1 hr to fix
          src/main/java/org/pdf/forms/model/des/RadioButtonGroups.java on lines 1..48
          src/main/java/org/pdf/forms/model/des/Widgets.java on lines 1..47

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

          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.model.des;
          
          import java.util.ArrayList;
          import java.util.List;
          import java.util.Objects;
          Severity: Major
          Found in src/main/java/org/pdf/forms/model/des/Widgets.java and 2 other locations - About 1 hr to fix
          src/main/java/org/pdf/forms/model/des/CheckBoxGroups.java on lines 1..48
          src/main/java/org/pdf/forms/model/des/RadioButtonGroups.java on lines 1..48

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

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

              private void initializePanel() {
                  final org.jdesktop.layout.GroupLayout groupLayout = new org.jdesktop.layout.GroupLayout(this);
                  setLayout(groupLayout);
                  setBorder(BorderFactory.createTitledBorder("Margins"));
          
          
          Severity: Minor
          Found in src/main/java/org/pdf/forms/gui/properties/layout/MarginPanel.java - About 1 hr to fix

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

                private void updateFontSizeProperty(
                        final IWidget widget,
                        final FontCaption fontCaption,
                        final Optional<FontValue> fontValue) {
                    final String value = Optional.ofNullable(fontSizeBox.getSelectedItem()).map(Object::toString).orElse("");
            src/main/java/org/pdf/forms/gui/properties/font/FontPropertiesPanel.java on lines 270..286

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

            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