license_conflicts 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 2776bec7584cdcbd102bd11f4f5647c9434c977c8b2fe0a6613b225215e70478
4
+ data.tar.gz: d020285d688068be7540e0764cdb5c1100cf0abb6a57bc8d87b92ce33dcbe0b0
5
+ SHA512:
6
+ metadata.gz: '08eb866d06c91dd917c9e2f9eb5ee56709b95d1ba86e2785be843c962d6d534ed9dfeb9824b24b123a5c34592e7aef95c43e72ee93d16f85a2d94decfbc9eef3'
7
+ data.tar.gz: b4f166f1c5adeef516a2d0c2feb13ef59ffb66e1bf7bfc252669bd80ddec9a7072551eb2d00acda044603370e32df5f0b5eccc2c4613dea2faaecc8e350c7d19
@@ -0,0 +1,3 @@
1
+ {
2
+ ".": "0.3.0"
3
+ }
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,13 @@
1
+ AllCops:
2
+ TargetRubyVersion: 2.6
3
+
4
+ Style/StringLiterals:
5
+ Enabled: true
6
+ EnforcedStyle: double_quotes
7
+
8
+ Style/StringLiteralsInInterpolation:
9
+ Enabled: true
10
+ EnforcedStyle: double_quotes
11
+
12
+ Layout/LineLength:
13
+ Max: 120
data/.tool-versions ADDED
@@ -0,0 +1 @@
1
+ ruby 3.4.9
data/CHANGELOG.md ADDED
@@ -0,0 +1,96 @@
1
+ # Changelog
2
+
3
+ ## [0.3.0](https://github.com/dennisurtubia/license_conflicts/compare/license_conflicts/v0.2.0...license_conflicts/v0.3.0) (2026-03-21)
4
+
5
+
6
+ ### Features
7
+
8
+ * clean up attribute reader and improve conflict checking logic ([0c861bd](https://github.com/dennisurtubia/license_conflicts/commit/0c861bd75b2b3d8efe1d97628e64ad7590ee77ed))
9
+
10
+ ## [0.2.0](https://github.com/dennisurtubia/license_conflicts/compare/license_conflicts-v0.1.0...license_conflicts/v0.2.0) (2026-03-21)
11
+
12
+
13
+ ### Features
14
+
15
+ * add CLI functionality for license conflict checking and reporting ([8a138c0](https://github.com/dennisurtubia/license_conflicts/commit/8a138c0e3b093618c1378ff27ec6a67a6c5393f7))
16
+ * add GitHub Actions workflows for gem publishing and release management ([7738c72](https://github.com/dennisurtubia/license_conflicts/commit/7738c72798f70a0c2aac4c918a82933e89485e59))
17
+ * add multi-language project metadata detection ([2533cfa](https://github.com/dennisurtubia/license_conflicts/commit/2533cfac6a401a9233c1afe8b1e085effecddefc))
18
+ * adds logic to check licenses conflicts ([3c4dfda](https://github.com/dennisurtubia/license_conflicts/commit/3c4dfda96f50182ee4a448cf6cbf6ed3b7a1befd))
19
+ * adds report based on LicenseFinder reports ([f6559bb](https://github.com/dennisurtubia/license_conflicts/commit/f6559bbc481d5f84f4918092b73e1aa1a6bb8ad0))
20
+ * **bin:** adds executable file to license_conflicts execution ([ca3e352](https://github.com/dennisurtubia/license_conflicts/commit/ca3e352fcf1d8fcce405d921706950f9527b1fa7))
21
+ * **bin:** adds report option ([926f422](https://github.com/dennisurtubia/license_conflicts/commit/926f422a9e859a28a6067f761512f3662c21dcb6))
22
+ * define licenses conflicts map ([c26a69d](https://github.com/dennisurtubia/license_conflicts/commit/c26a69de246d55bdba2afb7834c2a8dcb8ebff45))
23
+ * enhance error messages and improve gemspec metadata ([f89d04a](https://github.com/dennisurtubia/license_conflicts/commit/f89d04a19f601bbedee9e186f526547495abaee0))
24
+ * implement LicenseNormalizer for canonical license name mapping ([156e26c](https://github.com/dennisurtubia/license_conflicts/commit/156e26c71a6b92f7a11d30bc99d4197176f0fee2))
25
+ * restructure release workflow ([20baa4d](https://github.com/dennisurtubia/license_conflicts/commit/20baa4d793f42d158284eb49f66d1e2f9ef20691))
26
+ * update gemfile ([28889f7](https://github.com/dennisurtubia/license_conflicts/commit/28889f7de58255088ee30886b66ab02f72db9e4a))
27
+ * update GitHub Actions workflow to publish gem on release events ([a48bce6](https://github.com/dennisurtubia/license_conflicts/commit/a48bce6301b3b23a91971fd0aa307d5da5408412))
28
+ * update README files with detailed usage instructions and add Portuguese version ([c76230f](https://github.com/dennisurtubia/license_conflicts/commit/c76230fada5c701ba06fe2d19a5d393568d8df82))
29
+
30
+
31
+ ### Bug Fixes
32
+
33
+ * release please package manager file ([abe6917](https://github.com/dennisurtubia/license_conflicts/commit/abe69170ae5ad84c77a25ad920a6e91615cd2a85))
34
+ * removes dev dependency ([898047c](https://github.com/dennisurtubia/license_conflicts/commit/898047c39aa636150238bd0365a8b3f38bc40d85))
35
+ * trigger release-please ([49a0dba](https://github.com/dennisurtubia/license_conflicts/commit/49a0dba07b57562f8b43dad9a21425e9bd999b67))
36
+ * update release action token and configuration files ([a2c36dd](https://github.com/dennisurtubia/license_conflicts/commit/a2c36dd4f828889ee01e26a13c7aa2478ba917cc))
37
+
38
+ ## [0.2.0](https://github.com/dennisurtubia/license_conflicts/compare/license_conflicts-v0.1.0...license_conflicts/v0.2.0) (2026-03-21)
39
+
40
+
41
+ ### Features
42
+
43
+ * add CLI functionality for license conflict checking and reporting ([8a138c0](https://github.com/dennisurtubia/license_conflicts/commit/8a138c0e3b093618c1378ff27ec6a67a6c5393f7))
44
+ * add GitHub Actions workflows for gem publishing and release management ([7738c72](https://github.com/dennisurtubia/license_conflicts/commit/7738c72798f70a0c2aac4c918a82933e89485e59))
45
+ * add multi-language project metadata detection ([2533cfa](https://github.com/dennisurtubia/license_conflicts/commit/2533cfac6a401a9233c1afe8b1e085effecddefc))
46
+ * adds logic to check licenses conflicts ([3c4dfda](https://github.com/dennisurtubia/license_conflicts/commit/3c4dfda96f50182ee4a448cf6cbf6ed3b7a1befd))
47
+ * adds report based on LicenseFinder reports ([f6559bb](https://github.com/dennisurtubia/license_conflicts/commit/f6559bbc481d5f84f4918092b73e1aa1a6bb8ad0))
48
+ * **bin:** adds executable file to license_conflicts execution ([ca3e352](https://github.com/dennisurtubia/license_conflicts/commit/ca3e352fcf1d8fcce405d921706950f9527b1fa7))
49
+ * **bin:** adds report option ([926f422](https://github.com/dennisurtubia/license_conflicts/commit/926f422a9e859a28a6067f761512f3662c21dcb6))
50
+ * define licenses conflicts map ([c26a69d](https://github.com/dennisurtubia/license_conflicts/commit/c26a69de246d55bdba2afb7834c2a8dcb8ebff45))
51
+ * enhance error messages and improve gemspec metadata ([f89d04a](https://github.com/dennisurtubia/license_conflicts/commit/f89d04a19f601bbedee9e186f526547495abaee0))
52
+ * implement LicenseNormalizer for canonical license name mapping ([156e26c](https://github.com/dennisurtubia/license_conflicts/commit/156e26c71a6b92f7a11d30bc99d4197176f0fee2))
53
+ * restructure release workflow ([20baa4d](https://github.com/dennisurtubia/license_conflicts/commit/20baa4d793f42d158284eb49f66d1e2f9ef20691))
54
+ * update gemfile ([28889f7](https://github.com/dennisurtubia/license_conflicts/commit/28889f7de58255088ee30886b66ab02f72db9e4a))
55
+ * update GitHub Actions workflow to publish gem on release events ([a48bce6](https://github.com/dennisurtubia/license_conflicts/commit/a48bce6301b3b23a91971fd0aa307d5da5408412))
56
+ * update README files with detailed usage instructions and add Portuguese version ([c76230f](https://github.com/dennisurtubia/license_conflicts/commit/c76230fada5c701ba06fe2d19a5d393568d8df82))
57
+
58
+
59
+ ### Bug Fixes
60
+
61
+ * removes dev dependency ([898047c](https://github.com/dennisurtubia/license_conflicts/commit/898047c39aa636150238bd0365a8b3f38bc40d85))
62
+ * trigger release-please ([49a0dba](https://github.com/dennisurtubia/license_conflicts/commit/49a0dba07b57562f8b43dad9a21425e9bd999b67))
63
+ * update release action token and configuration files ([a2c36dd](https://github.com/dennisurtubia/license_conflicts/commit/a2c36dd4f828889ee01e26a13c7aa2478ba917cc))
64
+
65
+ ## [0.2.1](https://github.com/dennisurtubia/license_conflicts/compare/license_conflicts/v0.2.0...license_conflicts/v0.2.1) (2026-03-20)
66
+
67
+
68
+ ### Bug Fixes
69
+
70
+ * removes dev dependency ([898047c](https://github.com/dennisurtubia/license_conflicts/commit/898047c39aa636150238bd0365a8b3f38bc40d85))
71
+
72
+ ## [0.2.0](https://github.com/dennisurtubia/license_conflicts/compare/license_conflicts-v0.1.0...license_conflicts/v0.2.0) (2026-03-20)
73
+
74
+
75
+ ### Features
76
+
77
+ * add CLI functionality for license conflict checking and reporting ([8a138c0](https://github.com/dennisurtubia/license_conflicts/commit/8a138c0e3b093618c1378ff27ec6a67a6c5393f7))
78
+ * add GitHub Actions workflows for gem publishing and release management ([7738c72](https://github.com/dennisurtubia/license_conflicts/commit/7738c72798f70a0c2aac4c918a82933e89485e59))
79
+ * add multi-language project metadata detection ([2533cfa](https://github.com/dennisurtubia/license_conflicts/commit/2533cfac6a401a9233c1afe8b1e085effecddefc))
80
+ * adds logic to check licenses conflicts ([3c4dfda](https://github.com/dennisurtubia/license_conflicts/commit/3c4dfda96f50182ee4a448cf6cbf6ed3b7a1befd))
81
+ * adds report based on LicenseFinder reports ([f6559bb](https://github.com/dennisurtubia/license_conflicts/commit/f6559bbc481d5f84f4918092b73e1aa1a6bb8ad0))
82
+ * **bin:** adds executable file to license_conflicts execution ([ca3e352](https://github.com/dennisurtubia/license_conflicts/commit/ca3e352fcf1d8fcce405d921706950f9527b1fa7))
83
+ * **bin:** adds report option ([926f422](https://github.com/dennisurtubia/license_conflicts/commit/926f422a9e859a28a6067f761512f3662c21dcb6))
84
+ * define licenses conflicts map ([c26a69d](https://github.com/dennisurtubia/license_conflicts/commit/c26a69de246d55bdba2afb7834c2a8dcb8ebff45))
85
+ * enhance error messages and improve gemspec metadata ([f89d04a](https://github.com/dennisurtubia/license_conflicts/commit/f89d04a19f601bbedee9e186f526547495abaee0))
86
+ * implement LicenseNormalizer for canonical license name mapping ([156e26c](https://github.com/dennisurtubia/license_conflicts/commit/156e26c71a6b92f7a11d30bc99d4197176f0fee2))
87
+ * update gemfile ([28889f7](https://github.com/dennisurtubia/license_conflicts/commit/28889f7de58255088ee30886b66ab02f72db9e4a))
88
+ * update GitHub Actions workflow to publish gem on release events ([a48bce6](https://github.com/dennisurtubia/license_conflicts/commit/a48bce6301b3b23a91971fd0aa307d5da5408412))
89
+ * update README files with detailed usage instructions and add Portuguese version ([c76230f](https://github.com/dennisurtubia/license_conflicts/commit/c76230fada5c701ba06fe2d19a5d393568d8df82))
90
+
91
+
92
+ ### Bug Fixes
93
+
94
+ * trigger release-please ([49a0dba](https://github.com/dennisurtubia/license_conflicts/commit/49a0dba07b57562f8b43dad9a21425e9bd999b67))
95
+
96
+ ## Changelog
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ # Specify your gem's dependencies in license_conflicts.gemspec
6
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2022 Dennis Felipe Urtubia
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,186 @@
1
+ # license_conflicts
2
+
3
+ **license_conflicts** detects software license incompatibilities between a project and its dependencies. It identifies the project's license, scans all dependency licenses using [LicenseFinder](https://github.com/pivotal/LicenseFinder), and reports any conflicts — making it easy to integrate license compliance checks into your CI/CD pipeline.
4
+
5
+ ---
6
+
7
+ ## Table of Contents
8
+
9
+ - [How It Works](#how-it-works)
10
+ - [Supported Languages](#supported-languages)
11
+ - [Requirements](#requirements)
12
+ - [Installation](#installation)
13
+ - [Usage](#usage)
14
+ - [Output](#output)
15
+ - [Report Formats](#report-formats)
16
+ - [Supported Licenses](#supported-licenses)
17
+ - [Exit Codes](#exit-codes)
18
+ - [Contributing](#contributing)
19
+ - [License](#license)
20
+
21
+ ---
22
+
23
+ ## How It Works
24
+
25
+ 1. **Detects the project license** from its metadata file (`package.json`, `gemspec`, `pom.xml`, etc.)
26
+ 2. **Scans all dependencies** using LicenseFinder
27
+ 3. **Normalizes license names** — SPDX identifiers, common aliases, and variant spellings are all mapped to canonical names
28
+ 4. **Checks for conflicts** using a built-in compatibility matrix
29
+ 5. **Reports results** to stdout and exits with an appropriate code
30
+
31
+ ---
32
+
33
+ ## Supported Languages
34
+
35
+ | Language | Package Manager | Metadata File |
36
+ |------------|-----------------|-------------------------------|
37
+ | JavaScript | npm | `package.json` |
38
+ | JavaScript | Bower | `bower.json` |
39
+ | Ruby | Bundler | `*.gemspec` |
40
+ | Python | pip / Poetry | `setup.cfg`, `pyproject.toml` |
41
+ | Go | Go modules | `go.mod` |
42
+ | Go | Godep | `Godeps/Godeps.json` |
43
+ | Java | Maven | `pom.xml` |
44
+
45
+ ---
46
+
47
+ ## Requirements
48
+
49
+ - Ruby >= 2.6.0
50
+ - The package manager for your project type must be installed (e.g. `npm`, `bundler`, `mvn`)
51
+
52
+ ---
53
+
54
+ ## Installation
55
+
56
+ ```bash
57
+ gem install license_conflicts
58
+ ```
59
+
60
+ ---
61
+
62
+ ## Usage
63
+
64
+ Run inside the root directory of the project you want to analyze:
65
+
66
+ ```bash
67
+ license_conflicts
68
+ ```
69
+
70
+ To generate a detailed dependency report alongside the conflict check:
71
+
72
+ ```bash
73
+ license_conflicts check --format markdown
74
+ ```
75
+
76
+ To display the installed version:
77
+
78
+ ```bash
79
+ license_conflicts version
80
+ ```
81
+
82
+ ### Options
83
+
84
+ | Flag | Alias | Description |
85
+ |-------------------|--------------|--------------------------------------------------------------------------|
86
+ | `--format FORMAT` | `-f FORMAT` | Report format: `text`, `html`, `markdown`, `csv`, `xml`, `json`, `junit` |
87
+
88
+ ---
89
+
90
+ ## Output
91
+
92
+ Results are printed to **stdout** as a single comma-separated line:
93
+
94
+ ```
95
+ {dependency_count}, {project_license}, {conflicting_licenses}, {report}
96
+ ```
97
+
98
+ | Field | Description |
99
+ |-----------------------|----------------------------------------------------------------------------------|
100
+ | `dependency_count` | Number of scanned dependencies |
101
+ | `project_license` | Detected license of the analyzed project |
102
+ | `conflicting_licenses`| Semicolon-separated list of incompatible licenses found (empty if none) |
103
+ | `report` | Full dependency report (only present when `--format` is specified) |
104
+
105
+ ### Examples
106
+
107
+ No conflicts found:
108
+
109
+ ```
110
+ 42, MIT, ,
111
+ ```
112
+
113
+ Conflicts detected:
114
+
115
+ ```
116
+ 42, MIT, GPLv2;AGPL 3,
117
+ ```
118
+
119
+ With a Markdown report:
120
+
121
+ ```
122
+ 42, MIT, GPLv2, ## Dependencies ...
123
+ ```
124
+
125
+ Diagnostic messages and errors are written to **stderr** and do not affect the stdout output format.
126
+
127
+ ---
128
+
129
+ ## Report Formats
130
+
131
+ When `--format` is provided, a full dependency report is appended to the output. Available formats:
132
+
133
+ | Format | Flag value |
134
+ |------------|------------|
135
+ | Plain text | `text` |
136
+ | HTML | `html` |
137
+ | Markdown | `markdown` |
138
+ | CSV | `csv` |
139
+ | XML | `xml` |
140
+ | JSON | `json` |
141
+ | JUnit XML | `junit` |
142
+
143
+ ---
144
+
145
+ ## Supported Licenses
146
+
147
+ The following licenses are recognized in the conflict matrix:
148
+
149
+ `MIT` · `Apache 2.0` · `New BSD` · `Simplified BSD` · `GPLv2` · `GPLv3` · `LGPL 2.1` · `LGPL 3.0` · `MPL 1.1` · `MPL 2.0` · `CDDL 1.0` · `AFL 3.0` · `OSL 3.0` · `AGPL 3` · `AGPL 1.0` · `EPL 1.0` · `EPL 2.0` · `ISC` · `Zlib` · `Unlicense`
150
+
151
+ The normalizer recognizes SPDX identifiers and common aliases for all of the above (e.g. `Apache-2.0`, `GPL-3.0-only`, `BSD-3-Clause`). Unrecognized license names are passed through as-is and checked against the matrix.
152
+
153
+ ---
154
+
155
+ ## Exit Codes
156
+
157
+ | Code | Meaning |
158
+ |------|---------------------------------------------------------------------------------|
159
+ | `0` | No license conflicts found |
160
+ | `1` | One or more license conflicts detected |
161
+ | `2` | Error during execution (license not found, unsupported license, invalid option) |
162
+
163
+ ---
164
+
165
+ ## Contributing
166
+
167
+ Contributions are welcome! Please follow these steps:
168
+
169
+ 1. Fork the repository
170
+ 2. Create a feature branch (`git checkout -b feature/my-feature`)
171
+ 3. Write tests for your changes
172
+ 4. Run the test suite (`bundle exec rspec`)
173
+ 5. Open a Pull Request
174
+
175
+ ### Running Tests
176
+
177
+ ```bash
178
+ bundle install
179
+ bundle exec rspec
180
+ ```
181
+
182
+ ---
183
+
184
+ ## License
185
+
186
+ This project is released under the [MIT License](LICENSE).
data/README.pt-BR.md ADDED
@@ -0,0 +1,186 @@
1
+ # license_conflicts
2
+
3
+ **license_conflicts** detecta incompatibilidades de licenças de software entre um projeto e suas dependências. Ele identifica a licença do projeto, verifica as licenças de todas as dependências utilizando o [LicenseFinder](https://github.com/pivotal/LicenseFinder) e reporta quaisquer conflitos encontrados.
4
+
5
+ ---
6
+
7
+ ## Índice
8
+
9
+ - [Como Funciona](#como-funciona)
10
+ - [Linguagens Suportadas](#linguagens-suportadas)
11
+ - [Requisitos](#requisitos)
12
+ - [Instalação](#instalação)
13
+ - [Uso](#uso)
14
+ - [Saída](#saída)
15
+ - [Formatos de Relatório](#formatos-de-relatório)
16
+ - [Licenças Suportadas](#licenças-suportadas)
17
+ - [Códigos de Saída](#códigos-de-saída)
18
+ - [Contribuindo](#contribuindo)
19
+ - [Licença](#licença)
20
+
21
+ ---
22
+
23
+ ## Como Funciona
24
+
25
+ 1. **Detecta a licença do projeto** a partir do seu arquivo de metadados (`package.json`, `gemspec`, `pom.xml`, etc.)
26
+ 2. **Verifica todas as dependências** utilizando o LicenseFinder
27
+ 3. **Normaliza os nomes das licenças** — identificadores SPDX, aliases comuns e variações ortográficas são mapeados para nomes canônicos
28
+ 4. **Verifica conflitos** utilizando uma matriz de compatibilidade integrada
29
+ 5. **Reporta os resultados** na saída padrão e encerra com o código de saída apropriado
30
+
31
+ ---
32
+
33
+ ## Linguagens Suportadas
34
+
35
+ | Linguagem | Gerenciador de Pacotes | Arquivo de Metadados |
36
+ |------------|------------------------|-------------------------------|
37
+ | JavaScript | npm | `package.json` |
38
+ | JavaScript | Bower | `bower.json` |
39
+ | Ruby | Bundler | `*.gemspec` |
40
+ | Python | pip / Poetry | `setup.cfg`, `pyproject.toml` |
41
+ | Go | Go modules | `go.mod` |
42
+ | Go | Godep | `Godeps/Godeps.json` |
43
+ | Java | Maven | `pom.xml` |
44
+
45
+ ---
46
+
47
+ ## Requisitos
48
+
49
+ - Ruby >= 2.6.0
50
+ - O gerenciador de pacotes do seu tipo de projeto deve estar instalado (ex: `npm`, `bundler`, `mvn`)
51
+
52
+ ---
53
+
54
+ ## Instalação
55
+
56
+ ```bash
57
+ gem install license_conflicts
58
+ ```
59
+
60
+ ---
61
+
62
+ ## Uso
63
+
64
+ Execute dentro do diretório raiz do projeto que deseja analisar:
65
+
66
+ ```bash
67
+ license_conflicts
68
+ ```
69
+
70
+ Para gerar um relatório detalhado das dependências junto à verificação de conflitos:
71
+
72
+ ```bash
73
+ license_conflicts check --format markdown
74
+ ```
75
+
76
+ Para exibir a versão instalada:
77
+
78
+ ```bash
79
+ license_conflicts version
80
+ ```
81
+
82
+ ### Opções
83
+
84
+ | Flag | Alias | Descrição |
85
+ |-------------------|-------------|----------------------------------------------------------------------------------|
86
+ | `--format FORMAT` | `-f FORMAT` | Formato do relatório: `text`, `html`, `markdown`, `csv`, `xml`, `json`, `junit` |
87
+
88
+ ---
89
+
90
+ ## Saída
91
+
92
+ Os resultados são impressos na **saída padrão (stdout)** em uma única linha separada por vírgulas:
93
+
94
+ ```
95
+ {quantidade_dependencias}, {licenca_projeto}, {licencas_conflitantes}, {relatorio}
96
+ ```
97
+
98
+ | Campo | Descrição |
99
+ |--------------------------|------------------------------------------------------------------------------------|
100
+ | `quantidade_dependencias`| Número de dependências verificadas |
101
+ | `licenca_projeto` | Licença detectada do projeto analisado |
102
+ | `licencas_conflitantes` | Lista de licenças incompatíveis encontradas, separadas por ponto e vírgula (vazia se não houver conflitos) |
103
+ | `relatorio` | Relatório completo das dependências (apenas quando `--format` é especificado) |
104
+
105
+ ### Exemplos
106
+
107
+ Nenhum conflito encontrado:
108
+
109
+ ```
110
+ 42, MIT, ,
111
+ ```
112
+
113
+ Conflitos detectados:
114
+
115
+ ```
116
+ 42, MIT, GPLv2;AGPL 3,
117
+ ```
118
+
119
+ Com relatório em Markdown:
120
+
121
+ ```
122
+ 42, MIT, GPLv2, ## Dependencies ...
123
+ ```
124
+
125
+ Mensagens de diagnóstico e erros são escritos na **saída de erro (stderr)** e não afetam o formato de saída do stdout.
126
+
127
+ ---
128
+
129
+ ## Formatos de Relatório
130
+
131
+ Quando `--format` é fornecido, um relatório completo das dependências é anexado à saída. Formatos disponíveis:
132
+
133
+ | Formato | Valor da flag |
134
+ |-------------|---------------|
135
+ | Texto puro | `text` |
136
+ | HTML | `html` |
137
+ | Markdown | `markdown` |
138
+ | CSV | `csv` |
139
+ | XML | `xml` |
140
+ | JSON | `json` |
141
+ | JUnit XML | `junit` |
142
+
143
+ ---
144
+
145
+ ## Licenças Suportadas
146
+
147
+ As seguintes licenças são reconhecidas na matriz de conflitos:
148
+
149
+ `MIT` · `Apache 2.0` · `New BSD` · `Simplified BSD` · `GPLv2` · `GPLv3` · `LGPL 2.1` · `LGPL 3.0` · `MPL 1.1` · `MPL 2.0` · `CDDL 1.0` · `AFL 3.0` · `OSL 3.0` · `AGPL 3` · `AGPL 1.0` · `EPL 1.0` · `EPL 2.0` · `ISC` · `Zlib` · `Unlicense`
150
+
151
+ O normalizador reconhece identificadores SPDX e aliases comuns para todas as licenças acima (ex: `Apache-2.0`, `GPL-3.0-only`, `BSD-3-Clause`). Nomes de licenças não reconhecidos são repassados como estão e verificados contra a matriz.
152
+
153
+ ---
154
+
155
+ ## Códigos de Saída
156
+
157
+ | Código | Significado |
158
+ |--------|------------------------------------------------------------------------------------------|
159
+ | `0` | Nenhum conflito de licença encontrado |
160
+ | `1` | Um ou mais conflitos de licença detectados |
161
+ | `2` | Erro durante a execução (licença não encontrada, licença não suportada, opção inválida) |
162
+
163
+ ---
164
+
165
+ ## Contribuindo
166
+
167
+ Contribuições são bem-vindas! Siga os passos abaixo:
168
+
169
+ 1. Faça um fork do repositório
170
+ 2. Crie uma branch para sua feature (`git checkout -b feature/minha-feature`)
171
+ 3. Escreva testes para suas alterações
172
+ 4. Execute a suíte de testes (`bundle exec rspec`)
173
+ 5. Abra um Pull Request
174
+
175
+ ### Executando os Testes
176
+
177
+ ```bash
178
+ bundle install
179
+ bundle exec rspec
180
+ ```
181
+
182
+ ---
183
+
184
+ ## Licença
185
+
186
+ Este projeto está disponível como open source sob os termos da [Licença MIT](LICENSE).
data/Rakefile ADDED
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rspec/core/rake_task"
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ require "rubocop/rake_task"
9
+
10
+ RuboCop::RakeTask.new
11
+
12
+ task default: %i[spec rubocop]
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require 'license_conflicts/cli'
5
+
6
+ LicenseConflicts::CLI.start(ARGV)
@@ -0,0 +1,46 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'thor'
4
+ require 'license_conflicts'
5
+
6
+ module LicenseConflicts
7
+ class CLI < Thor
8
+ VALID_FORMATS = LicenseConflicts::Report::FORMATS.keys.freeze
9
+
10
+ desc "check", "Check license conflicts in the current project"
11
+ option :format, aliases: "-f", desc: "Report format: #{VALID_FORMATS.join(', ')}"
12
+ def check
13
+ format = options[:format]
14
+
15
+ if format && !VALID_FORMATS.include?(format)
16
+ $stderr.puts "Invalid format '#{format}'. Valid options: #{VALID_FORMATS.join(', ')}"
17
+ exit 2
18
+ end
19
+
20
+ $stderr.print "Analyzing dependencies..."
21
+ finder = LicenseConflicts::Finder.new
22
+ conflicting_dependencies = finder.find_conflicts
23
+ $stderr.puts " done."
24
+
25
+ conflicting_licenses = conflicting_dependencies.map { |d| d.licenses.first.name }.uniq
26
+ parsed_conflicting_licenses = conflicting_licenses.join(';')
27
+
28
+ $stdout.print "#{finder.dependencies_count}, #{finder.project_license}, #{parsed_conflicting_licenses}, "
29
+
30
+ LicenseConflicts::Report.new(conflicting_dependencies, format || 'text').report if format
31
+
32
+ exit conflicting_dependencies.empty? ? 0 : 1
33
+ rescue StandardError => exception
34
+ $stdout.print "#{finder.dependencies_count rescue 0}, #{finder.project_license rescue nil}, , "
35
+ $stderr.puts exception.message
36
+ exit 2
37
+ end
38
+
39
+ desc "version", "Show version"
40
+ def version
41
+ puts LicenseConflicts::VERSION
42
+ end
43
+
44
+ default_command :check
45
+ end
46
+ end