Skip to content
Open
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
10 changes: 9 additions & 1 deletion src/main/resources/org/eolang/lints/names/compound-name.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<xsl:import href="/org/eolang/funcs/lineno.xsl"/>
<xsl:import href="/org/eolang/funcs/defect-context.xsl"/>
<xsl:import href="/org/eolang/funcs/special-name.xsl"/>
<xsl:import href="/org/eolang/funcs/test-name.xsl"/>
<xsl:import href="/org/eolang/funcs/escape.xsl"/>
<xsl:output encoding="UTF-8" method="xml"/>
<!-- Since developers might decide not to use kebab-case, it's better to catch all such cases. -->
Expand All @@ -27,7 +28,14 @@
</xsl:function>
<xsl:template match="/">
<defects>
<xsl:for-each select="//o[@base and (@local, @name)[1][not(eo:special(.)) and eo:compound(.) and not(eo:idiomatic(.))]]">
<!--
A unit test is not an attribute, even when it is written as an
application, such as "pos.eq 6 +> can-find-space", and therefore
carries a "@base", unlike a "[] +> can-find-space" formation. Its name
must start with a prefix such as "can-" (see "bad-test-name"), so it is
always compound.
-->
<xsl:for-each select="//o[@base and not(eo:test-name(@name)) and (@local, @name)[1][not(eo:special(.)) and eo:compound(.) and not(eo:idiomatic(.))]]">
<defect>
<xsl:variable name="line" select="eo:lineno(@line)"/>
<xsl:attribute name="line">
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# SPDX-FileCopyrightText: Copyright (c) 2016-2026 Objectionary.com
# SPDX-License-Identifier: MIT
---
sheets:
- /org/eolang/lints/names/compound-name.xsl
defects: 0
input: |
[] > phrase
"Object Thinking" > text
text.index-of " " > pos

pos.eq 6 +> can-find-space

eq. +> can-find-space-again
pos
6

text.slice 20 1 -> cannot-slice-past-end

[] +> can-find-space-in-formation
^.pos.eq 6 > @
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# SPDX-FileCopyrightText: Copyright (c) 2016-2026 Objectionary.com
# SPDX-License-Identifier: MIT
---
sheets:
- /org/eolang/lints/names/compound-name.xsl
asserts:
- /defects[count(defect[@severity='warning'])=1]
- /defects/defect[@line='3']
- /defects/defect[contains(., 'space-pos')]
- /defects[not(defect[contains(., 'can-find-space')])]
input: |
[] > phrase
"Object Thinking" > text
text.index-of " " > space-pos

space-pos.eq 6 +> can-find-space
Loading