Skip to content

Commit

Permalink
#2921 add xsl check for using +rt meta without atoms
Browse files Browse the repository at this point in the history
  • Loading branch information
c71n93 committed Mar 14, 2024
1 parent f1f3960 commit 5f1f380
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 1 deletion.
@@ -0,0 +1,53 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
The MIT License (MIT)
Copyright (c) 2016-2024 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.
-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" id="rt-without-atom" version="2.0">
<xsl:output encoding="UTF-8" method="xml"/>
<xsl:template match="/program/errors">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
<xsl:if test="/program/metas/meta[head='rt']">
<xsl:if test="not(//o[@atom])">
<xsl:element name="error">
<xsl:attribute name="check">
<xsl:text>rt-without-atoms</xsl:text>
</xsl:attribute>
<xsl:attribute name="line">
<xsl:value-of select="@line"/>
</xsl:attribute>
<xsl:attribute name="severity">
<xsl:text>error</xsl:text>
</xsl:attribute>
<xsl:text>Using +rt meta without atoms</xsl:text>
</xsl:element>
</xsl:if>
</xsl:if>
</xsl:copy>
</xsl:template>
<xsl:template match="node()|@*">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
Expand Up @@ -30,7 +30,7 @@ SOFTWARE.
<xsl:for-each select="//o[@as and matches(@as, '^(-|\+)\d+$')]">
<xsl:element name="error">
<xsl:attribute name="check">
<xsl:text>zero-version</xsl:text>
<xsl:text>signed-binding-indexes</xsl:text>
</xsl:attribute>
<xsl:attribute name="line">
<xsl:value-of select="@line"/>
Expand Down
@@ -0,0 +1,14 @@
xsls:
- /org/eolang/parser/errors/rt-without-atom.xsl
tests:
- /program/errors[count(error[@severity='error'])=1]
eo: |
+architect yegor256@gmail.com
+home https://github.com/objectionary/eo
+package org.eolang
+rt jvm org.eolang:eo-runtime:0.0.0
+version 0.0.0
# Boolean.
[attr] > obj
attr > @

0 comments on commit 5f1f380

Please sign in to comment.