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

deal with combination of floating title and beforeclauses note: https… #822

Merged
merged 9 commits into from
Oct 23, 2023

Conversation

opoudjis
Copy link
Contributor

…://github.com//issues/815

Metanorma PR checklist

@opoudjis opoudjis self-assigned this Oct 13, 2023
# only move clausebefore notes at the very end of preface
def endofpreface_clausebefore(xmldoc, ins)
xmldoc.xpath("//preface//*[@beforeclauses = 'true']").reverse.each do |x|
textafternote = xmldoc.xpath("//preface//*") & x.xpath("./following::*")
Copy link

Choose a reason for hiding this comment

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

Line is too long. [82/80]


# only move clausebefore notes at the very end of preface
def endofpreface_clausebefore(xmldoc, ins)
xmldoc.xpath("//preface//*[@beforeclauses = 'true']").reverse.each do |x|
Copy link

Choose a reason for hiding this comment

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

Line is too long. [81/80]

ins = insert_before(xmldoc, "//sections")
xmldoc.xpath("//sections//*[@beforeclauses = 'true']").each do |x|
xmldoc.xpath("//sections//*[@beforeclauses = 'true']").reverse.each do |x|
Copy link

Choose a reason for hiding this comment

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

Line is too long. [82/80]

expect(xmlpp(strip_guid(ret.to_xml)))
.to be_equivalent_to(xmlpp(output))
end

Copy link

Choose a reason for hiding this comment

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

Extra empty line detected at block body end.

More

== Scope
INPUT
Copy link

Choose a reason for hiding this comment

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

INPUT is not aligned with input = <<~INPUT.

.to be_equivalent_to(xmlpp(output))

input = <<~INPUT
#{ASCIIDOC_BLANK_HDR}
Copy link

Choose a reason for hiding this comment

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

Use 2 spaces for indentation in a heredoc.

expect(xmlpp(strip_guid(ret.to_xml)))
.to be_equivalent_to(xmlpp(output))

input = <<~INPUT
Copy link

Choose a reason for hiding this comment

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

Inconsistent indentation detected.

@@ -1889,4 +1889,86 @@
expect(xmlpp(strip_guid(ret.to_xml)))
.to be_equivalent_to(xmlpp(output))
end

it "puts floating title + clausebefore note before scope into sections container" do
Copy link

Choose a reason for hiding this comment

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

Line is too long. [86/80]

elsif node.at("./self::*#{ABBRnoSYM}") then :ans
elsif node.at("./self::*#{SYMABBR}") then :sa
elsif node.at("./self::*#{NO_SYMABBR}") then :nsa
elsif node.name == "definitions" # ignore
Copy link

Choose a reason for hiding this comment

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

Avoid elsif branches without a body.

elsif node.at(".//term") && node.at("./self::*#{SYMnoABBR}") then :tsna
elsif node.at(".//term") && node.at("./self::*#{ABBRnoSYM}") then :tans
elsif node.at(".//term") && node.at("./self::*#{SYMABBR}") then :tsa
elsif node.at(".//term") && node.at("./self::*#{NO_SYMABBR}") then :tnsa
Copy link

Choose a reason for hiding this comment

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

Line is too long. [86/80]

end
elsif node.at(".//term") && node.at("./self::*#{SYMnoABBR}") then :tsna
elsif node.at(".//term") && node.at("./self::*#{ABBRnoSYM}") then :tans
elsif node.at(".//term") && node.at("./self::*#{SYMABBR}") then :tsa
Copy link

Choose a reason for hiding this comment

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

Line is too long. [82/80]

:term
end
elsif node.at(".//term") && node.at("./self::*#{SYMnoABBR}") then :tsna
elsif node.at(".//term") && node.at("./self::*#{ABBRnoSYM}") then :tans
Copy link

Choose a reason for hiding this comment

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

Line is too long. [85/80]

unless m[:parent] == :term # don't count Term > Term twice
:term
end
elsif node.at(".//term") && node.at("./self::*#{SYMnoABBR}") then :tsna
Copy link

Choose a reason for hiding this comment

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

Line is too long. [85/80]

end
end

def terms_subclause_type_tally(node, m, parent)
Copy link

Choose a reason for hiding this comment

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

Assignment Branch Condition size for terms_subclause_type_tally is too high. [<3, 24, 29> 37.76/15]
Cyclomatic complexity for terms_subclause_type_tally is too high. [24/6]
Method has too many lines. [21/10]
Perceived complexity for terms_subclause_type_tally is too high. [25/7]
Method parameter must be at least 3 characters long.

true
end

def section_names_terms1_cleanup(xml)
Copy link

Choose a reason for hiding this comment

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

Cyclomatic complexity for section_names_terms1_cleanup is too high. [7/6]
Method has too many lines. [14/10]

IsoDoc::PresentationXMLConvert.new(html_extract_attributes(node))
IsoDoc::PresentationXMLConvert
.new(html_extract_attributes(node)
.merge(output_formats: ::Metanorma::Standoc::Processor.new.output_formats) )
Copy link

Choose a reason for hiding this comment

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

Line is too long. [117/80]
Unnecessary spacing detected.
Space inside parentheses detected.

.to be_equivalent_to xmlpp(output)
end

it "does not do automated terms & definitions titles if there are extraneous sections" do
Copy link

Choose a reason for hiding this comment

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

Line is too long. [91/80]

@@ -873,6 +836,299 @@
.to be_equivalent_to xmlpp(output)
end

it "automates terms & definitions titles if there are no extraneous sections" do
Copy link

Choose a reason for hiding this comment

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

Line is too long. [82/80]

…only one instance of terms boilerplate (as in ISO), and multiple instnces of terms collections or clauses before the terms collection: metanorma/metanorma-iso#1040
…only one instance of terms boilerplate (as in ISO), and multiple instnces of terms collections or clauses before the terms collection: metanorma/metanorma-iso#1040
f = termdef_boilerplate_insert_location(xmldoc)
termdef_boilerplate_insert1(f, xmldoc, isodoc)
else
xmldoc.xpath(self.class::TERM_CLAUSE).each do |f|
Copy link

Choose a reason for hiding this comment

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

Shadowing outer local variable - f.

expect_any_instance_of(Metanorma::Standoc::Converter)
.to receive(:termdef_boilerplate_insert)
.and_wrap_original do |method, a, b|
method.call(a, b, true)
Copy link

Choose a reason for hiding this comment

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

Use 2 (not -2) spaces for indentation.


# ISO behaviour of single Terms boilerplate
def mock_termdef_boilerplate_insert_iso
stub_const("Metanorma::Standoc::Converter::TERM_CLAUSE", "//sections//terms")
Copy link

Choose a reason for hiding this comment

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

Line is too long. [81/80]


INPUT
output = <<~OUTPUT
#{BLANK_HDR}
Copy link

Choose a reason for hiding this comment

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

Use 2 spaces for indentation in a heredoc.

.to be_equivalent_to xmlpp(output)
end

it "places single terms boilerplate at root if there are clauses preceding the terms collection, other than boilerplate" do
Copy link

Choose a reason for hiding this comment

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

Inconsistent indentation detected.
Line is too long. [127/80]


INPUT
output = <<~OUTPUT
#{BLANK_HDR}
Copy link

Choose a reason for hiding this comment

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

Use 2 spaces for indentation in a heredoc.

.to be_equivalent_to xmlpp(output)
end

it "places single terms boilerplate at root if there are multiple terms collections" do
Copy link

Choose a reason for hiding this comment

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

Inconsistent indentation detected.
Line is too long. [91/80]

OUTPUT
expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
.to be_equivalent_to xmlpp(output)
end
Copy link

Choose a reason for hiding this comment

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

end at 1993, 4 is not aligned with it "places single terms boilerplate in expected location for ISO" do at 1953, 2.


INPUT
output = <<~OUTPUT
#{BLANK_HDR}
Copy link

Choose a reason for hiding this comment

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

Use 2 spaces for indentation in a heredoc.

@opoudjis opoudjis merged commit 5b56860 into main Oct 23, 2023
3 of 15 checks passed
@opoudjis opoudjis deleted the fix/float_clausebefore branch October 23, 2023 09:36
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.

1 participant