Skip to content

Commit

Permalink
Merge pull request #3959 from h1alexbel/3934
Browse files Browse the repository at this point in the history
feat(#3934): `spdx` meta instead of `<license/>` node
  • Loading branch information
maxonfjvipon authored Feb 27, 2025
2 parents 1e48c05 + b85834a commit 8c2d901
Show file tree
Hide file tree
Showing 123 changed files with 237 additions and 420 deletions.
2 changes: 1 addition & 1 deletion REUSE.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ path = [
"Gemfile.lock",
"eo-maven-plugin/src/main/resources/org/eolang/maven/latex/latex-template.txt",
"eo-maven-plugin/src/test/resources/org/eolang/maven/commits/tags.txt",
"eo-runtime/src/main/resources/org/eolang/version.txt",
"eo-runtime/src/main/resources/org/eolang/version.txt"
]
precedence = "override"
SPDX-FileCopyrightText = "Copyright (c) 2016-2025 Objectionary.com"
Expand Down
2 changes: 1 addition & 1 deletion eo-maven-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<dependency>
<groupId>org.eolang</groupId>
<artifactId>lints</artifactId>
<version>0.0.38</version>
<version>0.0.39</version>
</dependency>
<dependency>
<groupId>org.glassfish</groupId>
Expand Down
8 changes: 7 additions & 1 deletion eo-maven-plugin/src/main/java/org/eolang/maven/LintMojo.java
Original file line number Diff line number Diff line change
Expand Up @@ -257,10 +257,16 @@ private static String summary(final ConcurrentHashMap<Severity, Integer> counts)
* @param xmir The XML before linting
* @param counts Counts of errors, warnings, and critical
* @return XML after linting
* @todo #3934:35min Remove .without() from Program to enable `unknown-metas`
* and `unsorted-metas` lints. Currently we disabled them since lints does not
* support `+spdx` meta yet. Once <a href="https://github.com/objectionary/lints/issues/354">this</a>
* issue will be resolved, we should enable all lints.
*/
private static XML linted(final XML xmir, final ConcurrentHashMap<Severity, Integer> counts) {
final Directives dirs = new Directives();
final Collection<Defect> defects = new Program(xmir).defects();
final Collection<Defect> defects = new Program(xmir).without(
"unknown-metas", "unsorted-metas"
).defects();
if (!defects.isEmpty()) {
dirs.xpath("/program").addIf("errors").strict(1);
LintMojo.embed(xmir, defects);
Expand Down
5 changes: 2 additions & 3 deletions eo-maven-plugin/src/test/resources/org/eolang/maven/mess.eo
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# SPDX-FileCopyrightText: Copyright (c) 2016-2025 Objectionary.com
# SPDX-License-Identifier: MIT

+spdx SPDX-FileCopyrightText Copyright (c) 2016-2025 Objectionary.com
+spdx SPDX-License-Identifier: MIT
+alias org.eolang.io.stdout
+architect [email protected]
+home https://github.com/objectionary/eo
Expand Down
7 changes: 1 addition & 6 deletions eo-parser/src/main/antlr4/org/eolang/parser/Eo.g4
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,13 @@ tokens { TAB, UNTAB }

// Entry point
program
: license? metas? objects EOF
: metas? objects EOF
;

// Double EOL
eop : EOL EOL
;

// Licence
license
: (COMMENTARY EOL)* COMMENTARY eop
;

// Metas
metas
: (META EOL)* META eop
Expand Down
20 changes: 0 additions & 20 deletions eo-parser/src/main/java/org/eolang/parser/XeEoListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
import org.antlr.v4.runtime.tree.ErrorNode;
import org.antlr.v4.runtime.tree.TerminalNode;
import org.apache.commons.text.StringEscapeUtils;
import org.cactoos.iterable.Mapped;
import org.cactoos.text.Joined;
import org.xembly.Directive;
import org.xembly.Directives;

Expand Down Expand Up @@ -104,24 +102,6 @@ public void exitEop(final EoParser.EopContext ctx) {
// Nothing here
}

@Override
public void enterLicense(final EoParser.LicenseContext ctx) {
this.dirs.addIf("license").set(
new Joined(
"\n",
new Mapped<>(
cmt -> cmt.getText().substring(1).trim(),
ctx.COMMENTARY()
)
)
).up();
}

@Override
public void exitLicense(final EoParser.LicenseContext ctx) {
// Nothing here
}

@Override
public void enterMetas(final EoParser.MetasContext ctx) {
this.dirs.addIf("metas");
Expand Down
18 changes: 1 addition & 17 deletions eo-parser/src/main/resources/XMIR.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<xs:documentation>
Every XMIR document is essentially an XML document that
contains objects found in a EOLANG program together with
supplementary information, such as metas, license, and so on.
supplementary information, such as metas, and so on.
The schema is used to validate the XMIR documents, which are
generated by the EO parser. The schema defines the structure
of the XMIR document, including the elements and attributes
Expand Down Expand Up @@ -252,21 +252,6 @@
<xs:extension base="non-empty"/>
</xs:simpleContent>
</xs:complexType>
<xs:complexType name="license">
<xs:annotation>
<xs:appinfo>The entire license found in the source code</xs:appinfo>
<xs:documentation>
The element contains the entire text of the license found in the source code. This information is crucial for
understanding the legal terms under which the code can be used, modified, and distributed. By including the full
license text, developers and users can easily reference the licensing terms without needing to look up the
original source. This practice helps ensure compliance with the license and provides transparency regarding the
legal framework governing the code.
</xs:documentation>
</xs:annotation>
<xs:simpleContent>
<xs:extension base="non-empty"/>
</xs:simpleContent>
</xs:complexType>
<xs:simpleType name="sheet">
<xs:annotation>
<xs:appinfo>The XSL stylesheet that was applied to the XMIR</xs:appinfo>
Expand Down Expand Up @@ -375,7 +360,6 @@
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="license" type="license" minOccurs="0"/>
<xs:element name="metas" minOccurs="0">
<xs:complexType>
<xs:sequence>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
sheets: [ ]
asserts:
- /program[not(errors)]
- /program/license[text()!='']
- /program/metas[count(meta)=4]
- /program/metas/meta[head='foo' and tail='']
- //o[@base='Q.org.eolang.true']
Expand All @@ -18,10 +17,6 @@ asserts:
- //o[@atom and @name='atom' and count(o)=2 and o[@name='a']]
- //o[@atom='org.eolang.number']
input: |
# The purpose of this test case is to make
# sure all possible syntax scenarios can
# be parsed by the ANTLR
+alias org.example.foo
+alias Test Test
+bar Some text
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,6 @@ asserts:
- /program/objects[count(o)=1]
- //o[@base='.and']
input: |
# This program is from the EOLANG original paper
# and must produce a working command line tool
#
# License is MIT
+alias org.eolang.io.stdin
+alias org.eolang.io.stdout
+alias org.eolang.txt.scanner
Expand Down
5 changes: 3 additions & 2 deletions eo-parser/src/test/resources/org/eolang/parser/factorial.eo
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# SPDX-FileCopyrightText: Copyright (c) 2016-2025 Objectionary.com
# SPDX-License-Identifier: MIT
+spdx SPDX-FileCopyrightText Copyright (c) 2016-2025 Objectionary.com
+spdx SPDX-License-Identifier: MIT

# F.
[n] > f
if. > @
n.lt 1
Expand Down
5 changes: 2 additions & 3 deletions eo-parser/src/test/resources/org/eolang/parser/fibonacci.eo
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# SPDX-FileCopyrightText: Copyright (c) 2016-2025 Objectionary.com
# SPDX-License-Identifier: MIT

+spdx SPDX-FileCopyrightText Copyright (c) 2016-2025 Objectionary.com
+spdx SPDX-License-Identifier: MIT
+meta This is just a test META
+meta2 And yet another one

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,6 @@
# SPDX-License-Identifier: MIT
---
input: |
# The MIT License (MIT)
#
# Copyright (c) 2016-2025 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.
+architect [email protected]
+home https://github.com/objectionary/eo
+tests
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@
# SPDX-License-Identifier: MIT
---
origin: |
# This is the license part
# of the program
+meta1
+meta2 short
+meta2 long tail
Expand Down Expand Up @@ -33,9 +30,6 @@ origin: |
"hello, 大家!"
printed: |
# This is the license part
# of the program
+meta1
+meta2 short
+meta2 long tail
Expand Down
5 changes: 2 additions & 3 deletions eo-runtime/src/main/eo/org/eolang/bytes.eo
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# SPDX-FileCopyrightText: Copyright (c) 2016-2025 Objectionary.com
# SPDX-License-Identifier: MIT

+spdx SPDX-FileCopyrightText Copyright (c) 2016-2025 Objectionary.com
+spdx SPDX-License-Identifier: MIT
+alias org.eolang.txt.sprintf
+architect [email protected]
+home https://github.com/objectionary/eo
Expand Down
5 changes: 2 additions & 3 deletions eo-runtime/src/main/eo/org/eolang/cti.eo
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# SPDX-FileCopyrightText: Copyright (c) 2016-2025 Objectionary.com
# SPDX-License-Identifier: MIT

+spdx SPDX-FileCopyrightText Copyright (c) 2016-2025 Objectionary.com
+spdx SPDX-License-Identifier: MIT
+architect [email protected]
+home https://github.com/objectionary/eo
+package org.eolang
Expand Down
5 changes: 2 additions & 3 deletions eo-runtime/src/main/eo/org/eolang/dataized.eo
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# SPDX-FileCopyrightText: Copyright (c) 2016-2025 Objectionary.com
# SPDX-License-Identifier: MIT

+spdx SPDX-FileCopyrightText Copyright (c) 2016-2025 Objectionary.com
+spdx SPDX-License-Identifier: MIT
+architect [email protected]
+home https://github.com/objectionary/eo
+package org.eolang
Expand Down
5 changes: 2 additions & 3 deletions eo-runtime/src/main/eo/org/eolang/error.eo
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# SPDX-FileCopyrightText: Copyright (c) 2016-2025 Objectionary.com
# SPDX-License-Identifier: MIT

+spdx SPDX-FileCopyrightText Copyright (c) 2016-2025 Objectionary.com
+spdx SPDX-License-Identifier: MIT
+architect [email protected]
+home https://github.com/objectionary/eo
+package org.eolang
Expand Down
5 changes: 2 additions & 3 deletions eo-runtime/src/main/eo/org/eolang/false.eo
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# SPDX-FileCopyrightText: Copyright (c) 2016-2025 Objectionary.com
# SPDX-License-Identifier: MIT

+spdx SPDX-FileCopyrightText Copyright (c) 2016-2025 Objectionary.com
+spdx SPDX-License-Identifier: MIT
+architect [email protected]
+home https://github.com/objectionary/eo
+package org.eolang
Expand Down
5 changes: 2 additions & 3 deletions eo-runtime/src/main/eo/org/eolang/fs/dir.eo
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# SPDX-FileCopyrightText: Copyright (c) 2016-2025 Objectionary.com
# SPDX-License-Identifier: MIT

+spdx SPDX-FileCopyrightText Copyright (c) 2016-2025 Objectionary.com
+spdx SPDX-License-Identifier: MIT
+alias org.eolang.txt.sprintf
+architect [email protected]
+home https://github.com/objectionary/eo
Expand Down
5 changes: 2 additions & 3 deletions eo-runtime/src/main/eo/org/eolang/fs/file.eo
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# SPDX-FileCopyrightText: Copyright (c) 2016-2025 Objectionary.com
# SPDX-License-Identifier: MIT

+spdx SPDX-FileCopyrightText Copyright (c) 2016-2025 Objectionary.com
+spdx SPDX-License-Identifier: MIT
+alias org.eolang.txt.sprintf
+architect [email protected]
+home https://github.com/objectionary/eo
Expand Down
5 changes: 2 additions & 3 deletions eo-runtime/src/main/eo/org/eolang/fs/path.eo
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# SPDX-FileCopyrightText: Copyright (c) 2016-2025 Objectionary.com
# SPDX-License-Identifier: MIT

+spdx SPDX-FileCopyrightText Copyright (c) 2016-2025 Objectionary.com
+spdx SPDX-License-Identifier: MIT
+alias org.eolang.fs.dir
+alias org.eolang.fs.file
+alias org.eolang.sys.os
Expand Down
5 changes: 2 additions & 3 deletions eo-runtime/src/main/eo/org/eolang/fs/tmpdir.eo
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# SPDX-FileCopyrightText: Copyright (c) 2016-2025 Objectionary.com
# SPDX-License-Identifier: MIT

+spdx SPDX-FileCopyrightText Copyright (c) 2016-2025 Objectionary.com
+spdx SPDX-License-Identifier: MIT
+alias org.eolang.fs.dir
+alias org.eolang.fs.file
+alias org.eolang.sys.getenv
Expand Down
5 changes: 2 additions & 3 deletions eo-runtime/src/main/eo/org/eolang/go.eo
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# SPDX-FileCopyrightText: Copyright (c) 2016-2025 Objectionary.com
# SPDX-License-Identifier: MIT

+spdx SPDX-FileCopyrightText Copyright (c) 2016-2025 Objectionary.com
+spdx SPDX-License-Identifier: MIT
+architect [email protected]
+home https://github.com/objectionary/eo
+package org.eolang
Expand Down
5 changes: 2 additions & 3 deletions eo-runtime/src/main/eo/org/eolang/i16.eo
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# SPDX-FileCopyrightText: Copyright (c) 2016-2025 Objectionary.com
# SPDX-License-Identifier: MIT

+spdx SPDX-FileCopyrightText Copyright (c) 2016-2025 Objectionary.com
+spdx SPDX-License-Identifier: MIT
+alias org.eolang.txt.sprintf
+architect [email protected]
+home https://github.com/objectionary/eo
Expand Down
5 changes: 2 additions & 3 deletions eo-runtime/src/main/eo/org/eolang/i32.eo
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# SPDX-FileCopyrightText: Copyright (c) 2016-2025 Objectionary.com
# SPDX-License-Identifier: MIT

+spdx SPDX-FileCopyrightText Copyright (c) 2016-2025 Objectionary.com
+spdx SPDX-License-Identifier: MIT
+alias org.eolang.txt.sprintf
+architect [email protected]
+home https://github.com/objectionary/eo
Expand Down
5 changes: 2 additions & 3 deletions eo-runtime/src/main/eo/org/eolang/i64.eo
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# SPDX-FileCopyrightText: Copyright (c) 2016-2025 Objectionary.com
# SPDX-License-Identifier: MIT

+spdx SPDX-FileCopyrightText Copyright (c) 2016-2025 Objectionary.com
+spdx SPDX-License-Identifier: MIT
+alias org.eolang.txt.sprintf
+architect [email protected]
+home https://github.com/objectionary/eo
Expand Down
5 changes: 2 additions & 3 deletions eo-runtime/src/main/eo/org/eolang/io/bytes-as-input.eo
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# SPDX-FileCopyrightText: Copyright (c) 2016-2025 Objectionary.com
# SPDX-License-Identifier: MIT

+spdx SPDX-FileCopyrightText Copyright (c) 2016-2025 Objectionary.com
+spdx SPDX-License-Identifier: MIT
+architect [email protected]
+home https://github.com/objectionary/eo
+package org.eolang.io
Expand Down
5 changes: 2 additions & 3 deletions eo-runtime/src/main/eo/org/eolang/io/console.eo
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# SPDX-FileCopyrightText: Copyright (c) 2016-2025 Objectionary.com
# SPDX-License-Identifier: MIT

+spdx SPDX-FileCopyrightText Copyright (c) 2016-2025 Objectionary.com
+spdx SPDX-License-Identifier: MIT
+alias org.eolang.sys.os
+alias org.eolang.sys.posix
+alias org.eolang.sys.win32
Expand Down
5 changes: 2 additions & 3 deletions eo-runtime/src/main/eo/org/eolang/io/dead-input.eo
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# SPDX-FileCopyrightText: Copyright (c) 2016-2025 Objectionary.com
# SPDX-License-Identifier: MIT

+spdx SPDX-FileCopyrightText Copyright (c) 2016-2025 Objectionary.com
+spdx SPDX-License-Identifier: MIT
+architect [email protected]
+home https://github.com/objectionary/eo
+package org.eolang.io
Expand Down
5 changes: 2 additions & 3 deletions eo-runtime/src/main/eo/org/eolang/io/dead-output.eo
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# SPDX-FileCopyrightText: Copyright (c) 2016-2025 Objectionary.com
# SPDX-License-Identifier: MIT

+spdx SPDX-FileCopyrightText Copyright (c) 2016-2025 Objectionary.com
+spdx SPDX-License-Identifier: MIT
+architect [email protected]
+home https://github.com/objectionary/eo
+package org.eolang.io
Expand Down
5 changes: 2 additions & 3 deletions eo-runtime/src/main/eo/org/eolang/io/input-length.eo
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# SPDX-FileCopyrightText: Copyright (c) 2016-2025 Objectionary.com
# SPDX-License-Identifier: MIT

+spdx SPDX-FileCopyrightText Copyright (c) 2016-2025 Objectionary.com
+spdx SPDX-License-Identifier: MIT
+architect [email protected]
+home https://github.com/objectionary/eo
+package org.eolang.io
Expand Down
Loading

1 comment on commit 8c2d901

@0pdd
Copy link

@0pdd 0pdd commented on 8c2d901 Feb 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Puzzle 3934-624dfb80 discovered in eo-maven-plugin/src/main/java/org/eolang/maven/LintMojo.java) and submitted as #3965. Please, remember that the puzzle was not necessarily added in this particular commit. Maybe it was added earlier, but we discovered it only now.

Please sign in to comment.