Skip to content

Commit

Permalink
Merge pull request objectionary#211 from h1alexbel/208
Browse files Browse the repository at this point in the history
bug(objectionary#208): incorrect-package accepts `fqn`
  • Loading branch information
yegor256 authored Jan 10, 2025
2 parents ad035ee + c5f1c39 commit dd3969f
Show file tree
Hide file tree
Showing 4 changed files with 75 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ SOFTWARE.
<xsl:variable name="meta-head" select="head"/>
<xsl:variable name="meta-tail" select="tail"/>
<xsl:variable name="first" select="normalize-space(substring-before(concat($meta-tail, ' '), ' '))"/>
<xsl:if test="$meta-head='package' and not(matches($first, '^[a-z][a-z0-9_]*(\.[a-z][a-z0-9_]+)*$'))">
<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}_]+)*$'))">
<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,39 @@
# 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.
---
sheets:
- /org/eolang/lints/metas/incorrect-package.xsl
asserts:
- /defects[count(defect[@severity='warning'])=0]
input: |
+package hello.world
+package hello.world123
+package foo.бар
+package test_xyz
+package j$org.j$eolang.j$jeo
+package com.foo$bar
+package universe@obj
+package c.d-test.x-yz
+package a.b-привет.c-大家好
# Test.
[] > foo
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# 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.
---
sheets:
- /org/eolang/lints/metas/incorrect-package.xsl
asserts:
- /defects[count(defect[@severity='warning'])=0]
input: |
+package Foo
+package Hello.WorLd
+package baR.XYZ
# Test.
[] > foo
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@
sheets:
- /org/eolang/lints/metas/incorrect-package.xsl
asserts:
- /defects[count(defect[@severity='warning'])=3]
- /defects[count(defect[@severity='warning'])=2]
input: |
+package test.
+package привет, как дела?
+package привет.foo
# Foo.
[] > foo

0 comments on commit dd3969f

Please sign in to comment.