diff --git a/src/main/resources/org/eolang/lints/metas/incorrect-package.xsl b/src/main/resources/org/eolang/lints/metas/incorrect-package.xsl new file mode 100644 index 0000000..36baf47 --- /dev/null +++ b/src/main/resources/org/eolang/lints/metas/incorrect-package.xsl @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + warning + + Wrong format of package name " + + " + + + + + + diff --git a/src/main/resources/org/eolang/motives/metas/incorrect-package.md b/src/main/resources/org/eolang/motives/metas/incorrect-package.md new file mode 100644 index 0000000..5a6e65b --- /dev/null +++ b/src/main/resources/org/eolang/motives/metas/incorrect-package.md @@ -0,0 +1,28 @@ +# Incorrect `+package` + +Special meta `+package` should follow regexp: + +```regexp +^[a-z][a-z0-9_]*(\.[a-z0-9_]+)+[0-9a-z_]$ +``` + +Incorrect: + +```eo ++package foo ++package foo.x ++package привет, как дела? ++package привет.как + +[] > foo +``` + +Correct: + +```eo ++package foo.bar ++package my.awesome.package ++package test.xy + +[] > foo +``` diff --git a/src/test/resources/org/eolang/lints/catches-incorrect-package.yaml b/src/test/resources/org/eolang/lints/catches-incorrect-package.yaml new file mode 100644 index 0000000..8d31eb8 --- /dev/null +++ b/src/test/resources/org/eolang/lints/catches-incorrect-package.yaml @@ -0,0 +1,42 @@ +# 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. +--- +xsls: + - /org/eolang/lints/metas/incorrect-package.xsl +tests: + - /defects[count(defect[@severity='warning'])=5] + - /defects/defect[@line='1'] + - /defects/defect[@line='2'] + - /defects/defect[@line='3'] + - /defects/defect[@line='4'] + - /defects/defect[@line='5'] +eo: | + +package test + +package test. + +package test.x + +package привет, как дела? + +package привет.foo + +package org.eolang + +package my.awesome.package + +package test.xy + + [] > foo