From 21c41d09c0077d6e781f8d2384b046953f37f0dc Mon Sep 17 00:00:00 2001 From: h1alexbel Date: Thu, 28 Nov 2024 10:09:02 +0300 Subject: [PATCH 1/3] feat(#25): incorrect-package --- .../eolang/lints/metas/incorrect-package.xsl | 48 +++++++++++++++++++ .../lints/catches-incorrect-package.yaml | 42 ++++++++++++++++ 2 files changed, 90 insertions(+) create mode 100644 src/main/resources/org/eolang/lints/metas/incorrect-package.xsl create mode 100644 src/test/resources/org/eolang/lints/catches-incorrect-package.yaml 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/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..fef56b7 --- /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 From 49e8680459b8ea3ac63e0ece8feb2a38ccf40085 Mon Sep 17 00:00:00 2001 From: h1alexbel Date: Thu, 28 Nov 2024 10:12:16 +0300 Subject: [PATCH 2/3] feat(#25): motive --- .../eolang/motives/metas/incorrect-package.md | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 src/main/resources/org/eolang/motives/metas/incorrect-package.md 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 +``` From 43883faea31fde8f32dd2939214598816c058c67 Mon Sep 17 00:00:00 2001 From: h1alexbel Date: Thu, 28 Nov 2024 10:14:59 +0300 Subject: [PATCH 3/3] feat(#25): no trailing --- .../resources/org/eolang/lints/catches-incorrect-package.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/resources/org/eolang/lints/catches-incorrect-package.yaml b/src/test/resources/org/eolang/lints/catches-incorrect-package.yaml index fef56b7..8d31eb8 100644 --- a/src/test/resources/org/eolang/lints/catches-incorrect-package.yaml +++ b/src/test/resources/org/eolang/lints/catches-incorrect-package.yaml @@ -38,5 +38,5 @@ eo: | +package org.eolang +package my.awesome.package +package test.xy - + [] > foo