@mocoto/mahoraga 0.14.4 → 0.14.5
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 +1 -1
- 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/detectors/detector-structure.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 +6 -6
- 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 +1 -0
- 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/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 -0
- 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/README.md
CHANGED
|
@@ -8,7 +8,7 @@ Proveniência e Autoria: Este documento integra o projeto Mahoraga (licença MIT
|
|
|
8
8
|
|
|
9
9
|
</div>
|
|
10
10
|
|
|
11
|
-
<p> Estou ficando desanimado de continuar com esse projeto, caso goste do projeto e queira ajudar pra eu não desanimar entre em contato por esse E-mail
|
|
11
|
+
<p> Estou ficando desanimado de continuar com esse projeto, caso goste do projeto e queira ajudar pra eu não desanimar entre em contato por esse E-mail: /p>
|
|
12
12
|
|
|
13
13
|
[Gmail](mailto:mocoto.persona@gmail.com)
|
|
14
14
|
|
|
@@ -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({
|
|
@@ -51,7 +51,7 @@ export const detectorEstrutura = {
|
|
|
51
51
|
const setCaminhos = new Set(caminhos);
|
|
52
52
|
// Detecta contexto geral do projeto para análise inteligente
|
|
53
53
|
const arquivoPrincipal = caminhos?.find(caminho => /package\.json$/.test(caminho)) ?? caminhos[0];
|
|
54
|
-
const conteudoPrincipal = contexto.arquivos
|
|
54
|
+
const conteudoPrincipal = contexto.arquivos.find(arquivo => arquivo.relPath === arquivoPrincipal)?.content ?? '';
|
|
55
55
|
const contextoProjeto = detectarContextoProjeto({
|
|
56
56
|
arquivo: arquivoPrincipal,
|
|
57
57
|
conteudo: conteudoPrincipal,
|
|
@@ -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) {
|
|
@@ -125,6 +125,7 @@ const visitorMemoria = {
|
|
|
125
125
|
});
|
|
126
126
|
}
|
|
127
127
|
catch { }
|
|
128
|
+
/* eslint-disable-next-line @typescript-eslint/no-unnecessary-condition -- path.traverse callbacks set these synchronously */
|
|
128
129
|
if (hasReturnFunction && referencesLargeData) {
|
|
129
130
|
state.closureLargeObjects.add(path.node.loc?.start.line ?? 0);
|
|
130
131
|
state.ocorrencias.push({
|