Skip to content
This repository has been archived by the owner on May 22, 2024. It is now read-only.

#315: Proper implementation of par template (with recursion) #359

Closed
wants to merge 21 commits into from

Conversation

paulodamaso
Copy link
Contributor

For #315, made proper implementation of par template (with recursion)
Performed changes:

  • Corrected par template in templates.xsl for using recursion and correctly replacing paragraphs numbers;
  • Added comment to par.xsl, corrected test description and set ignore to false.

- Added `style` attribute to `code` element in `expected` parameter in `project.xsl`;
- Replaced `!=` operator by `not(deep-equal())` in `assertions.xsl` because received parameters are document fragments, not strings;
- Added `xmlns:xs` so it can be excluded in `assert-that` comparisons (`project.xsl` puts `xmlns:xs` in its elements);
- Corrected `actual` and `expected` variable names in failure message.
Changes:
- Corrected `par` template in `templates.xsl` for using recursion and
correctly replacing paragraphs numbers;
- Added comment to `par.xsl`, corrected test description and set
`ignore` to `false`.
@0crat 0crat added the scope label Jun 29, 2018
@0crat
Copy link
Collaborator

0crat commented Jun 29, 2018

Job #359 is now in scope, role is REV

@0crat
Copy link
Collaborator

0crat commented Jun 29, 2018

This pull request #359 is assigned to @amihaiemil/z, here is why; the budget is 15 minutes, see §4; please, read §27 and when you decide to accept the changes, inform @g4s8/z (the architect) right in this ticket; if you decide that this PR should not be accepted ever, also inform the architect; this blog post will help you understand what is expected from a code reviewer; there will be a monetary reward for this job

@paulodamaso
Copy link
Contributor Author

paulodamaso commented Jun 29, 2018

@amihaiemil Had to commit #339 changes into this branch, because they are needed to proper behavior of assert-that template. Oh and don't be impressed with travis error, it's is segfaulting a lot today.

@amihaiemil
Copy link
Contributor

@paulodamaso I'll have a look in 1-2 days, I'm away from my laptop for the weekend :(

Copy link
Contributor

@amihaiemil amihaiemil left a comment

Choose a reason for hiding this comment

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

@paulodamaso A few comments, please have a look. And try to see why CI is failing -- from what I see, it has nothing to do with your changes but maybe I'm missing something.

<xsl:analyze-string select="$text" regex="(§[0-9]*)">
<xsl:matching-substring>
<xsl:variable select="regex-group(1)" name="paragraph" />
<a href="{concat('http://www.zerocracy.com/policy.html#', substring-after($paragraph,'§'))}">
Copy link
Contributor

Choose a reason for hiding this comment

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

@paulodamaso We should use https:// here, I see it is enabled for zerocracy.com, but redirection from http:// to https:// is not :(

@@ -23,8 +23,9 @@ SOFTWARE.
<xsl:with-param name="message" select="'Fails to format project name'"/>
<xsl:with-param name="expected">
<span>
<code>
<a href="https://www.0crat.com/p/ABCDEFGHI" title="Project ABCDEFGHI">
<code style="background-color:#daf1e0;">
Copy link
Contributor

Choose a reason for hiding this comment

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

@paulodamaso Why the background-color attribute, what does it do? And is the reindentation of <a> needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@amihaiemil This bug correction depends on #339; I've had to put it here so the build doesn't fali.

<xsl:text>" is not equal to expected "</xsl:text>
<xsl:value-of select="$expected_xml"/>
<xsl:copy-of select="$expected"/>
<xsl:text>")</xsl:text>
</xsl:message>
</xsl:if>
Copy link
Contributor

Choose a reason for hiding this comment

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

@paulodamaso I don't think the changes to this file belong in this PR, or?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@amihaiemil Same as above.

Usage of `https` instead `http`.
@paulodamaso
Copy link
Contributor Author

@amihaiemil Thanks for the comments, made some changes and answered question, please take a look.

@paulodamaso
Copy link
Contributor Author

@amihaiemil Let's do this the right way. I've removed all changes unrelated to #315, but now the build fails because some wrong code in master.

@amihaiemil
Copy link
Contributor

amihaiemil commented Jul 2, 2018

@paulodamaso yes, the most correct would be to put this task on hold before #339 is solved. If you can merge the PR for #339 soon (the next 5 days?), then we can wait with this PR.

But if you think it will take longer, then we should close this PR (you keep your branch), and make another one later after the impediment is merged. This is so I don't lose this job, because I can't put PRs on hold ;(

@paulodamaso
Copy link
Contributor Author

@amihaiemil Don't worry, I'll try to fix #339 build problems as soon as possible. I think we will have enough time to this PR.

@amihaiemil
Copy link
Contributor

@paulodamaso sure, thanks :D

@amihaiemil
Copy link
Contributor

@paulodamaso I think you merged the waiting fix, right? But now the CI is still failing :D

@paulodamaso
Copy link
Contributor Author

@amihaiemil I'm having some problems with the build, seems like some lib we are using does not support XSLT 2.0 analyze-string tag. The tests runs locally in my IDE, using Saxon 9.8.08 as processor, I'm suspecting that is a Nokogiri problem. Fortunately it does not work either with Nokogiri 1.8, so it was not caused by the downgrade of Nokogiri in #357 .

@paulodamaso
Copy link
Contributor Author

paulodamaso commented Jul 3, 2018

@g4s8 @amihaiemil This is a no-go here. Nokogiri does not support XPath 2.0 and XSLT 2.0 (see https://stackoverflow.com/questions/2838320/nokogiri-ruby-and-xpath and https://www.rubydoc.info/github/sparklemotion/nokogiri) because it uses libxslt which is an very very old lib. I don't think there is an elegant way of doing this recursive search using XSL 1.0, compared to analyze-string usage; so, I think we should try another way of building these files instead using Nokogiri, WDYT?

@amihaiemil
Copy link
Contributor

@paulodamaso @g4s8 I honestly have no idea, but this seems like a bug. I would say: file a bug so you are paid for this research, put your task on hold (this one) until that one is fixed and you have all the necessary tools to remake this PR later. WDYT?

@g4s8
Copy link
Contributor

g4s8 commented Jul 4, 2018

@paulodamaso @amihaiemil right, I think we have to use Saxon to transform xsl (like it transformed to html in Rakefile), @paulodamaso please submit a bug to run xsl tests with Saxon instead of Nokogiri.

@paulodamaso
Copy link
Contributor Author

@g4s8 Thanks for the direction, created #365 for resolving the issue. Will correct this PR to ignore the test while the new bug is not corrected.

@paulodamaso paulodamaso closed this Jul 4, 2018
@paulodamaso
Copy link
Contributor Author

@g4s8 Closed PR and set impediment in #315.

@0crat
Copy link
Collaborator

0crat commented Jul 4, 2018

@ypshenychka/z please review this job completed by @amihaiemil/z, as in §30; the job will be fully closed and all payments will be made when the quality review is completed

@0crat 0crat removed the scope label Jul 4, 2018
@0crat
Copy link
Collaborator

0crat commented Jul 4, 2018

The job #359 is now out of scope

@0crat
Copy link
Collaborator

0crat commented Jul 4, 2018

Payment to ARC for a closed pull request, as in §28: +10 point(s) just awarded to @g4s8/z

@ypshenychka
Copy link

@amihaiemil According to our QA Rules:

The code reviewer found at least three problems in the code.
Comments were mostly about design problems, not cosmetic issues.

Only two issues were found during code review.
Please confirm that you'll try to find at least three major problems while future reviews.

@amihaiemil
Copy link
Contributor

@ypshenychka confirmed

@ypshenychka
Copy link

@amihaiemil Thanks

@ypshenychka
Copy link

@0crat quality acceptable

@0crat
Copy link
Collaborator

0crat commented Jul 4, 2018

Order was finished, quality is "acceptable": +15 point(s) just awarded to @amihaiemil/z

@ypshenychka
Copy link

@0crat status

@0crat
Copy link
Collaborator

0crat commented Jul 4, 2018

@0crat status (here)

@ypshenychka This is what I know about this job in C3NDPUA8L, as in §32:

@ypshenychka
Copy link

@g4s8 For some reason I got no points and payment here. Could you please do it manually?

@ypshenychka
Copy link

@g4s8 ping

@paulodamaso paulodamaso deleted the 315 branch July 10, 2018 03:31
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants