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 setObjectProperties() {
        final JRadioButton radioButton = (JRadioButton) getValueComponent();

        final String state = getWidgetModel().getProperties().getObject().getValue().getDefault().orElse("Off");
Severity: Minor
Found in src/main/java/org/pdf/forms/widgets/RadioButtonWidget.java and 1 other location - About 45 mins to fix
src/main/java/org/pdf/forms/widgets/CheckBoxWidget.java on lines 213..223

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

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 void setObjectProperties() {
        final JCheckBox comboBox = (JCheckBox) getValueComponent();

        final String state = getWidgetModel().getProperties().getObject().getValue().getDefault().orElse("Off");
Severity: Minor
Found in src/main/java/org/pdf/forms/widgets/CheckBoxWidget.java and 1 other location - About 45 mins to fix
src/main/java/org/pdf/forms/widgets/RadioButtonWidget.java on lines 211..221

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

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 addCheckBoxButtonGroupsToPage(
            final org.pdf.forms.model.des.Page page,
            final Page newPage) {
        final CheckBoxGroups checkBoxGroups = page.getCheckBoxGroups();
        checkBoxGroups.getButtonGroupNames().forEach(buttonGroupName -> {
src/main/java/org/pdf/forms/gui/commands/OpenDesignerFileCommand.java on lines 188..197

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

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 String getFontSize(final IWidget widget) {
        return widget.getWidgetModel().getProperties().getFont()
                .map(fontProperties -> {
                    if (widget.allowEditCaptionAndValue()) {
                        return fontProperties.getFontValue().getFontSize().orElse("");
src/main/java/org/pdf/forms/gui/toolbars/WidgetPropertiesToolBar.java on lines 246..255
src/main/java/org/pdf/forms/gui/toolbars/WidgetPropertiesToolBar.java on lines 284..293

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

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 String getFontName(final IWidget widget) {
        return widget.getWidgetModel().getProperties().getFont()
                .map(fontProperties -> {
                    if (widget.allowEditCaptionAndValue()) {
                        return fontProperties.getFontValue().getFontName().orElse("");
src/main/java/org/pdf/forms/gui/toolbars/WidgetPropertiesToolBar.java on lines 265..274
src/main/java/org/pdf/forms/gui/toolbars/WidgetPropertiesToolBar.java on lines 284..293

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

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 String getFontStyle(final IWidget widget) {
        return widget.getWidgetModel().getProperties().getFont()
                .map(fontProperties -> {
                    if (widget.allowEditCaptionAndValue()) {
                        return fontProperties.getFontValue().getFontStyle().orElse("");
src/main/java/org/pdf/forms/gui/toolbars/WidgetPropertiesToolBar.java on lines 246..255
src/main/java/org/pdf/forms/gui/toolbars/WidgetPropertiesToolBar.java on lines 265..274

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

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 addComboBox has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

            final int pageHeight,
            final int cropHeight,
            final int cropX,
            final int cropY,
            final List<IWidget> widgetsOnPage,
Severity: Minor
Found in src/main/java/org/pdf/forms/widgets/utils/WidgetParser.java - About 45 mins to fix

    Method removeEmptyGroupFromParent has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        private void removeEmptyGroupFromParent(
                final Object[] sourceObjectPath,
                final List<IWidget> sourceWidgetList,
                final List<IWidget> targetWidgetList) {
            /*
    Severity: Minor
    Found in src/main/java/org/pdf/forms/gui/hierarchy/tree/CDropTargetListener.java - About 45 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 createHorizontalGroup has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

                final JLabel eventBoxLabel,
                final JLabel scriptLanguageLabel,
                final JLabel runAtLabel,
                final JSeparator separator,
                final JButton saveButton,
    Severity: Minor
    Found in src/main/java/org/pdf/forms/gui/editor/JavaScriptEditorPanel.java - About 45 mins to fix

      Method equals has a Cognitive Complexity of 8 (exceeds 5 allowed). 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)
      Severity: Minor
      Found in src/main/java/org/pdf/forms/gui/properties/font/FontProperties.java - About 45 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 createVerticalGroup has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

                  final JLabel eventBoxLabel,
                  final JLabel scriptLanguageLabel,
                  final JLabel runAtLabel,
                  final JSeparator separator,
                  final JButton saveButton,
      Severity: Minor
      Found in src/main/java/org/pdf/forms/gui/editor/JavaScriptEditorPanel.java - About 45 mins to fix

        Method getTreeCellEditorComponent has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

                    final JTree tree,
                    final Object value,
                    final boolean isSelected,
                    final boolean expanded,
                    final boolean leaf,

          Method addListBox has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

                      final int pageHeight,
                      final int cropHeight,
                      final int cropX,
                      final int cropY,
                      final List<IWidget> widgetsOnPage,
          Severity: Minor
          Found in src/main/java/org/pdf/forms/widgets/utils/WidgetParser.java - About 45 mins to fix

            Method equals has a Cognitive Complexity of 8 (exceeds 5 allowed). 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: Minor
            Found in src/main/java/org/pdf/forms/model/des/Properties.java - About 45 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 getNextArrayNumberForName has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                @Override
                public int getNextArrayNumberForName(
                        final String name,
                        final IWidget widget) {
            
            
            Severity: Minor
            Found in src/main/java/org/pdf/forms/gui/VLFrame.java - About 45 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 decodePDFPage has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                        final String pdfPath,
                        final PdfDecoder pdfDecoder,
                        final ProgressMonitor progressDialog,
                        final int pdfPageNumber,
                        final Page newPage,
            Severity: Minor
            Found in src/main/java/org/pdf/forms/gui/commands/PDFImportWorker.java - About 45 mins to fix

              Method getId has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                  private int getId(final Object source) {
                      logger.info("Action event: {}", source.getClass().getCanonicalName());
                      if (source instanceof ButtonWithID) {
                          return ((ButtonWithID) source).getId();
                      }
              Severity: Minor
              Found in src/main/java/org/pdf/forms/gui/commands/CommandListener.java - About 45 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 autoscroll has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                  @Override
                  public void autoscroll(final Point pt) {
                      // Figure out which row we're on.
                      int nRow = getRowForLocation(pt.x, pt.y);
              
              
              Severity: Minor
              Found in src/main/java/org/pdf/forms/gui/hierarchy/tree/CTree.java - About 45 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 addWidgets has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                  private void addWidgets(
                          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 45 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 addPushButton has 6 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                          final int pageHeight,
                          final int cropHeight,
                          final int cropX,
                          final int cropY,
                          final List<IWidget> widgetsOnPage,
              Severity: Minor
              Found in src/main/java/org/pdf/forms/widgets/utils/WidgetParser.java - About 45 mins to fix
                Severity
                Category
                Status
                Source
                Language