Skip to content

Commit

Permalink
Merge branch '__rultor'
Browse files Browse the repository at this point in the history
  • Loading branch information
rultor committed Jan 16, 2025
2 parents 4ea0abf + 4063a1f commit 597e0ca
Show file tree
Hide file tree
Showing 48 changed files with 483 additions and 149 deletions.
12 changes: 12 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,18 @@ SOFTWARE.
<version>0.7.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.languagetool</groupId>
<artifactId>language-en</artifactId>
<version>6.5</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.jcabi</groupId>
<artifactId>jcabi-matchers</artifactId>
<version>1.8.0</version>
<scope>test</scope>
</dependency>
</dependencies>
<profiles>
<profile>
Expand Down
30 changes: 30 additions & 0 deletions src/main/resources/org/eolang/funcs/escape.xsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?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" xmlns:eo="https://www.eolang.org" xmlns:xs="http://www.w3.org/2001/XMLSchema" id="escape" version="2.0">
<xsl:function name="eo:escape" as="xs:string">
<xsl:param name="text"/>
<xsl:value-of select="concat('&quot;', replace(replace($text, ' ', '⌴'), '&quot;', '\\x22'), '&quot;')"/>
</xsl:function>
</xsl:stylesheet>
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ SOFTWARE.
-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:eo="https://www.eolang.org" id="alias-too-long" version="2.0">
<xsl:import href="/org/eolang/funcs/lineno.xsl"/>
<xsl:import href="/org/eolang/funcs/escape.xsl"/>
<xsl:output encoding="UTF-8" method="xml"/>
<xsl:template match="/">
<defects>
Expand All @@ -36,9 +37,8 @@ SOFTWARE.
<xsl:attribute name="severity">
<xsl:text>error</xsl:text>
</xsl:attribute>
<xsl:text>The alias has too many parts: "</xsl:text>
<xsl:value-of select="tail"/>
<xsl:text>"</xsl:text>
<xsl:text>The alias has too many parts: </xsl:text>
<xsl:value-of select="eo:escape(tail)"/>
</xsl:element>
</xsl:if>
</xsl:for-each>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ SOFTWARE.
-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:eo="https://www.eolang.org" id="broken-alias-first" version="2.0">
<xsl:import href="/org/eolang/funcs/lineno.xsl"/>
<xsl:import href="/org/eolang/funcs/escape.xsl"/>
<xsl:output encoding="UTF-8" method="xml"/>
<xsl:template match="/">
<defects>
Expand All @@ -36,9 +37,9 @@ SOFTWARE.
<xsl:attribute name="severity">
<xsl:text>error</xsl:text>
</xsl:attribute>
<xsl:text>The first part of the alias is invalid: "</xsl:text>
<xsl:value-of select="part[1]"/>
<xsl:text>" (it may only contain a relative name of the object, not its FQN)</xsl:text>
<xsl:text>The first part of the alias is invalid: </xsl:text>
<xsl:value-of select="eo:escape(part[1])"/>
<xsl:text> (it may only contain a relative name of the object, not its FQN)</xsl:text>
</xsl:element>
</xsl:if>
</xsl:for-each>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ SOFTWARE.
-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:eo="https://www.eolang.org" id="broken-alias-second" version="2.0">
<xsl:import href="/org/eolang/funcs/lineno.xsl"/>
<xsl:import href="/org/eolang/funcs/escape.xsl"/>
<xsl:output encoding="UTF-8" method="xml"/>
<xsl:template match="/">
<defects>
Expand All @@ -36,9 +37,9 @@ SOFTWARE.
<xsl:attribute name="severity">
<xsl:text>error</xsl:text>
</xsl:attribute>
<xsl:text>The second part of the alias is invalid: "</xsl:text>
<xsl:value-of select="part[2]"/>
<xsl:text>" (it may only contain FQN)</xsl:text>
<xsl:text>The second part of the alias is invalid: </xsl:text>
<xsl:value-of select="eo:escape(part[2])"/>
<xsl:text> (it may only contain FQN)</xsl:text>
</xsl:element>
</xsl:if>
</xsl:for-each>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ SOFTWARE.
-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:eo="https://www.eolang.org" id="duplicate-aliases" version="2.0">
<xsl:import href="/org/eolang/funcs/lineno.xsl"/>
<xsl:import href="/org/eolang/funcs/escape.xsl"/>
<xsl:output encoding="UTF-8" method="xml"/>
<xsl:template match="/">
<defects>
Expand All @@ -37,9 +38,9 @@ SOFTWARE.
<xsl:attribute name="severity">
<xsl:text>error</xsl:text>
</xsl:attribute>
<xsl:text>The alias "</xsl:text>
<xsl:value-of select="$name"/>
<xsl:text>" is duplicated</xsl:text>
<xsl:text>The alias </xsl:text>
<xsl:value-of select="eo:escape($name)"/>
<xsl:text> is duplicated</xsl:text>
</xsl:element>
</xsl:if>
</xsl:for-each>
Expand All @@ -56,9 +57,9 @@ SOFTWARE.
<xsl:attribute name="severity">
<xsl:text>error</xsl:text>
</xsl:attribute>
<xsl:text>The name "</xsl:text>
<xsl:value-of select="@name"/>
<xsl:text>" is already in use</xsl:text>
<xsl:text>The name </xsl:text>
<xsl:value-of select="eo:escape(@name)"/>
<xsl:text> is already in use</xsl:text>
</error>
</xsl:if>
</xsl:for-each>
Expand Down
10 changes: 5 additions & 5 deletions src/main/resources/org/eolang/lints/aliases/unused-alias.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ SOFTWARE.
-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:eo="https://www.eolang.org" id="unused-alias" version="2.0">
<xsl:import href="/org/eolang/funcs/lineno.xsl"/>
<xsl:import href="/org/eolang/funcs/escape.xsl"/>
<xsl:output encoding="UTF-8" method="xml"/>
<xsl:template match="/">
<defects>
Expand All @@ -37,11 +38,10 @@ SOFTWARE.
<xsl:attribute name="severity">
<xsl:text>error</xsl:text>
</xsl:attribute>
<xsl:text>The alias "</xsl:text>
<xsl:value-of select="$name"/>
<xsl:text>" is not used, but defined as "+alias </xsl:text>
<xsl:value-of select="tail"/>
<xsl:text>"</xsl:text>
<xsl:text>The alias </xsl:text>
<xsl:value-of select="eo:escape($name)"/>
<xsl:text> is not used, but defined as </xsl:text>
<xsl:value-of select="eo:escape(tail)"/>
</xsl:element>
</xsl:if>
</xsl:for-each>
Expand Down
10 changes: 5 additions & 5 deletions src/main/resources/org/eolang/lints/atoms/atom-and-base.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ SOFTWARE.
-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:eo="https://www.eolang.org" id="atom-and-base" version="2.0">
<xsl:import href="/org/eolang/funcs/lineno.xsl"/>
<xsl:import href="/org/eolang/funcs/escape.xsl"/>
<xsl:output encoding="UTF-8" method="xml"/>
<xsl:template match="/">
<defects>
Expand All @@ -35,11 +36,10 @@ SOFTWARE.
<xsl:attribute name="severity">
<xsl:text>critical</xsl:text>
</xsl:attribute>
<xsl:text>The atom "</xsl:text>
<xsl:value-of select="@name"/>
<xsl:text>" may not have the "@base" attribute, which however exists with "</xsl:text>
<xsl:value-of select="@base"/>
<xsl:text>"</xsl:text>
<xsl:text>The atom </xsl:text>
<xsl:value-of select="eo:escape(@name)"/>
<xsl:text> may not have the "@base" attribute, which however exists with </xsl:text>
<xsl:value-of select="eo:escape(@base)"/>
</xsl:element>
</xsl:for-each>
</defects>
Expand Down
11 changes: 5 additions & 6 deletions src/main/resources/org/eolang/lints/atoms/atom-in-atom.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ SOFTWARE.
-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:eo="https://www.eolang.org" id="atom-in-atom" version="2.0">
<xsl:import href="/org/eolang/funcs/lineno.xsl"/>
<xsl:import href="/org/eolang/funcs/escape.xsl"/>
<xsl:output encoding="UTF-8" method="xml"/>
<xsl:template match="/">
<defects>
Expand All @@ -35,16 +36,14 @@ SOFTWARE.
<xsl:attribute name="severity">
<xsl:text>error</xsl:text>
</xsl:attribute>
<xsl:text>Atom "</xsl:text>
<xsl:value-of select="@name"/>
<xsl:text>" may not have any attributes, even if they are atoms, which however exist: </xsl:text>
<xsl:text>Atom </xsl:text>
<xsl:value-of select="eo:escape(@name)"/>
<xsl:text> may not have any attributes, even if they are atoms, which however exist: </xsl:text>
<xsl:for-each select="o[@atom]">
<xsl:if test="position() &gt; 1">
<xsl:text>, </xsl:text>
</xsl:if>
<xsl:text>"</xsl:text>
<xsl:value-of select="@name"/>
<xsl:text>"</xsl:text>
<xsl:value-of select="eo:escape(@name)"/>
</xsl:for-each>
</xsl:element>
</xsl:for-each>
Expand Down
7 changes: 4 additions & 3 deletions src/main/resources/org/eolang/lints/atoms/atom-without-rt.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ SOFTWARE.
-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:eo="https://www.eolang.org" id="atom-without-rt" version="2.0">
<xsl:import href="/org/eolang/funcs/lineno.xsl"/>
<xsl:import href="/org/eolang/funcs/escape.xsl"/>
<xsl:output encoding="UTF-8" method="xml"/>
<xsl:template match="/">
<defects>
Expand All @@ -36,9 +37,9 @@ SOFTWARE.
<xsl:attribute name="severity">
<xsl:text>error</xsl:text>
</xsl:attribute>
<xsl:text>The "</xsl:text>
<xsl:value-of select="@name"/>
<xsl:text>" atom is defined without the +rt meta, which doesn't make any sense</xsl:text>
<xsl:text>The </xsl:text>
<xsl:value-of select="eo:escape(@name)"/>
<xsl:text> atom is defined without the +rt meta, which doesn't make any sense</xsl:text>
</xsl:element>
</xsl:for-each>
</xsl:if>
Expand Down
11 changes: 5 additions & 6 deletions src/main/resources/org/eolang/lints/atoms/not-empty-atom.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ SOFTWARE.
-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:eo="https://www.eolang.org" id="not-empty-atom" version="2.0">
<xsl:import href="/org/eolang/funcs/lineno.xsl"/>
<xsl:import href="/org/eolang/funcs/escape.xsl"/>
<xsl:output encoding="UTF-8" method="xml"/>
<xsl:template match="/">
<defects>
Expand All @@ -35,16 +36,14 @@ SOFTWARE.
<xsl:attribute name="severity">
<xsl:text>error</xsl:text>
</xsl:attribute>
<xsl:text>The atom "</xsl:text>
<xsl:value-of select="@name"/>
<xsl:text>" may not have any attributes, which however exist: </xsl:text>
<xsl:text>The atom </xsl:text>
<xsl:value-of select="eo:escape(@name)"/>
<xsl:text> may not have any attributes, which however exist: </xsl:text>
<xsl:for-each select="o[@base]">
<xsl:if test="position() &gt; 1">
<xsl:text>, </xsl:text>
</xsl:if>
<xsl:text>"</xsl:text>
<xsl:value-of select="@name"/>
<xsl:text>"</xsl:text>
<xsl:value-of select="eo:escape(@name)"/>
</xsl:for-each>
</xsl:element>
</xsl:for-each>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ SOFTWARE.
<xsl:attribute name="severity">
<xsl:text>warning</xsl:text>
</xsl:attribute>
<xsl:text>The comment line width is "</xsl:text>
<xsl:text>The comment line width is </xsl:text>
<xsl:value-of select="string-length(.)"/>
<xsl:text>", while "</xsl:text>
<xsl:text>, while </xsl:text>
<xsl:value-of select="$max"/>
<xsl:text>" is max allowed</xsl:text>
<xsl:text> is max allowed</xsl:text>
</xsl:element>
</xsl:for-each>
</xsl:when>
Expand All @@ -58,11 +58,11 @@ SOFTWARE.
<xsl:attribute name="severity">
<xsl:text>warning</xsl:text>
</xsl:attribute>
<xsl:text>The comment width is "</xsl:text>
<xsl:text>The comment width is </xsl:text>
<xsl:value-of select="string-length(.)"/>
<xsl:text>", while "</xsl:text>
<xsl:text>, while </xsl:text>
<xsl:value-of select="$max"/>
<xsl:text>" is max allowed</xsl:text>
<xsl:text> is max allowed</xsl:text>
</xsl:element>
</xsl:if>
</xsl:otherwise>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ SOFTWARE.
-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:eo="https://www.eolang.org" id="atom-with-data" version="2.0">
<xsl:import href="/org/eolang/funcs/lineno.xsl"/>
<xsl:import href="/org/eolang/funcs/escape.xsl"/>
<xsl:output encoding="UTF-8" method="xml"/>
<xsl:template match="/">
<defects>
Expand All @@ -38,9 +39,8 @@ SOFTWARE.
<xsl:value-of select="eo:lineno(@line)"/>
</xsl:attribute>
<xsl:attribute name="severity">critical</xsl:attribute>
<xsl:text>Atoms must not contain data, while this object contains "</xsl:text>
<xsl:value-of select="$data"/>
<xsl:text>"</xsl:text>
<xsl:text>Atoms must not contain data, while this object contains </xsl:text>
<xsl:value-of select="eo:escape($data)"/>
</defect>
</xsl:if>
</xsl:template>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ SOFTWARE.
-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:eo="https://www.eolang.org" id="duplicate-names" version="2.0">
<xsl:import href="/org/eolang/funcs/lineno.xsl"/>
<xsl:import href="/org/eolang/funcs/escape.xsl"/>
<xsl:output encoding="UTF-8" method="xml"/>
<xsl:template match="/">
<defects>
Expand All @@ -43,9 +44,9 @@ SOFTWARE.
<xsl:attribute name="severity">
<xsl:text>critical</xsl:text>
</xsl:attribute>
<xsl:text>The name "</xsl:text>
<xsl:value-of select="@name"/>
<xsl:text>" is already in use</xsl:text>
<xsl:text>The name </xsl:text>
<xsl:value-of select="eo:escape(@name)"/>
<xsl:text> is already in use</xsl:text>
</xsl:element>
</xsl:if>
</xsl:for-each>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ SOFTWARE.
-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:eo="https://www.eolang.org" version="2.0" id="incorrect-bytes-format">
<xsl:import href="/org/eolang/funcs/lineno.xsl"/>
<xsl:import href="/org/eolang/funcs/escape.xsl"/>
<xsl:output encoding="UTF-8" method="xml"/>
<xsl:template match="/">
<defects>
Expand All @@ -38,9 +39,8 @@ SOFTWARE.
<xsl:value-of select="eo:lineno(@line)"/>
</xsl:attribute>
<xsl:attribute name="severity">critical</xsl:attribute>
<xsl:text>The format of bytes is incorrect: "</xsl:text>
<xsl:value-of select="$bytes"/>
<xsl:text>"</xsl:text>
<xsl:text>The format of bytes is incorrect: </xsl:text>
<xsl:value-of select="eo:escape($bytes)"/>
</defect>
</xsl:if>
</xsl:template>
Expand Down
10 changes: 6 additions & 4 deletions src/main/resources/org/eolang/lints/critical/object-has-data.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ SOFTWARE.
-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:eo="https://www.eolang.org" version="2.0" id="object-has-data">
<xsl:import href="/org/eolang/funcs/lineno.xsl"/>
<xsl:import href="/org/eolang/funcs/escape.xsl"/>
<xsl:output encoding="UTF-8" method="xml"/>
<xsl:template match="/">
<defects>
Expand All @@ -38,7 +39,8 @@ SOFTWARE.
<xsl:value-of select="eo:lineno(@line)"/>
</xsl:attribute>
<xsl:attribute name="severity">critical</xsl:attribute>
<xsl:text>Only objects with their @base attributes containing 'org.eolang.bytes' may contain data, while this object doesn't have @base attribute at all</xsl:text>
<xsl:text>Only objects with their @base attributes containing "org.eolang.bytes" may contain data, </xsl:text>
<xsl:text>while this object doesn't have @base attribute at all</xsl:text>
</defect>
</xsl:if>
<xsl:if test="$data != '' and @base and not(@base = 'bytes' or @base = 'org.eolang.bytes')">
Expand All @@ -47,9 +49,9 @@ SOFTWARE.
<xsl:value-of select="eo:lineno(@line)"/>
</xsl:attribute>
<xsl:attribute name="severity">critical</xsl:attribute>
<xsl:text>Only objects with their @base attributes containing 'org.eolang.bytes' may contain data, while this object contains "</xsl:text>
<xsl:value-of select="$data"/>
<xsl:text>"</xsl:text>
<xsl:text>Only objects with their @base attributes containing "org.eolang.bytes" may contain data, </xsl:text>
<xsl:text>while this object contains </xsl:text>
<xsl:value-of select="eo:escape($data)"/>
</defect>
</xsl:if>
</xsl:template>
Expand Down
Loading

0 comments on commit 597e0ca

Please sign in to comment.