Skip to content

Commit ebee75d

Browse files
authored
Merge pull request #238 from h1alexbel/237
bug(#237): incorrect-version allows maven convention
2 parents 95a1809 + 307975e commit ebee75d

File tree

5 files changed

+110
-13
lines changed

5 files changed

+110
-13
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ SOFTWARE.
3030
<xsl:for-each select="/program/metas/meta">
3131
<xsl:variable name="meta-head" select="head"/>
3232
<xsl:variable name="meta-tail" select="tail"/>
33-
<xsl:if test="$meta-head='version' and not(matches($meta-tail, '^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(-[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*)?(\+[a-zA-Z0-9]+)?$'))">
33+
<xsl:if test="$meta-head='version' and not(matches($meta-tail, '^\d+\.\d+\.\d+(-[a-zA-Z0-9-]+)?$|^\d+\.\d+-SNAPSHOT$'))">
3434
<xsl:element name="defect">
3535
<xsl:attribute name="line">
3636
<xsl:value-of select="eo:lineno(@line)"/>
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
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-version.xsl
25+
asserts:
26+
- /defects[count(defect[@severity='warning'])=0]
27+
input: |
28+
+version 0.0.0
29+
+version 0.2.1
30+
+version 42.0.555555
31+
+version 0.0.1-alpha
32+
+version 0.0.1-beta-1
33+
34+
# No comments.
35+
[x] > foo
36+
x.div in.nextInt > @
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
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-version.xsl
25+
asserts:
26+
- /defects[count(defect[@severity='warning'])=0]
27+
input: |
28+
+version 1.0-SNAPSHOT
29+
30+
# No comments.
31+
[x] > foo
32+
41 > @
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
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-version.xsl
25+
asserts:
26+
- /defects[count(defect[@severity='warning'])=2]
27+
- /defects/defect[@line='1']
28+
- /defects/defect[@line='2']
29+
input: |
30+
+version x.z-SNAPSHOT
31+
+version 1.1-hello
32+
33+
# No comments.
34+
[x] > foo
35+
41 > @

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

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -24,24 +24,18 @@ sheets:
2424
- /org/eolang/lints/metas/incorrect-version.xsl
2525
asserts:
2626
- /defects[count(defect[@severity='warning'])=11]
27+
- /defects/defect[@line='1']
28+
- /defects/defect[@line='2']
29+
- /defects/defect[@line='3']
30+
- /defects/defect[@line='4']
31+
- /defects/defect[@line='5']
32+
- /defects/defect[@line='6']
2733
- /defects/defect[@line='7']
2834
- /defects/defect[@line='8']
2935
- /defects/defect[@line='9']
3036
- /defects/defect[@line='10']
3137
- /defects/defect[@line='11']
32-
- /defects/defect[@line='12']
33-
- /defects/defect[@line='13']
34-
- /defects/defect[@line='14']
35-
- /defects/defect[@line='15']
36-
- /defects/defect[@line='16']
37-
- /defects/defect[@line='17']
3838
input: |
39-
+version 0.0.0
40-
+version 0.2.1
41-
+version 42.0.555555
42-
+version 0.0.1-alpha
43-
+version 0.0.1-beta-1
44-
+alias org.eolang.io.stdout
4539
+version alpha
4640
+version 1.0.0-alpha.beta
4741
+version привет, друг!

0 commit comments

Comments
 (0)