Skip to content

Commit

Permalink
Merge pull request objectionary#285 from h1alexbel/266
Browse files Browse the repository at this point in the history
bug(objectionary#266): correct `sparse-decoration` detection
  • Loading branch information
yegor256 authored Feb 2, 2025
2 parents d4ee0bb + b6b4d6b commit 0ec77f4
Show file tree
Hide file tree
Showing 4 changed files with 75 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,12 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:eo="https://www.eolang.org" id="sparse-decoration" version="2.0">
<xsl:import href="/org/eolang/parser/_funcs.xsl"/>
<xsl:import href="/org/eolang/funcs/lineno.xsl"/>
<xsl:output encoding="UTF-8" method="xml"/>
<xsl:template match="/">
<defects>
<xsl:for-each select="//o[count(o)=1 and o[@name='@' and (not(@base) or @base!='^') and not(o[@base='∅'])]]">
<xsl:for-each select="//o[eo:abstract(.) and count(o)=1 and o[1][@name='@']]">
<xsl:element name="defect">
<xsl:attribute name="line">
<xsl:value-of select="eo:lineno(@line)"/>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# The MIT License (MIT)
#
# Copyright (c) 2016-2025 Objectionary.com
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
---
sheets:
- /org/eolang/lints/misc/sparse-decoration.xsl
asserts:
- /defects[count(defect[@severity='warning'])=0]
input: |
# No comments.
[] > foo
if. > test
a
42
88
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ asserts:
- /defects[count(defect[@severity='warning'])=1]
input: |
# No comments.
[] > decorates-application
if > @
true
5
five
[] > test
if. > @
a
42
88
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# The MIT License (MIT)
#
# Copyright (c) 2016-2025 Objectionary.com
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
---
sheets:
- /org/eolang/lints/misc/sparse-decoration.xsl
asserts:
- /defects[count(defect[@severity='warning'])=2]
input: |
# No comments.
[] > test
# No comments.
[] > @
if. > @
a
42
88

0 comments on commit 0ec77f4

Please sign in to comment.