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

Coradoc integration #92

Merged
merged 4 commits into from
Apr 26, 2024
Merged

Coradoc integration #92

merged 4 commits into from
Apr 26, 2024

Conversation

ronaldtse
Copy link
Contributor

From @xyz65535


u_before = unconstrained_before?(node)
u_after = unconstrained_after?(node)
u = !((!u_before || has_leading_whitespace) && (!u_after || has_trailing_whitespace))
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. [93/80]

content
else
"#{content[/^\s*/]}_#{content.strip}_#{content[/\s*$/]}"
def to_coradoc(node, state = {})
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 to_coradoc is too high. [<13, 29, 7> 32.54/15]
Cyclomatic complexity for to_coradoc is too high. [8/6]
Method has too many lines. [31/10]
Perceived complexity for to_coradoc is too high. [8/7]

width = node['width']
height = node['height']
anchor = id ? "[[#{id}]]\n" : ""
def to_coradoc(node, _state = {})
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 to_coradoc is too high. [<8, 15, 6> 18.03/15]
Cyclomatic complexity for to_coradoc is too high. [7/6]
Method has too many lines. [22/10]
Perceived complexity for to_coradoc is too high. [8/7]

stem = stem.gsub(/\[/, "\\[").gsub(/\]/, "\\]").gsub(/\(\(([^\)]+)\)\)/, "(\\1)") unless stem.nil?
unless stem.nil?
stem = stem.gsub(/\[/, "\\[").gsub(/\]/, "\\]").gsub(
/\(\(([^\)]+)\)\)/, "(\\1)"
Copy link

Choose a reason for hiding this comment

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

Redundant escape inside regexp literal

else
nil
end
case node["style"]
Copy link

Choose a reason for hiding this comment

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

Consider replacing case-when with a hash lookup.

id = node['id']
anchor = id ? "[[#{id}]]" : ""
colrowattr = colrow(node['colspan'], node['rowspan'])
def to_coradoc(node, state = {})
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 to_coradoc is too high. [<18, 24, 8> 31.05/15]
Cyclomatic complexity for to_coradoc is too high. [7/6]
Method has too many lines. [20/10]

then input.root
elsif input.is_a?(Nokogiri::XML::Node)
then input
def self.to_coradoc(input, options = {})
Copy link

Choose a reason for hiding this comment

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

Method has too many lines. [12/10]

is_expected.to include " link <<content,internal jumplinks>> with anchors "
}
it {
is_expected.to include " link <<content2>>internal jumplinks without anchors "
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]

it { is_expected.to include ' link <<content2>>internal jumplinks without anchors ' }
it { is_expected.to include ' treat [[content]] as bookmarks ' }
it {
is_expected.to include " do not ignore link:foo.html[] anchor tags with no link text "
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. [90/80]


it { is_expected.to include 'There should be space before but not after the anchor ( http://foobar.com[stripped]).' }
it {
is_expected.to include "There should be space before but not after the anchor ( http://foobar.com[stripped])."
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. [114/80]

Comment on lines 26 to +31
string
.gsub(/((?<=\s)[\*_]+)|[\*_]+(?=\s)/) { |n| n.chars.map { |char| subs[char] }.join }
.gsub(/((?<=\s)[\*_]+)|[\*_]+(?=\s)/) do |n|
n.chars.map do |char|
subs[char]
end.join
end

Check failure

Code scanning / CodeQL

Polynomial regular expression used on uncontrolled data High

This
regular expression
that depends on a
library input
may run slow on strings with many repetitions of '*'.
This
regular expression
that depends on a
library input
may run slow on strings with many repetitions of '*'.
This
regular expression
that depends on a
library input
may run slow on strings with many repetitions of '*'.
This
regular expression
that depends on a
library input
may run slow on strings with many repetitions of '*'.
This
regular expression
that depends on a
library input
may run slow on strings with many repetitions of '*'.
This
regular expression
that depends on a
library input
may run slow on strings with many repetitions of '*'.
This
regular expression
that depends on a
library input
may run slow on strings with many repetitions of '*'.
This
regular expression
that depends on a
library input
may run slow on strings with many repetitions of '*'.
This
regular expression
that depends on a
library input
may run slow on strings with many repetitions of '*'.
This
regular expression
that depends on a
library input
may run slow on strings with many repetitions of '*'.
Comment on lines +19 to +21
stem = stem.gsub(/\[/, "\\[").gsub(/\]/, "\\]").gsub(
/\(\(([^\)]+)\)\)/, "(\\1)"
)

Check failure

Code scanning / CodeQL

Polynomial regular expression used on uncontrolled data High

This
regular expression
that depends on a
library input
may run slow on strings starting with '((' and with many repetitions of '((('.
This
regular expression
that depends on a
library input
may run slow on strings starting with '((' and with many repetitions of '((('.
end

def language_from_confluence_class(node)
node['class'].to_s[/brush:\s?(:?.*);/, 1]
node["class"].to_s[/brush:\s?(:?.*);/, 1]

Check failure

Code scanning / CodeQL

Polynomial regular expression used on uncontrolled data High

This
regular expression
that depends on a
library input
may run slow on strings starting with 'brush:' and with many repetitions of 'brush::'.
This
regular expression
that depends on a
library input
may run slow on strings starting with 'brush:' and with many repetitions of 'brush::'.
stem = node.to_s.gsub(/\n/, " ")
stem = MathML2AsciiMath.m2a(stem) if ReverseAdoc.config.mathml2asciimath
stem = stem.gsub(/\[/, "\\[").gsub(/\]/, "\\]").gsub(/\(\(([^\)]+)\)\)/, "(\\1)") unless stem.nil?
unless stem.nil?
stem = stem.gsub(/\[/, "\\[").gsub(/\]/, "\\]").gsub(

Check failure

Code scanning / CodeQL

Incomplete string escaping or encoding High

This does not escape backslash characters in the input.
stem = node.to_s.gsub(/\n/, " ")
stem = MathML2AsciiMath.m2a(stem) if ReverseAdoc.config.mathml2asciimath
stem = stem.gsub(/\[/, "\\[").gsub(/\]/, "\\]").gsub(/\(\(([^\)]+)\)\)/, "(\\1)") unless stem.nil?
unless stem.nil?
stem = stem.gsub(/\[/, "\\[").gsub(/\]/, "\\]").gsub(

Check failure

Code scanning / CodeQL

Incomplete string escaping or encoding High

This does not escape backslash characters in the input.
@ronaldtse ronaldtse merged commit fe62bc2 into main Apr 26, 2024
15 of 17 checks passed
@ronaldtse ronaldtse deleted the xyz65535-coradoc-integration branch April 26, 2024 11:03
@ronaldtse
Copy link
Contributor Author

@xyz65535 for additional issues please help use a new PR. Thanks.

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.

2 participants