Skip to content

Commit dd3969f

Browse files
authored
Merge pull request #211 from h1alexbel/208
bug(#208): incorrect-package accepts `fqn`
2 parents ad035ee + c5f1c39 commit dd3969f

File tree

4 files changed

+75
-3
lines changed

4 files changed

+75
-3
lines changed

src/main/resources/org/eolang/lints/metas/incorrect-package.xsl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ SOFTWARE.
3131
<xsl:variable name="meta-head" select="head"/>
3232
<xsl:variable name="meta-tail" select="tail"/>
3333
<xsl:variable name="first" select="normalize-space(substring-before(concat($meta-tail, ' '), ' '))"/>
34-
<xsl:if test="$meta-head='package' and not(matches($first, '^[a-z][a-z0-9_]*(\.[a-z][a-z0-9_]+)*$'))">
34+
<xsl:if test="$meta-head='package' and not(matches($first, '^[a-zA-Z0-9_]+(\.[a-zA-Z0-9_]+|\$[a-zA-Z0-9_]*)*$|[\p{L}\p{M}\p{N}_]+(\.[\p{L}\p{M}\p{N}_]+)*$'))">
3535
<xsl:element name="defect">
3636
<xsl:attribute name="line">
3737
<xsl:value-of select="eo:lineno(@line)"/>
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# The MIT License (MIT)
2+
#
3+
# Copyright (c) 2016-2024 Objectionary.com
4+
#
5+
# Permission is hereby granted, free of charge, to any person obtaining a copy
6+
# of this software and associated documentation files (the "Software"), to deal
7+
# in the Software without restriction, including without limitation the rights
8+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
# copies of the Software, and to permit persons to whom the Software is
10+
# furnished to do so, subject to the following conditions:
11+
#
12+
# The above copyright notice and this permission notice shall be included
13+
# in all copies or substantial portions of the Software.
14+
#
15+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
18+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
# SOFTWARE.
22+
---
23+
sheets:
24+
- /org/eolang/lints/metas/incorrect-package.xsl
25+
asserts:
26+
- /defects[count(defect[@severity='warning'])=0]
27+
input: |
28+
+package hello.world
29+
+package hello.world123
30+
+package foo.бар
31+
+package test_xyz
32+
+package j$org.j$eolang.j$jeo
33+
+package com.foo$bar
34+
+package universe@obj
35+
+package c.d-test.x-yz
36+
+package a.b-привет.c-大家好
37+
38+
# Test.
39+
[] > foo
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# The MIT License (MIT)
2+
#
3+
# Copyright (c) 2016-2024 Objectionary.com
4+
#
5+
# Permission is hereby granted, free of charge, to any person obtaining a copy
6+
# of this software and associated documentation files (the "Software"), to deal
7+
# in the Software without restriction, including without limitation the rights
8+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
# copies of the Software, and to permit persons to whom the Software is
10+
# furnished to do so, subject to the following conditions:
11+
#
12+
# The above copyright notice and this permission notice shall be included
13+
# in all copies or substantial portions of the Software.
14+
#
15+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
18+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
# SOFTWARE.
22+
---
23+
sheets:
24+
- /org/eolang/lints/metas/incorrect-package.xsl
25+
asserts:
26+
- /defects[count(defect[@severity='warning'])=0]
27+
input: |
28+
+package Foo
29+
+package Hello.WorLd
30+
+package baR.XYZ
31+
32+
# Test.
33+
[] > foo

src/test/resources/org/eolang/lints/packs/incorrect-package/catches-incorrect-package.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@
2323
sheets:
2424
- /org/eolang/lints/metas/incorrect-package.xsl
2525
asserts:
26-
- /defects[count(defect[@severity='warning'])=3]
26+
- /defects[count(defect[@severity='warning'])=2]
2727
input: |
2828
+package test.
2929
+package привет, как дела?
30-
+package привет.foo
3130
31+
# Foo.
3232
[] > foo

0 commit comments

Comments
 (0)