@mocoto/mahoraga 0.14.4 → 0.14.6
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.
- package/README.md +9 -39
- package/dist/analysts/architects/archetypes-custom.js +1 -1
- package/dist/analysts/architects/detector-archetypes.js +1 -0
- package/dist/analysts/architects/strategist-structure.js +1 -1
- package/dist/analysts/azure-pipelines/corrections/correction-azure.js +1 -0
- package/dist/analysts/azure-pipelines/detectors/detector-azure-performance.js +1 -0
- package/dist/analysts/azure-pipelines/detectors/detector-azure-security.js +1 -0
- package/dist/analysts/azure-pipelines/detectors/detector-azure-structure.js +1 -0
- package/dist/analysts/azure-pipelines/scorers/scorer-azure.js +1 -0
- package/dist/analysts/circleci/detectors/detector-circleci-performance.js +1 -0
- package/dist/analysts/circleci/detectors/detector-circleci-security.js +1 -0
- package/dist/analysts/circleci/detectors/detector-circleci-structure.js +9 -10
- package/dist/analysts/converters/engines/converter-gha-to-gitlab.js +1 -0
- package/dist/analysts/corrections/corrector-structure.js +2 -2
- package/dist/analysts/corrections/fix-md-fences.js +1 -0
- package/dist/analysts/corrections/map-reversion.js +1 -0
- package/dist/analysts/corrections/quick-fixes/fix-any-to-proper-type.js +1 -0
- package/dist/analysts/corrections/reorganize-barrels.js +1 -0
- package/dist/analysts/corrections/scoring-shared.js +1 -0
- package/dist/analysts/corrections/type-safety/context-analyzer.js +1 -1
- package/dist/analysts/corrections/type-safety/usage-analyzer.js +1 -0
- package/dist/analysts/css/analysts/analyst-css.js +3 -2
- package/dist/analysts/css/corrections/correction-css.js +1 -0
- package/dist/analysts/css/detectors/detector-css-best-practices.js +1 -0
- package/dist/analysts/css/scorers/scorer-css.js +1 -0
- package/dist/analysts/css-in-js/analysts/analyst-css-in-js.js +1 -0
- package/dist/analysts/css-in-js/corrections/correction-css-in-js.js +1 -1
- package/dist/analysts/css-in-js/detectors/detector-css-in-js-best-practices.js +2 -2
- package/dist/analysts/css-in-js/scorers/scorer-css-in-js.js +2 -2
- package/dist/analysts/detectors/detector-bugs-ml.js +4 -2
- package/dist/analysts/detectors/detector-dependencies.js +1 -0
- package/dist/analysts/detectors/detector-monorepo.js +1 -0
- package/dist/analysts/detectors/detector-security.js +1 -1
- package/dist/analysts/github-actions/corrections/correction-workflow.js +1 -0
- package/dist/analysts/github-actions/detectors/detector-dependencies-vulnerable.js +1 -0
- package/dist/analysts/github-actions/detectors/detector-workflow-compliance.js +1 -0
- package/dist/analysts/github-actions/detectors/detector-workflow-performance.js +1 -0
- package/dist/analysts/github-actions/detectors/detector-workflow-security.js +1 -0
- package/dist/analysts/github-actions/detectors/detector-workflow-structure.js +1 -0
- package/dist/analysts/github-actions/detectors/detector-workflow-trigger-unsafe.js +1 -0
- package/dist/analysts/github-actions/scorers/scorer-workflow.js +1 -0
- package/dist/analysts/gitlab-ci/analysts/analyst-gitlab-ci.js +1 -0
- package/dist/analysts/gitlab-ci/corrections/correction-gitlab-ci.js +1 -0
- package/dist/analysts/gitlab-ci/detectors/detector-gitlab-ci-performance.js +1 -0
- package/dist/analysts/gitlab-ci/detectors/detector-gitlab-ci-security.js +1 -0
- package/dist/analysts/gitlab-ci/detectors/detector-gitlab-ci-structure.js +1 -0
- package/dist/analysts/go/analysts/analyst-best-practices.js +1 -0
- package/dist/analysts/go/analysts/analyst-concurrency.js +1 -0
- package/dist/analysts/go/analysts/analyst-go.js +1 -0
- package/dist/analysts/go/analysts/analyst-resources.js +1 -0
- package/dist/analysts/go/detectors/detector-conventions.js +1 -0
- package/dist/analysts/go/detectors/detector-errors-un-handled.js +1 -0
- package/dist/analysts/go/detectors/detector-vulnerabilities.js +1 -0
- package/dist/analysts/html/analysts/analyst-html.js +1 -0
- package/dist/analysts/html/corrections/correction-html.js +1 -0
- package/dist/analysts/html/detectors/detector-html-accessibility.js +1 -0
- package/dist/analysts/html/detectors/detector-html.js +1 -0
- package/dist/analysts/jenkins/analysts/analyst-jenkins.js +1 -0
- package/dist/analysts/jenkins/corrections/correction-jenkins.js +1 -0
- package/dist/analysts/jenkins/detectors/detector-jenkins-best-practices.js +1 -0
- package/dist/analysts/jenkins/detectors/detector-jenkins-security.js +1 -0
- package/dist/analysts/jenkins/scorers/scorer-jenkins.js +1 -0
- package/dist/analysts/js-ts/analysts/analyst-todo-comments.js +1 -6
- package/dist/analysts/js-ts/detectors/detector-context-smart.js +1 -0
- package/dist/analysts/js-ts/detectors/detector-interfaces-inline.js +1 -0
- package/dist/analysts/js-ts/detectors/detector-leaks-memory.js +1 -0
- package/dist/analysts/js-ts/detectors/detector-types-unsafe.js +88 -5
- package/dist/analysts/php/analysts/analyst-php.js +1 -0
- package/dist/analysts/php/detectors/detector-php-best-practices.js +1 -0
- package/dist/analysts/php/detectors/detector-php-security.js +1 -0
- package/dist/analysts/plugins/analyst-formatter.js +1 -0
- package/dist/analysts/plugins/detector-markdown.js +1 -0
- package/dist/analysts/python/analysts/analyst-python.js +2 -1
- package/dist/analysts/python/corrections/correction-python.js +1 -0
- package/dist/analysts/python/scorers/scorer-python.js +1 -0
- package/dist/analysts/react/analysts/analyst-react-hooks.js +109 -12
- package/dist/analysts/react/analysts/analyst-react.js +12 -0
- package/dist/analysts/react/detectors/detector-react-best-practices.js +24 -1
- package/dist/analysts/react/scorers/scorer-react.js +4 -1
- package/dist/analysts/registry/autodiscovery.js +1 -0
- package/dist/analysts/rust/analysts/analyst-best-practices.js +1 -0
- package/dist/analysts/rust/analysts/analyst-concurrency.js +1 -0
- package/dist/analysts/rust/analysts/analyst-memory.js +1 -0
- package/dist/analysts/rust/analysts/analyst-rust.js +1 -0
- package/dist/analysts/rust/analysts/analyst-security.js +1 -0
- package/dist/analysts/rust/detectors/detector-conventions.js +1 -0
- package/dist/analysts/rust/detectors/detector-errors-potential.js +1 -0
- package/dist/analysts/shell/analysts/analyst-shell.js +1 -0
- package/dist/analysts/shell/corrections/correction-shell.js +1 -0
- package/dist/analysts/shell/detectors/detector-shell-security.js +1 -0
- package/dist/analysts/shell/scorers/scorer-shell.js +1 -0
- package/dist/analysts/sql/corrections/correction-sql.js +1 -0
- package/dist/analysts/sql/detectors/detector-sql.js +1 -0
- package/dist/analysts/sql/scorers/scorer-sql.js +1 -0
- package/dist/analysts/strategists/operator-structure.js +1 -1
- package/dist/analysts/strategists/suggestions-contextuais.js +1 -0
- package/dist/analysts/svg/analysts/analyst-svg.js +1 -0
- package/dist/analysts/svg/corrections/correction-svg.js +1 -0
- package/dist/analysts/svg/detectors/detector-svg-security.js +1 -0
- package/dist/analysts/tailwind/analysts/analyst-tailwind.js +6 -2
- package/dist/analysts/tailwind/corrections/correction-tailwind.js +1 -0
- package/dist/analysts/tailwind/detectors/detector-tailwind-best-practices.js +1 -0
- package/dist/analysts/xml/analysts/analyst-xml.js +1 -0
- package/dist/analysts/xml/corrections/correction-xml.js +1 -0
- package/dist/analysts/xml/detectors/detector-xml-security.js +1 -0
- package/dist/analysts/xml/scorers/scorer-xml.js +1 -0
- package/dist/app/github.js +1 -0
- package/dist/bin/cli-bootstrap.js +1 -1
- package/dist/bin/index.js +1 -1
- package/dist/caretakers/caretaker-imports.js +1 -0
- package/dist/cli/commands/command-analysts.js +1 -0
- package/dist/cli/commands/command-azure.js +1 -0
- package/dist/cli/commands/command-barrels.js +1 -0
- package/dist/cli/commands/command-circleci.js +1 -0
- package/dist/cli/commands/command-compliance.js +1 -0
- package/dist/cli/commands/command-convert.js +1 -0
- package/dist/cli/commands/command-diagnose.js +1 -1
- package/dist/cli/commands/command-fix-types.js +1 -1
- package/dist/cli/commands/command-format.js +1 -0
- package/dist/cli/commands/command-formatters.js +1 -0
- package/dist/cli/commands/command-github-actions.js +1 -0
- package/dist/cli/commands/command-gitlab-ci.js +1 -0
- package/dist/cli/commands/command-guardian.js +1 -1
- package/dist/cli/commands/command-imports.js +1 -0
- package/dist/cli/commands/command-jenkins.js +1 -0
- package/dist/cli/commands/command-licenses.js +1 -0
- package/dist/cli/commands/command-marketplace.js +1 -0
- package/dist/cli/commands/command-metrics.js +1 -1
- package/dist/cli/commands/command-names.js +1 -0
- package/dist/cli/commands/command-optimize-svg.js +1 -0
- package/dist/cli/commands/command-perf.js +1 -0
- package/dist/cli/commands/command-plugins.js +1 -0
- package/dist/cli/commands/command-prune.js +1 -0
- package/dist/cli/commands/command-reverter.js +1 -0
- package/dist/cli/commands/command-update.js +1 -0
- package/dist/cli/diagnostic/auto-fix.js +1 -0
- package/dist/cli/diagnostic/exporters/json-exporter.js +1 -0
- package/dist/cli/diagnostic/exporters/sharded-exporter.js +1 -1
- package/dist/cli/diagnostic/handlers/auto-fix-handler.js +1 -0
- package/dist/cli/diagnostic/handlers/guardian-handler.js +1 -0
- package/dist/cli/diagnostic/processing-diagnostic.js +1 -0
- package/dist/cli/diagnostic/processing-helpers.js +1 -0
- package/dist/cli/handlers/command-vulnerabilities.js +1 -0
- package/dist/cli/handlers/fix-types-exporter.js +1 -0
- package/dist/cli/handlers/guardian-exporter.js +1 -0
- package/dist/cli/helpers/display-frame.js +1 -0
- package/dist/core/config/auto/validation.js +1 -0
- package/dist/core/config/config.js +1 -0
- package/dist/core/config/excludes-padrao.js +1 -0
- package/dist/core/execution/executor.js +1 -0
- package/dist/core/execution/inquisitor.js +1 -0
- package/dist/core/formatters/registro-builtin.js +1 -0
- package/dist/core/messages/en/analysts/detector-react-messages.js +3 -0
- package/dist/core/messages/en/analysts/report-circleci-messages.js +5 -5
- package/dist/core/messages/en/cli/cli-command-marketplace-messages.js +1 -0
- package/dist/core/messages/en/core/plugin-messages.js +1 -1
- package/dist/core/messages/en/log/log-helper.js +1 -1
- package/dist/core/messages/en/ui/suggestions.js +1 -1
- package/dist/core/messages/ja/analysts/report-circleci-messages.js +5 -5
- package/dist/core/messages/ja/core/plugin-messages.js +1 -1
- package/dist/core/messages/ja/log/log-helper.js +1 -1
- package/dist/core/messages/ja/ui/suggestions.js +1 -1
- package/dist/core/messages/pt/analysts/detector-react-messages.js +3 -0
- package/dist/core/messages/pt/analysts/report-circleci-messages.js +5 -5
- package/dist/core/messages/pt/core/plugin-messages.js +1 -1
- package/dist/core/messages/pt/log/log-helper.js +1 -1
- package/dist/core/messages/pt/ui/suggestions.js +1 -1
- package/dist/core/messages/shared/icons.js +1 -0
- package/dist/core/messages/zh/analysts/report-circleci-messages.js +5 -5
- package/dist/core/messages/zh/core/plugin-messages.js +1 -1
- package/dist/core/messages/zh/log/log-helper.js +1 -1
- package/dist/core/messages/zh/ui/suggestions.js +1 -1
- package/dist/core/parsing/langs/css.js +1 -0
- package/dist/core/parsing/langs/html.js +1 -0
- package/dist/core/parsing/langs/json.js +1 -0
- package/dist/core/parsing/langs/php.js +1 -0
- package/dist/core/parsing/langs/python.js +1 -0
- package/dist/core/parsing/langs/rust.js +1 -0
- package/dist/core/parsing/langs/scss.js +1 -0
- package/dist/core/parsing/langs/shell.js +1 -0
- package/dist/core/parsing/langs/vue.js +1 -0
- package/dist/core/parsing/parser.js +1 -0
- package/dist/core/utils/exec-safe.js +23 -5
- package/dist/core/workers/worker-executor.js +1 -0
- package/dist/core/workers/worker-pool.js +0 -0
- package/dist/licenses/disclaimer.js +1 -0
- package/dist/licenses/generate-notices.js +1 -0
- package/dist/licenses/normalizer.js +1 -0
- package/dist/licenses/scanner.js +1 -0
- package/dist/node.loader.js +1 -1
- package/dist/reports/filter-smart.js +1 -1
- package/dist/reports/report-archetypes.js +1 -0
- package/dist/shared/data-processing/fragment-report.js +1 -0
- package/dist/shared/data-processing/json.js +1 -0
- package/dist/shared/formatters/engines/prettier.js +1 -0
- package/dist/shared/formatters/engines/stylelint.js +1 -0
- package/dist/shared/formatters/formatters/code.js +1 -0
- package/dist/shared/formatters/formatters/css.js +1 -0
- package/dist/shared/formatters/formatters/dockerfile.js +1 -0
- package/dist/shared/formatters/formatters/dotfiles.js +1 -0
- package/dist/shared/formatters/formatters/go.js +1 -0
- package/dist/shared/formatters/formatters/html.js +1 -0
- package/dist/shared/formatters/formatters/json.js +1 -0
- package/dist/shared/formatters/formatters/markdown.js +1 -0
- package/dist/shared/formatters/formatters/shell.js +1 -0
- package/dist/shared/formatters/formatters/sql.js +1 -0
- package/dist/shared/formatters/formatters/toml.js +1 -0
- package/dist/shared/formatters/formatters/xml.js +1 -0
- package/dist/shared/formatters/formatters/yaml.js +1 -0
- package/dist/shared/helpers/analyst-wrapper.js +1 -0
- package/dist/shared/helpers/detectors-common.js +1 -0
- package/dist/shared/helpers/framework-detector.js +1 -0
- package/dist/shared/helpers/imports.js +1 -1
- package/dist/shared/helpers/reader-report.js +1 -0
- package/dist/shared/helpers/rule-config.js +1 -0
- package/dist/shared/helpers/suppressao.js +1 -0
- package/dist/shared/marketplace/remote.js +1 -0
- package/dist/shared/persistence/persistence.js +3 -3
- package/dist/shared/plugins/registry.js +1 -0
- package/dist/types/analysts/css-in-js.js +2 -0
- package/dist/types/analysts/index.js +1 -0
- package/dist/types/processing/display.js +1 -1
- package/dist/types/processing/filters.js +1 -0
- package/dist/vulnerabilities/scanner.js +1 -0
- package/package.json +1 -1
- package/dist/index.js +0 -2
- package/dist/sdk/analyzer.js +0 -88
- package/dist/sdk/index.js +0 -2
- package/dist/sdk/sdk-legacy.js +0 -36
- package/dist/types/sdk/analyzer.js +0 -1
- package/dist/types/sdk/index.js +0 -1
package/README.md
CHANGED
|
@@ -8,15 +8,19 @@ Proveniência e Autoria: Este documento integra o projeto Mahoraga (licença MIT
|
|
|
8
8
|
|
|
9
9
|
</div>
|
|
10
10
|
|
|
11
|
-
<p>
|
|
11
|
+
<p> Desisti de desistir do projeto, até parece que vou aceitar perder pra vocês ...</p>
|
|
12
|
+
|
|
13
|
+
<p> caso tenha interesse em ajudar no projeto o E-mail é esse ai em baixo o **lint que me aguarde 😜 </p>
|
|
12
14
|
|
|
13
15
|
[Gmail](mailto:mocoto.persona@gmail.com)
|
|
14
16
|
|
|
17
|
+
<h5> Alias!! ignora o sugestoes-00*.json ainda esta em ajustes.</h5>
|
|
18
|
+
|
|
15
19
|
## Começar Rápido (30 segundos)
|
|
16
20
|
|
|
17
21
|
```bash
|
|
18
22
|
# 1. Instalar
|
|
19
|
-
npm install -g mahoraga
|
|
23
|
+
npm install -g @mocoto/mahoraga
|
|
20
24
|
|
|
21
25
|
# 2. Analisar seu projeto
|
|
22
26
|
cd meu-projeto
|
|
@@ -185,25 +189,16 @@ mahoraga metricas
|
|
|
185
189
|
|
|
186
190
|
**Uso global:**
|
|
187
191
|
```bash
|
|
188
|
-
npm install -g mahoraga
|
|
192
|
+
npm install -g @mocoto/mahoraga
|
|
189
193
|
mahoraga --version
|
|
190
194
|
```
|
|
191
195
|
|
|
192
196
|
**Uso local no projeto:**
|
|
193
197
|
```bash
|
|
194
|
-
npm install --save-dev mahoraga
|
|
198
|
+
npm install --save-dev @mocoto/mahoraga
|
|
195
199
|
npx mahoraga --help
|
|
196
200
|
```
|
|
197
201
|
|
|
198
|
-
### Do Repositório
|
|
199
|
-
|
|
200
|
-
```bash
|
|
201
|
-
git clone https://github.com/o-atoa/mahoraga.git
|
|
202
|
-
cd mahoraga
|
|
203
|
-
npm install
|
|
204
|
-
npm run build
|
|
205
|
-
npm link
|
|
206
|
-
```
|
|
207
202
|
|
|
208
203
|
### Docker
|
|
209
204
|
|
|
@@ -612,19 +607,6 @@ mahoraga github-actions gate --threshold 80 --fail-on erro
|
|
|
612
607
|
|
|
613
608
|
---
|
|
614
609
|
|
|
615
|
-
## Desenvolvimento
|
|
616
|
-
|
|
617
|
-
### Setup
|
|
618
|
-
|
|
619
|
-
```bash
|
|
620
|
-
git clone https://github.com/o-atoa/mahoraga.git
|
|
621
|
-
cd mahoraga
|
|
622
|
-
npm install
|
|
623
|
-
npm run build
|
|
624
|
-
npm link
|
|
625
|
-
mahoraga --version
|
|
626
|
-
```
|
|
627
|
-
|
|
628
610
|
### Scripts
|
|
629
611
|
|
|
630
612
|
```bash
|
|
@@ -691,18 +673,6 @@ Dependências de terceiros listadas em [THIRD-PARTY-NOTICES.txt](./THIRD-PARTY-N
|
|
|
691
673
|
|
|
692
674
|
---
|
|
693
675
|
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
[](https://www.npmjs.com/package/mahoraga)
|
|
697
|
-
[](https://github.com/o-atoa/mahoraga)
|
|
698
|
-
[](https://github.com/o-atoa/mahoraga/issues)
|
|
699
|
-
[](https://github.com/o-atoa/mahoraga/releases)
|
|
700
|
-
|
|
701
|
-
**Feito para os iniciantes** — [Voltar ao topo](#mahoraga)
|
|
676
|
+
**Feito para os iniciantes**
|
|
702
677
|
|
|
703
678
|
</div>
|
|
704
|
-
# mahoraga
|
|
705
|
-
|
|
706
|
-
# mahoraga
|
|
707
|
-
# mahoraga
|
|
708
|
-
# mahoraga
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
// @mahoraga-disable tipo-literal-inline-complexo ml-deep-nesting
|
|
1
2
|
// SPDX-License-Identifier: MIT
|
|
2
|
-
// @mahoraga-disable tipo-literal-inline-complexo
|
|
3
3
|
// Justificativa: tipos locais para arquétipos personalizados
|
|
4
4
|
/**
|
|
5
5
|
* Sistema de Arquétipos Personalizados do Mahoraga
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// SPDX-License-Identifier: MIT
|
|
2
2
|
// Nota: manter ARQUETIPOS importado visível como lembrete para integração futura
|
|
3
|
+
// @mahoraga-disable ml-deep-nesting
|
|
3
4
|
import path from 'node:path';
|
|
4
5
|
import { config } from '../../core/config/index.js';
|
|
5
6
|
import { getMessages } from '../../core/messages/index.js';
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
// @mahoraga-disable ml-deep-nesting
|
|
1
2
|
// SPDX-License-Identifier: MIT
|
|
2
3
|
import { statSync } from 'node:fs';
|
|
3
4
|
import path from 'node:path';
|
|
@@ -59,7 +60,6 @@ export async function gerarPlanoEstrategico(contexto, opcoes = {}, sinaisAvancad
|
|
|
59
60
|
const conflitos = [];
|
|
60
61
|
// Estratégia atual: heurística de nomeação + config/preset (sem consultar arquétipos aqui para evitar ciclos)
|
|
61
62
|
const rels = contexto.arquivos.map(arquivo => normalizarRel(arquivo.relPath));
|
|
62
|
-
const isTestLike = (caminho) => /__(tests|mocks)__/.test(caminho) || /\.(test|spec)\.[jt]sx?$/.test(caminho) || /fixtures\//.test(caminho);
|
|
63
63
|
for (const rel of rels) {
|
|
64
64
|
processarArquivoParaMovimento(rel, cfg, contexto.baseDir, sinaisAvancados, rels, mover, conflitos);
|
|
65
65
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
// SPDX-License-Identifier: MIT
|
|
2
|
+
// @mahoraga-disable ml-deep-nesting
|
|
2
3
|
import { parseDocument } from 'yaml';
|
|
3
4
|
import { messages } from '../../../core/messages/index.js';
|
|
4
5
|
import { criarOcorrencia } from '../../../types/index.js';
|
|
@@ -204,16 +205,14 @@ export const detectorCircleCIEstrutura = {
|
|
|
204
205
|
function collectUsedJobsFromWorkflows(wfValues) {
|
|
205
206
|
const usedJobs = new Set();
|
|
206
207
|
for (const wf of wfValues) {
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
Object.keys(wfJob).forEach(k => usedJobs.add(k));
|
|
216
|
-
}
|
|
208
|
+
const wfJobs = wf.jobs;
|
|
209
|
+
if (Array.isArray(wfJobs)) {
|
|
210
|
+
for (const wfJob of wfJobs) {
|
|
211
|
+
if (typeof wfJob === 'string') {
|
|
212
|
+
usedJobs.add(wfJob);
|
|
213
|
+
}
|
|
214
|
+
else {
|
|
215
|
+
Object.keys(wfJob).forEach(k => usedJobs.add(k));
|
|
217
216
|
}
|
|
218
217
|
}
|
|
219
218
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
// @mahoraga-disable tipo-inseguro-unknown tipo-literal-inline-complexo ml-deep-nesting
|
|
1
2
|
// SPDX-License-Identifier: MIT
|
|
2
|
-
// @mahoraga-disable tipo-inseguro-unknown tipo-literal-inline-complexo
|
|
3
3
|
// Justificativa: unknown é usado para tipagem defensiva de erros e módulos dinâmicos
|
|
4
4
|
import { promises as fs } from 'node:fs';
|
|
5
5
|
import path from 'node:path';
|
|
@@ -14,7 +14,7 @@ export async function corrigirEstrutura(mapa, fileEntries, baseDir = process.cwd
|
|
|
14
14
|
// Captura dinâmica das configs (evita congelar valores em tempo de import)
|
|
15
15
|
const CONCORRENCIA = config.STRUCTURE_CONCURRENCY;
|
|
16
16
|
const AUTO_CORRECAO = config.STRUCTURE_AUTO_FIX;
|
|
17
|
-
const rawPlugins = config.STRUCTURE_PLUGINS
|
|
17
|
+
const rawPlugins = config.STRUCTURE_PLUGINS;
|
|
18
18
|
const PLUGINS = Array.isArray(rawPlugins) ? rawPlugins.filter((p) => typeof p === 'string') : [];
|
|
19
19
|
const ESTRUTURA_CAMADAS = config.ESTRUTURA_CAMADAS;
|
|
20
20
|
const limit = pLimit(CONCORRENCIA);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
// @mahoraga-disable problema-documentacao ml-deep-nesting
|
|
1
2
|
// SPDX-License-Identifier: MIT
|
|
2
|
-
// @mahoraga-disable problema-documentacao
|
|
3
3
|
// Justificativa: funções estão tipadas, detector está identificando falsos positivos
|
|
4
4
|
/**
|
|
5
5
|
* Analisador de contexto para Type Safety Auto-Fix
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
// @mahoraga-disable ml-deep-nesting
|
|
1
2
|
// SPDX-License-Identifier: MIT
|
|
2
3
|
import postcss, {} from 'postcss';
|
|
3
4
|
import postcssSass from 'postcss-sass';
|
|
@@ -284,7 +285,7 @@ function collectCssIssuesFromPostCssAst(root, relPath) {
|
|
|
284
285
|
const simpleSelectors = splitSimpleSelectors(selectorText);
|
|
285
286
|
if (simpleSelectors.length) {
|
|
286
287
|
const decls = [];
|
|
287
|
-
rule.nodes
|
|
288
|
+
rule.nodes.forEach(node => {
|
|
288
289
|
if (node.type !== 'decl') {
|
|
289
290
|
return;
|
|
290
291
|
}
|
|
@@ -300,7 +301,7 @@ function collectCssIssuesFromPostCssAst(root, relPath) {
|
|
|
300
301
|
});
|
|
301
302
|
});
|
|
302
303
|
// Detecta regras vazias (ignora @apply do Tailwind CSS)
|
|
303
|
-
const hasApplyDirective = rule.nodes
|
|
304
|
+
const hasApplyDirective = rule.nodes.some(node => node.type === 'atrule' && (node).name === 'apply');
|
|
304
305
|
if (decls.length === 0 && !hasApplyDirective) {
|
|
305
306
|
pushOnce(warn(messages.CssMensagens.emptyRule, relPath, getNodeLine(rule)));
|
|
306
307
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
// SPDX-License-Identifier: MIT
|
|
2
1
|
// @mahoraga-disable css-in-js/regra
|
|
3
2
|
// Justificativa: O código-fonte contém padrões CSS-in-JS (como createGlobalStyle e !important)
|
|
4
3
|
// em expressões regulares de detecção, gerando falso positivo em auto-análise.
|
|
4
|
+
// SPDX-License-Identifier: MIT
|
|
5
5
|
/**
|
|
6
6
|
* [CHAVE-INGLESA] Correções automáticas para CSS-in-JS
|
|
7
7
|
*
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
//
|
|
2
|
-
// @mahoraga-disable css-in-js/regra
|
|
1
|
+
// @mahoraga-disable css-in-js/regra ml-deep-nesting
|
|
3
2
|
// Justificativa: O código-fonte contém padrões CSS-in-JS (como createGlobalStyle e !important)
|
|
4
3
|
// em expressões regulares de detecção, gerando falso positivo em auto-análise.
|
|
4
|
+
// SPDX-License-Identifier: MIT
|
|
5
5
|
import { getMessages } from '../../../core/messages/index.js';
|
|
6
6
|
import { splitLines } from '../../../shared/helpers/index.js';
|
|
7
7
|
import { IMPORTANT_PATTERN } from '../shared.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
//
|
|
2
|
-
// @mahoraga-disable css-in-js/regra
|
|
1
|
+
// @mahoraga-disable css-in-js/regra ml-deep-nesting
|
|
3
2
|
// Justificativa: O código-fonte contém padrões CSS-in-JS (como createGlobalStyle e !important)
|
|
4
3
|
// em expressões regulares de detecção, gerando falso positivo em auto-análise.
|
|
4
|
+
// SPDX-License-Identifier: MIT
|
|
5
5
|
import { getMessages } from '../../../core/messages/index.js';
|
|
6
6
|
import { splitLines } from '../../../shared/helpers/index.js';
|
|
7
7
|
import { IMPORTANT_GLOBAL } from '../shared.js';
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
// SPDX-License-Identifier: MIT
|
|
2
|
+
// @mahoraga-disable ml-deep-nesting
|
|
3
|
+
// Justificativa: O detector de aninhamento excessivo analisa o próprio código gerando falso positivo em auto-análise. O padrão deep-nesting é necessário para detecção de bugs.
|
|
2
4
|
import { getMessages } from '../../core/messages/index.js';
|
|
3
5
|
const MAX_MESSAGE_PREVIEW_LENGTH = 60;
|
|
4
6
|
// Statistical bug patterns with ML-like scoring
|
|
@@ -175,7 +177,7 @@ const BUG_PATTERNS = [
|
|
|
175
177
|
{
|
|
176
178
|
id: 'deep-nesting',
|
|
177
179
|
name: 'Aninhamento Excessivo',
|
|
178
|
-
severity: '
|
|
180
|
+
severity: 'aviso',
|
|
179
181
|
category: 'logic',
|
|
180
182
|
weight: 0.7,
|
|
181
183
|
detect(content, _relPath) {
|
|
@@ -490,7 +492,7 @@ export const detectorBugsMl = {
|
|
|
490
492
|
mensagem: getMessages().BugMlMensagens.altaProbabilidade((bugProb * 100).toFixed(0), factors.join(', ')),
|
|
491
493
|
origem: 'detector-bugs-ml',
|
|
492
494
|
relPath,
|
|
493
|
-
linha:
|
|
495
|
+
linha: 1,
|
|
494
496
|
});
|
|
495
497
|
}
|
|
496
498
|
detectarPadroesBug(src, relPath, ocorrencias);
|
|
@@ -330,7 +330,7 @@ function detectarCookieInseguro(callee, args, path, problemas) {
|
|
|
330
330
|
const options = args[2];
|
|
331
331
|
let hasHttpOnly = false;
|
|
332
332
|
if (options.type === 'ObjectExpression') {
|
|
333
|
-
hasHttpOnly = options.properties.some(
|
|
333
|
+
hasHttpOnly = options.properties.some(prop => prop.type === 'ObjectProperty' && prop.key.type === 'Identifier' && prop.key.name === 'httpOnly' && prop.value.type === 'BooleanLiteral' && prop.value.value);
|
|
334
334
|
}
|
|
335
335
|
if (!hasHttpOnly) {
|
|
336
336
|
problemas.push({
|
|
@@ -29,12 +29,7 @@ export const analistaTodoComentarios = {
|
|
|
29
29
|
if (!src || typeof src !== 'string') {
|
|
30
30
|
return null;
|
|
31
31
|
}
|
|
32
|
-
const
|
|
33
|
-
arquivo: relPath,
|
|
34
|
-
conteudo: src,
|
|
35
|
-
relPath
|
|
36
|
-
});
|
|
37
|
-
const nivelTodo = contextoArquivo.isLibrary ? 'aviso' : 'info';
|
|
32
|
+
const nivelTodo = 'aviso';
|
|
38
33
|
// Utiliza helper compartilhado para detecção robusta
|
|
39
34
|
const todos = detectarComentariosPendentes(src);
|
|
40
35
|
if (todos.length === 0) {
|