Skip to content

Commit 9d95bb4

Browse files
authored
Merge pull request #655 from h1alexbel/654
bug(#654): `self-referencing` correctly compares the `@name` and `@base`
1 parent 7e98f7d commit 9d95bb4

File tree

5 files changed

+50
-1
lines changed

5 files changed

+50
-1
lines changed

src/main/resources/org/eolang/lints/critical/self-referencing.xsl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<xsl:output encoding="UTF-8" method="xml"/>
1111
<xsl:template match="/">
1212
<defects>
13-
<xsl:for-each select="//o[@name and starts-with(@base, concat('$.', @name))]">
13+
<xsl:for-each select="//o[@name and (@base = concat('$.', @name) or starts-with(@base, concat('$.', @name, '.')))]">
1414
<xsl:element name="defect">
1515
<xsl:variable name="line" select="eo:lineno(@line)"/>
1616
<xsl:attribute name="line">
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# SPDX-FileCopyrightText: Copyright (c) 2016-2025 Objectionary.com
2+
# SPDX-License-Identifier: MIT
3+
---
4+
sheets:
5+
- /org/eolang/lints/critical/self-referencing.xsl
6+
asserts:
7+
- /defects[count(defect)=0]
8+
input: |
9+
# App.
10+
[] > app
11+
a. > foo
12+
b > bar!
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# SPDX-FileCopyrightText: Copyright (c) 2016-2025 Objectionary.com
2+
# SPDX-License-Identifier: MIT
3+
---
4+
sheets:
5+
- /org/eolang/lints/critical/self-referencing.xsl
6+
asserts:
7+
- /defects[count(defect)=0]
8+
input: |
9+
# App.
10+
[] > app
11+
a. > foo
12+
b > foo-1!
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# SPDX-FileCopyrightText: Copyright (c) 2016-2025 Objectionary.com
2+
# SPDX-License-Identifier: MIT
3+
---
4+
sheets:
5+
- /org/eolang/lints/critical/self-referencing.xsl
6+
asserts:
7+
- /defects[count(defect)=0]
8+
input: |
9+
# App.
10+
[] > app
11+
a. > foo
12+
b > foo1!
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# SPDX-FileCopyrightText: Copyright (c) 2016-2025 Objectionary.com
2+
# SPDX-License-Identifier: MIT
3+
---
4+
sheets:
5+
- /org/eolang/lints/critical/self-referencing.xsl
6+
asserts:
7+
- /defects[count(defect[@severity='error'])=1]
8+
- /defects/defect[@line='3']
9+
input: |
10+
# App.
11+
[] > app
12+
a. > foo
13+
b > foo

0 commit comments

Comments
 (0)