Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue #13770: Enforce Linux Style EOL for all XML files #13774

Merged
merged 1 commit into from
Oct 23, 2023

Conversation

kalpadiptyaroy
Copy link
Contributor

Issue #13770: Enforce Linux Style EOL for all XML files

@kalpadiptyaroy
Copy link
Contributor Author

kalpadiptyaroy commented Sep 23, 2023

Finally fixed the EOL problem in a white collar way.
Just need to fix the Modifed Controller Variable stuff

[ERROR] [checkstyle] [ERROR] ... site\XdocsTemplateSink.java:91:23: Control variable 'id' is modified. [ModifiedControlVariable]

@romani - any suggestions on this Modified Controller Variable thing?

Hold on patience for #13696. We are very close to fixing this EOL issue.

@romani
Copy link
Member

romani commented Sep 24, 2023

Please create javadoc for methods to define from what class you copied implementation and how you modified them.
We will need such details during update of library where such code is located, in case it is changed, we will need to copy it one more time.

If checkstyle violation on copied code we can put comment to suppress violation -cs: ModifiedControlVariable

@kalpadiptyaroy kalpadiptyaroy force-pushed the enforce-linux-eol branch 2 times, most recently from 126640d to ed44237 Compare September 24, 2023 10:22
@kalpadiptyaroy
Copy link
Contributor Author

kalpadiptyaroy commented Sep 24, 2023

Please create javadoc for methods to define from what class you copied implementation and how you modified them. We will need such details during update of library where such code is located, in case it is changed, we will need to copy it one more time.

If checkstyle violation on copied code we can put comment to suppress violation -cs: ModifiedControlVariable

Done.
and tackled ModifiedControllerVariable by compliance.

@kalpadiptyaroy kalpadiptyaroy force-pushed the enforce-linux-eol branch 4 times, most recently from 4f91053 to ec2fa54 Compare September 24, 2023 10:33
Copy link
Member

@romani romani left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

item

@kalpadiptyaroy kalpadiptyaroy force-pushed the enforce-linux-eol branch 2 times, most recently from e3fb554 to cfbe7c1 Compare September 24, 2023 13:39
Copy link
Member

@romani romani left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

items:

@kalpadiptyaroy kalpadiptyaroy force-pushed the enforce-linux-eol branch 4 times, most recently from 23eaf1f to 9476faa Compare September 24, 2023 19:05
Copy link
Member

@romani romani left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Items:

@kalpadiptyaroy kalpadiptyaroy force-pushed the enforce-linux-eol branch 4 times, most recently from 414ed50 to e2ce547 Compare September 25, 2023 17:33
@romani
Copy link
Member

romani commented Sep 25, 2023

See questions above.
Please reply to each review thread.

@kalpadiptyaroy
Copy link
Contributor Author

See questions above. Please reply to each review thread.

Yes replied

@romani
Copy link
Member

romani commented Sep 25, 2023

Please address #13774 (comment)

@kalpadiptyaroy
Copy link
Contributor Author

kalpadiptyaroy commented Sep 26, 2023

@romani. I tried to preserve the original write function as follows

@Override
    protected void write(String text) {
        if (!this.tableCaptionXmlWriterStack.isEmpty()
                && this.tableCaptionXmlWriterStack.getLast() != null) {
            this.tableCaptionXmlWriterStack.getLast().writeMarkup(unifyToLinuxEndOfLine(text));
        }
        else if (!this.tableContentWriterStack.isEmpty()
                && this.tableContentWriterStack.getLast() != null) {
            this.tableContentWriterStack.getLast().write(unifyToLinuxEndOfLine(text));
        }
        else {
            writer.write(unifyToLinuxEndOfLine(text));
        }
    }

But this is giving rise to PMD errors as below:

INFO] --- pmd:3.21.0:check (default) @ checkstyle ---
[INFO] PMD version: 6.55.0
[INFO] PMD Failure: com.puppycrawl.tools.checkstyle.site.XdocsTemplateSink:57 Rule:LooseCoupling Priority:3 Avoid using implementation types like 'LinkedList'; use the interface instead.
[INFO] PMD Failure: com.puppycrawl.tools.checkstyle.site.XdocsTemplateSink:63 Rule:LooseCoupling Priority:3 Avoid using implementation types like 'LinkedList'; use the interface instead.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  22:17 min
[INFO] Finished at: 2023-09-26T23:56:35+05:30

Now, if I try to replace LinkedList with List in the declarations then getLast() func. from this.tableContentWriterStack.getLast() becomes undefined.

Therefore, I feel it's better to put a proper explanation in the javadoc to justify the deviation in overridden implementation.

Just updated the Javadoc in the latest push.

@michael-o
Copy link
Contributor

@nrmancuso @michael-o ping - Kindly share your reviews.

I still don't understand the purpose

Copy link
Member

@romani romani left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A way better implementation!!
Thanks a lot.

@kalpadiptyaroy , please test it in another PR to prove that it works.

@romani
Copy link
Member

romani commented Oct 19, 2023

@michael-o, is this implementation ok to you. You required change so we need to get from you approval.

@michael-o
Copy link
Contributor

@michael-o, is this implementation ok to you. You required change so we need to get from you approval.

Logically yes, but what I don't understand why not pass CustomPrintWriter to the real XdocSink instead of derived impl...

@romani
Copy link
Member

romani commented Oct 19, 2023

@michael-o , do you mean to put this custom writer to

public class XdocsTemplateSink extends XdocSink {
?

@kalpadiptyaroy
Copy link
Contributor Author

Logically yes, but what I don't understand why not pass CustomPrintWriter to the real XdocSink instead of derived impl...

XdocSink is a doxia class. So, I can't put the custom writer over there. Hence, I kept it in XdocsTemplateSink.

@kalpadiptyaroy
Copy link
Contributor Author

@kalpadiptyaroy , please test it in another PR to prove that it works.

I will definitely cherry-pick this in the other PR too. But prior to that. Can you tell me how to resolve these CI failures?

@michael-o
Copy link
Contributor

Logically yes, but what I don't understand why not pass CustomPrintWriter to the real XdocSink instead of derived impl...

XdocSink is a doxia class. So, I can't put the custom writer over there. Hence, I kept it in XdocsTemplateSink.

Why? You can pass your custom writer, isn't that enough?

@nrmancuso
Copy link
Member

@kalpadiptyaroy semaphore failures can be ignored, looks like we had some problem downloading dependencies. As for checker - these both seem like reasonable failures, we can implement the required changes.

@romani
Copy link
Member

romani commented Oct 20, 2023

Link check is failing also.
@nrmancuso , should we add such lines to suppress file ?

@nrmancuso
Copy link
Member

Link check is failing also. @nrmancuso , should we add such lines to suppress file ?

I restarted link check, let’s make sure it’s stable failure

@kalpadiptyaroy kalpadiptyaroy force-pushed the enforce-linux-eol branch 4 times, most recently from 9a5a773 to 73aeb50 Compare October 20, 2023 08:03
Copy link
Member

@nrmancuso nrmancuso left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Final todo:

  1. Suppress checker errors: I spent an hour trying to make checker happy on this SHA, to no avail. Please just suppress these errors.
  2. Suppress linkcheck.
  3. Rebase on latest master

@kalpadiptyaroy let's get this PR across the finish line

@romani
Copy link
Member

romani commented Oct 22, 2023

@nrmancuso , there is some groovy failure after Checker execution, please assist.

@nrmancuso
Copy link
Member

@nrmancuso , there is some groovy failure after Checker execution, please assist.

Looks like groovy script has a different idea about how these suppressions should look? @kalpadiptyaroy please try to apply patch exactly as proposed by git diff step in workflow execution. Maybe we have some bug in our groovy script.

@kalpadiptyaroy
Copy link
Contributor Author

Sure. Will do that.

@kalpadiptyaroy
Copy link
Contributor Author

@nrmancuso - Done - We can merge now!

Copy link
Member

@nrmancuso nrmancuso left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let’s merge this.

@nrmancuso nrmancuso merged commit 31f7431 into checkstyle:master Oct 23, 2023
112 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants