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

HTML formatter splits one line in two #1750

Closed
lompy opened this issue Apr 1, 2015 · 1 comment
Closed

HTML formatter splits one line in two #1750

lompy opened this issue Apr 1, 2015 · 1 comment
Assignees
Labels

Comments

@lompy
Copy link

lompy commented Apr 1, 2015

Initial line of source file:

    Regexp.new(/\A<p>(.*)<\/p>\Z/m).match(full_document)[1] rescue full_document

Output from standard formatter:

app/models/ppt_html.rb:15:5: C: Avoid using rescue in its modifier form.
    Regexp.new(/\A<p>(.*)<\/p>\Z/m).match(full_document)[1] rescue full_document
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Output from HTML formatter

<div class="report">
    <div class="meta">
        <span class="location">Line #15</span><span class="severity convention">convention:</span>
        <span class="message">Avoid using <code>rescue</code> in its modifier form.</span>
    </div>
    <pre>
        <code>    full_document = <span class="highlight convention">Regexp.new(/\A</span>
        </code>
        <p>
            <code>
                (.*)&lt;\/p&gt;\Z/m).match(full_document)[1] rescue full_document
            </code>
        </p>
    </pre>
</div>

Output from HTML formatter is rendered as two separate lines of code split by <p> tag in regexp literal.

@jonas054 jonas054 self-assigned this Apr 2, 2015
@jonas054 jonas054 added the bug label Apr 2, 2015
@jonas054
Copy link
Collaborator

jonas054 commented Apr 2, 2015

Some escaping is missing.

bbatsov added a commit that referenced this issue Apr 2, 2015
[Fix #1750] Escape offending code lines output by HTMLFormatter
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants