Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions conan/cli/formatters/graph/info_graph_html.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,13 @@
// Add error conflict node
nodes.push({
id: "{{ error["type"] }}",
label: "{{ error["context"].require.ref }}",
label: {{ error["context"].require.ref|string|tojson }},

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Note that the tojson function adds proper quoting to the label, so that they are not needed in the js code itself

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I dont know enough of this lib, but it seems it makes sense 👍

shape: "circle",
font: { color: "white" },
color: "red",
fulllabel: '<h3>{{ error["context"].require.ref }}</h3><p>This node creates a conflict in the dependency graph</p>',
fulllabel: '<h3>' +
{{ error["context"].require.ref|string|tojson }} +
'</h3><p>This node creates a conflict in the dependency graph</p>',
shapeProperties: { borderDashes: [5, 5] }
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ def test_user_templates():
assert template_folder in c.stdout


def test_graph_info_html_output():
def test_graph_info_html_error_reporting_output():
tc = TestClient()
tc.save({"lib/conanfile.py": GenConanfile("lib"),
"ui/conanfile.py": GenConanfile("ui", "1.0").with_requirement("lib/1.0"),
Expand Down Expand Up @@ -212,3 +212,17 @@ def test_graph_info_html_output():
# There used to be a few bugs with weird graphs, check for regressions
assert "jinja2.exceptions.UndefinedError" not in tc.out
assert "from: ," not in tc.out


def test_graph_info_html_error_range_quoting():
tc = TestClient()
tc.save({"zlib/conanfile.py": GenConanfile("zlib"),
"libpng/conanfile.py": GenConanfile("libpng", "1.0").with_requirement("zlib/[>=1.0]")})

tc.run("export zlib --version=1.0")
tc.run("export zlib --version=0.1")
tc.run("export libpng")

tc.run("graph info --requires=zlib/0.1 --requires=libpng/1.0 --format=html", assert_error=True)
assert 'zlib/[&gt;=1.0]' not in tc.out
assert r'"zlib/[\u003e=1.0]"' in tc.out