r4fterman/pdf.forms

View on GitHub

Showing 2,278 of 2,280 total issues

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

    private static int calculateRightPoint(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 210..225

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 int calculateRightPoint(final Set<IWidget> widgets) {
        if (widgets.isEmpty()) {
            return 0;
        }

src/main/java/org/pdf/forms/widgets/utils/WidgetAlignmentAndOrder.java on lines 210..225
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

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

        if (!heightBox.getText().equals("mixed")) {
            final String heightText = heightBox.getText().replace("cm", "");
            final double customHeight = asDouble(heightText);
            heightBox.setText(customHeight + " cm");

src/main/java/org/pdf/forms/gui/properties/layout/SizeAndPositionPanel.java on lines 323..330

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

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

        if (!widthBox.getText().equals("mixed")) {
            final String widthText = widthBox.getText().replace("cm", "");
            final double customWidth = asDouble(widthText);
            widthBox.setText(customWidth + " cm");

src/main/java/org/pdf/forms/gui/properties/layout/SizeAndPositionPanel.java on lines 332..339

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

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 setXCoordinate(final String xCordToUse) {
        if (xCordToUse == null) {
            return;
        }

src/main/java/org/pdf/forms/gui/properties/layout/SizeAndPositionPanel.java on lines 380..392

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

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 setYCoordinate(final String yCordToUse) {
        if (yCordToUse == null) {
            return;
        }

src/main/java/org/pdf/forms/gui/properties/layout/SizeAndPositionPanel.java on lines 366..378

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

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

    private void writeModelToPDF(
            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

    Method addCheckBox has 29 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private void addCheckBox(
                final FormObject formObject,
                final Page page,
                final String groupName,
                final int pageHeight,
    Severity: Minor
    Found in src/main/java/org/pdf/forms/widgets/utils/WidgetParser.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(0, allWidgets.remove(i));
      src/main/java/org/pdf/forms/widgets/utils/WidgetAlignmentAndOrder.java on lines 142..150

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

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

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

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

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

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

          private void initializePanel() {
              setBorder(BorderFactory.createTitledBorder("Caption"));
      
              final JLabel positionLabel = new JLabel("Position:");
      
      
      Severity: Minor
      Found in src/main/java/org/pdf/forms/gui/properties/layout/CaptionPanel.java - About 1 hr to fix

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

            @Override
            public void execute() {
                mainFrame.setFormsDocument(null);
                mainFrame.getDesigner().close();
                mainFrame.setCurrentDesignerFileName("");
        src/main/java/org/pdf/forms/gui/commands/NewPdfCommand.java on lines 34..43
        src/main/java/org/pdf/forms/gui/commands/OpenDesignerFileCommand.java on lines 143..157

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

        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 closePDF() {
                mainFrame.setFormsDocument(null);
        
                mainFrame.getDesigner().close();
        
        
        src/main/java/org/pdf/forms/gui/commands/ClosePdfCommand.java on lines 20..30
        src/main/java/org/pdf/forms/gui/commands/NewPdfCommand.java on lines 34..43

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

        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 closePDF() {
                mainFrame.setFormsDocument(null);
                mainFrame.getDesigner().close();
                mainFrame.setCurrentDesignerFileName("");
                mainFrame.setTitle("PDF Forms Designer Version " + version.getVersion());
        src/main/java/org/pdf/forms/gui/commands/ClosePdfCommand.java on lines 20..30
        src/main/java/org/pdf/forms/gui/commands/OpenDesignerFileCommand.java on lines 143..157

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

        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 saveAllowedMultipleLines(final MouseEvent event) {
                final TriStateCheckBox.State state = (((TriStateCheckBox) allowMultipleLinesBox).getState());
                final Optional<Boolean> triStateValue = getTriStateValue(state);
                if (triStateValue.isEmpty()) {
                    return;
        src/main/java/org/pdf/forms/gui/properties/object/field/TextFieldFieldPanel.java on lines 201..210

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

        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 saveLimitLength(final MouseEvent event) {
                final TriStateCheckBox.State state = (((TriStateCheckBox) limitLengthBox).getState());
                final Optional<Boolean> triStateValue = getTriStateValue(state);
                if (triStateValue.isEmpty()) {
                    return;
        src/main/java/org/pdf/forms/gui/properties/object/field/TextFieldFieldPanel.java on lines 212..222

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

        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

            public ImportPdfCommand(
                    final IMainFrame mainFrame,
                    final Version version,
                    final WidgetFactory widgetFactory,
                    final DesignerPropertiesFile designerPropertiesFile) {
        src/main/java/org/pdf/forms/gui/commands/OpenDesignerFileCommand.java on lines 45..57

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

        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

            public OpenDesignerFileCommand(
                    final IMainFrame mainFrame,
                    final Version version,
                    final WidgetFactory widgetFactory,
                    final DesignerPropertiesFile designerPropertiesFile) {
        src/main/java/org/pdf/forms/gui/commands/ImportPdfCommand.java on lines 32..44

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

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

            private Set<IWidget> setUpWidgetSelection(
                    final int x,
                    final int y) {
                // if no widget is selected then set up the selection box,
                // otherwise a widget is either about to be moved or resized, so set up for that

          Method buildFileMenu has 26 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private static Menu buildFileMenu() {
                  return new MenuBuilder().withName("File").withVisible(true)
                          .addItem(new ItemBuilder().withCommand("NEW").withName("New").withVisible(true).build())
                          .addItem(new ItemBuilder().withCommand("OPEN").withName("Open Designer File...").withVisible(true)
                                  .build())
            Severity
            Category
            Status
            Source
            Language