Debian Codegraph @

texmf-dist/doc/support/expltools/project-proposal-02-requirements.md

raw symbols SCIP
1 # Requirements
2
3 In this section, I outline the requirements for the linter. These will form the basis of the design and the implementation.
4
5 ## Functional requirements
6
7 The linter should accept a list of input expl3 files. Then, the linter should process each input file and print out issues it has identified with the file.
8
9 Initially, the linter should recognize at least the following types of issues:
10
11 - Style:
12 - Overly long lines
13 - Missing stylistic white-spaces
14 - Malformed names of functions, variables, constants, quarks, and scan marks
15 - Functions:
16 - Multiply defined functions and function variants
17 - Calling undefined functions and function variants
18 - Calling [deprecated and removed][2] functions
19 - Unknown argument specifiers
20 - Unexpected function call arguments
21 - Unused private functions and function variants
22 - Variables:
23 - Multiply declared variables and constants
24 - Using undefined variables and constants
25 - Using variables of incompatible types
26 - Using deprecated and removed variables and constants
27 - Setting constants and undeclared variables
28 - Unused variables and constants
29 - Locally setting global variables and vice versa
30
31 ## Non-functional requirements
32
33 ### Issues
34
35 The linter should make distinction between two types of issues: warnings and errors. As a rule of thumb, whereas warnings are suggestions about best practices, errors will likely result in runtime errors.
36
37 Here are three examples of warnings:
38
39 - Missing stylistic white-spaces around curly braces
40 - Using deprecated functions and variables
41 - Unused variable or constant
42
43 Here are three examples of errors:
44
45 - Using an undefined message
46 - Calling a function with a `V`-type argument with a variable or constant that does not support `V`-type expansion
47 - Multiply declared variable or constant
48
49 The overriding design goal for the initial releases of the linter should be the simplicity of implementation and robustness to unexpected input. For all issues, the linter should prefer [precision over recall][1] and only print them out when it is reasonably certain that it has understood the code, even at the expense of potentially missing some issues.
50
51 Each issue should be assigned a unique identifier. Using these identifiers, issues can be disabled globally using a config file, for individual input files from the command-line, and for sections of code or individual lines of code using `\TeX`{=tex} comments.
52
53 ### Architecture
54
55 To make the linter easy to use in continuous integration pipelines, it should be written in Lua 5.3 using just the standard Lua library. One possible exception is checking whether functions, variables, and other symbols from the input files are expl3 build-ins. This may require using the `texlua` interpreter and a minimal `\TeX`{=tex} distribution that includes the `\LaTeX`{=tex}3 kernel, at least initially.
56
57 The linter should process input files in a series of discrete steps, which should be represented as Lua modules. Users should be able to import the modules into their Lua code and use them independently on the rest of the linter.
58
59 Each step should process the input received from the previous step, identify any issues with the input, and transform the input to an output format appropriate for the next step. The default command-line script for the linter should execute all steps and print out issues from all steps. Users should be able to easily adapt the default script in the following ways:
60
61 1. Change how the linter discovers input files.
62 2. Change or replace processing steps or insert additional steps.
63 3. Change how the linter reacts to issues with the input files.
64
65 The linter should integrate easily with text editors. Therefore, the linter should either directly support the [language server protocol (LSP)][6] or be designed in a way that makes it easy to write an LSP wrapper for it.
66
67 ### Validation
68
69 As a part of the test-driven development paradigm, all issues identified by a processing step should have at least one associated test in the code repository of the linter. All tests should be executed periodically during the development of the linter.
70
71 As a part of the dogfooding paradigm, the linter should be used in the continuous integration pipeline of [the Markdown Package for `\TeX`{=tex}][3] since the initial releases of the linter in order to collect early user feedback. Other early adopters are also welcome to try the initial releases of the linter and report issues to its code repository.
72
73 At some point, a larger-scale validation should be conducted as an experimental part of a TUGboat article that will introduce the linter to the wider `\TeX`{=tex} community. In this validation, all expl3 packages from current and historical `\TeX`{=tex} Live distributions should be processed with the linter. The results should be evaluated both quantitatively and qualitatively. While the quantitative evaluation should focus mainly on trends in how expl3 is used in packages, the qualitative evaluation should explore the shortcomings of the linter and ideas for future improvements.
74
75 ### License terms
76
77 The linter should be [free software][8] and dual-licensed under [the GNU General Public License (GNU GPL) 2.0][12] or later and [the `\LaTeX`{=tex} Project Public License (LPPL) 1.3c][13] or later.
78
79 The option to use GNU GPL 2.0 or later is motivated by the fact that GNU GPL 2.0 and 3.0 are [mutually incompatible][14]. Supporting both GNU GPL 2.0 and 3.0 extends the number of free open-source projects that will be able to alter and redistribute the linter.
80
81 The option to use LPPL 1.3c is motivated by the fact that it imposes very few licensing restrictions on `\TeX`{=tex} users. Furthermore, it also preserves the integrity of `\TeX`{=tex} distributions by enforcing its naming and maintenance clauses, which ensure ongoing project stewardship and prevent confusion between modified and official versions.
82
83 Admittedly, GNU GPL and LPPL may seem like an unusual combination, since GNU GPL is a copyleft license whereas LPPL is a permissive license. However, there are strategic benefits to offering both.
84
85 We would offer LPPL as the primary license for derivative works within the `\TeX`{=tex} ecosystem. One downside of using LPPL is that it could potentially allow bad actors to create proprietary derivative works without contributing back to the original project. However, this trade-off helps maintain the `\TeX`{=tex} ecosystem's consistency and reliability. Incidentally, there is an element of trust in the `\TeX`{=tex} user community to voluntarily contribute improvements back, even though the license itself does not mandate it.
86
87 We would offer GNU GPL as an alternative license for derivative works outside the `\TeX`{=tex} ecosystem. The key benefit of including GNU GPL is that it enables the code to be integrated into free open-source projects, especially those with licenses that are incompatible with LPPL's naming requirements. This opens the door for broader collaboration with the free software community.
88
89 Notably, GNU GPL creates a one-way licensing situation: Once a derivative work is licensed under GNU GPL, it cannot be legally re-licensed under a less restrictive license like LPPL. As a result, we wouldn't be able to incorporate changes made to GNU GPL-licensed works back into the original project under LPPL without also creating two forks of the project licensed under GNU GPL 2.0 and GNU GPL 3.0, respectively. While this might seem like a downside, I view it as an important counterbalance to the potential for proprietary derivative works under LPPL.
90
91 In summary, this dual-licensing approach allows us to maintain the integrity of the `\TeX`{=tex} ecosystem while making the project more accessible to the broader free open-source community. It provides flexibility for different use cases, though we will need to carefully manage contributions to ensure compliance with all licenses.
92
93 [1]: https://developers.google.com/machine-learning/crash-course/classification/precision-and-recall
94 [2]: https://github.com/latex3/latex3/blob/main/l3kernel/doc/l3obsolete.txt
95 [3]: https://github.com/witiko/markdown
96 [4]: /Expl3-Linter-1
97 [5]: /Expl3-Linter-2.5
98 [6]: https://microsoft.github.io/language-server-protocol/
99 [7]: https://www.gnu.org/licenses/lgpl-3.0.en.html
100 [8]: https://www.gnu.org/philosophy/free-sw.html
101 [9]: https://www.gnu.org/licenses/gpl-3.0.html
102 [10]: https://www.gnu.org/licenses/license-list.html#GPLCompatibleLicenses
103 [11]: /Expl3-Linter-3
104 [12]: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
105 [13]: https://www.latex-project.org/lppl/lppl-1-3c/
106 [14]: https://www.gnu.org/licenses/rms-why-gplv3.en.html