@codacy/analysis-runner 0.17.0 → 0.19.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.
- package/dist/index.d.ts +191 -35
- package/dist/index.js +1502 -860
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -410,9 +410,14 @@ declare function parseAutoFilters(raw: string): {
|
|
|
410
410
|
* The generated client (src/api/client/) is produced from the Codacy OpenAPI spec
|
|
411
411
|
* and should never be edited by hand. All API interactions go through this file.
|
|
412
412
|
*
|
|
413
|
-
* Authentication: Codacy uses an `api-token` header (
|
|
414
|
-
* `
|
|
415
|
-
*
|
|
413
|
+
* Authentication: Codacy uses an `api-token` header (account token) or a
|
|
414
|
+
* `project-token` header (repository token). `configureApiToken()`
|
|
415
|
+
* sets exactly one via `OpenAPI.HEADERS` and must be called before any
|
|
416
|
+
* authenticated endpoint is used. Most operations only accept `api-token`; a
|
|
417
|
+
* small whitelisted subset of repository-scoped reads (`getRepository`,
|
|
418
|
+
* `listRepositoryTools`, `listRepositoryToolPatterns`, `listIgnoredFiles`) also
|
|
419
|
+
* accept `project-token` — the backend rejects it everywhere else exactly as
|
|
420
|
+
* if no token had been sent.
|
|
416
421
|
*
|
|
417
422
|
* Pagination: all list endpoints use cursor-based pagination. `fetchAllPages()`
|
|
418
423
|
* follows cursors until the response contains no next cursor.
|
|
@@ -428,12 +433,41 @@ interface IgnoredFilesResult {
|
|
|
428
433
|
capped: boolean;
|
|
429
434
|
}
|
|
430
435
|
/**
|
|
431
|
-
*
|
|
432
|
-
*
|
|
433
|
-
*
|
|
434
|
-
*
|
|
436
|
+
* Auth for API calls that accept either an account token or a repository
|
|
437
|
+
* (project) token — currently only the 4 reads `initRemoteConfig` makes. A
|
|
438
|
+
* discriminated union (same shape and naming as `UploadAuth` in `upload.ts`)
|
|
439
|
+
* so "exactly one token" is a compile-time guarantee, not a runtime check,
|
|
440
|
+
* and so there is never a "both configured" state for the backend to have to
|
|
441
|
+
* arbitrate — sending both was never useful anyway, since the backend always
|
|
442
|
+
* prefers `api-token` when both are present.
|
|
435
443
|
*/
|
|
436
|
-
|
|
444
|
+
type RemoteAuth = {
|
|
445
|
+
kind: "account-token";
|
|
446
|
+
token: string;
|
|
447
|
+
} | {
|
|
448
|
+
kind: "repository-token";
|
|
449
|
+
token: string;
|
|
450
|
+
};
|
|
451
|
+
/**
|
|
452
|
+
* Configures the auth header used for authenticated requests. Must be called
|
|
453
|
+
* before `getRepository`, `listRepositoryTools`, `listRepositoryToolPatterns`,
|
|
454
|
+
* or `listIgnoredFiles`. Public endpoints (listTools, listPatterns) do not
|
|
455
|
+
* require a token.
|
|
456
|
+
*
|
|
457
|
+
* Accepts a bare account-token string, for source compatibility with this
|
|
458
|
+
* function's original `(token: string)` shape — this is a published package,
|
|
459
|
+
* and embedders (a VSCode extension, an MCP server) call it directly with a
|
|
460
|
+
* bare string — or a {@link RemoteAuth} object to configure a repository
|
|
461
|
+
* token instead. Throws if given neither a non-empty string nor a valid
|
|
462
|
+
* `RemoteAuth`, rather than silently configuring no auth at all.
|
|
463
|
+
*
|
|
464
|
+
* Fully replaces any previously configured auth — it does not merge with a
|
|
465
|
+
* prior call. A process driving multiple auth contexts (e.g. an embedder
|
|
466
|
+
* juggling an account token for one repository and a project token for
|
|
467
|
+
* another) must call this again immediately before each authenticated call
|
|
468
|
+
* group, the same way `initRemoteConfig` does internally.
|
|
469
|
+
*/
|
|
470
|
+
declare function configureApiToken(auth: string | RemoteAuth): void;
|
|
437
471
|
/**
|
|
438
472
|
* Validates an API token by calling the authenticated user endpoint.
|
|
439
473
|
* Returns user info on success; caller should catch errors for invalid tokens.
|
|
@@ -447,7 +481,8 @@ declare function validateApiToken(token: string): Promise<{
|
|
|
447
481
|
* Fetches files individually ignored in Codacy Cloud for a repository.
|
|
448
482
|
* Uses cursor-based pagination capped at 10 pages (1000 files max) to avoid
|
|
449
483
|
* unbounded fetching for repositories with very large ignore lists.
|
|
450
|
-
* Requires `configureApiToken()` to have been called
|
|
484
|
+
* Requires `configureApiToken()` to have been called with an account token
|
|
485
|
+
* or a repository (project) token — this operation accepts either.
|
|
451
486
|
*/
|
|
452
487
|
declare function listIgnoredFiles(provider: string, org: string, repo: string): Promise<IgnoredFilesResult>;
|
|
453
488
|
|
|
@@ -469,8 +504,31 @@ declare function listIgnoredFiles(provider: string, org: string, repo: string):
|
|
|
469
504
|
* extensions/filenames against LANGUAGE_CONFIG. When `precomputedFiles` is
|
|
470
505
|
* provided, uses that list directly instead of running `git ls-files`.
|
|
471
506
|
* Returns languages sorted alphabetically for deterministic output.
|
|
507
|
+
*
|
|
508
|
+
* `exclude` (optional) drops files matching those globs before detection, so a
|
|
509
|
+
* language whose only files live in excluded paths is not reported. Every caller
|
|
510
|
+
* that turns the result into tool selection must pass the excludes `analyze`
|
|
511
|
+
* will apply — a language detected from a file `analyze` never reads produces a
|
|
512
|
+
* tool that analyzes zero files. Applied to `precomputedFiles` too (filtering is
|
|
513
|
+
* idempotent, so pre-filtered lists are safe to pass).
|
|
514
|
+
*/
|
|
515
|
+
declare function detectLanguages(repositoryRoot: string, precomputedFiles?: string[], exclude?: readonly string[]): Promise<Language[]>;
|
|
516
|
+
/**
|
|
517
|
+
* Options shared by the init modes that derive configuration from the local
|
|
518
|
+
* repository (`local`, `default`, `auto`).
|
|
472
519
|
*/
|
|
473
|
-
|
|
520
|
+
interface InitDiscoveryOptions {
|
|
521
|
+
/**
|
|
522
|
+
* The config currently on disk, when re-generating via `update-config`.
|
|
523
|
+
*
|
|
524
|
+
* Its `exclude` (global and per-tool) is unioned with the freshly-read
|
|
525
|
+
* `.codacy.yaml` to constrain re-discovery, so excludes the user hand-wrote
|
|
526
|
+
* into `codacy.config.json` — or that arrived from Codacy Cloud's
|
|
527
|
+
* ignored-files list — don't get re-populated with tools that analyze zero
|
|
528
|
+
* files. Omit for a fresh `init`, where only `.codacy.yaml` applies.
|
|
529
|
+
*/
|
|
530
|
+
existingConfig?: CodacyConfig;
|
|
531
|
+
}
|
|
474
532
|
/** Stats returned alongside the config from `initLocalConfig`. */
|
|
475
533
|
interface InitLocalStats {
|
|
476
534
|
/** Whether a .codacy.yaml file was found and its exclude paths were applied. */
|
|
@@ -482,7 +540,7 @@ interface InitLocalStats {
|
|
|
482
540
|
* that have a local configuration file present in the repository.
|
|
483
541
|
* If a .codacy.yaml file is present, its exclude paths are merged into the config.
|
|
484
542
|
*/
|
|
485
|
-
declare function initLocalConfig(repositoryRoot: string, adapters: Readonly<ToolAdapter>[]): Promise<{
|
|
543
|
+
declare function initLocalConfig(repositoryRoot: string, adapters: Readonly<ToolAdapter>[], options?: InitDiscoveryOptions): Promise<{
|
|
486
544
|
config: CodacyConfig;
|
|
487
545
|
stats: InitLocalStats;
|
|
488
546
|
}>;
|
|
@@ -507,7 +565,7 @@ interface InitDefaultStats {
|
|
|
507
565
|
*
|
|
508
566
|
* Returns both the config and stats so the caller can report what happened.
|
|
509
567
|
*/
|
|
510
|
-
declare function initDefaultConfig(repositoryRoot: string, adapters: Readonly<ToolAdapter>[]): Promise<{
|
|
568
|
+
declare function initDefaultConfig(repositoryRoot: string, adapters: Readonly<ToolAdapter>[], options?: InitDiscoveryOptions): Promise<{
|
|
511
569
|
config: CodacyConfig;
|
|
512
570
|
stats: InitDefaultStats;
|
|
513
571
|
}>;
|
|
@@ -534,6 +592,13 @@ interface InitRemoteStats {
|
|
|
534
592
|
* as unsupported (cloud-only) entries (subject to the trackability filter — deprecated and
|
|
535
593
|
* client-side/standalone-only tools are skipped).
|
|
536
594
|
*
|
|
595
|
+
* @param auth - Account token or repository (project) token — a repository token alone
|
|
596
|
+
* is enough for all four API calls this function makes, no login required. Also
|
|
597
|
+
* accepts a bare account-token string, for source compatibility with callers written
|
|
598
|
+
* against this function's original `apiToken: string` shape — this parameter used to
|
|
599
|
+
* be exactly that, and this is a published package (embedders like a VSCode extension
|
|
600
|
+
* or MCP server call it directly), so the old call shape must keep working unchanged.
|
|
601
|
+
* See {@link configureApiToken} for the exact accepted shapes and validation.
|
|
537
602
|
* @param onRemoteToolsFound - Optional callback invoked once after the list of enabled
|
|
538
603
|
* remote tools is fetched. Receives the total count of enabled tools and the count
|
|
539
604
|
* that have a registered local adapter. Fires before per-tool pattern fetching begins.
|
|
@@ -543,7 +608,7 @@ interface InitRemoteStats {
|
|
|
543
608
|
* @param onIgnoredFilesFetched - Optional callback invoked after cloud-ignored files are
|
|
544
609
|
* fetched. Receives the count and whether the 1000-file cap was reached.
|
|
545
610
|
*/
|
|
546
|
-
declare function initRemoteConfig(repositoryRoot: string, provider: string, organization: string, repositoryName: string, adapters: Readonly<ToolAdapter>[],
|
|
611
|
+
declare function initRemoteConfig(repositoryRoot: string, provider: string, organization: string, repositoryName: string, adapters: Readonly<ToolAdapter>[], auth: string | RemoteAuth, onRemoteToolsFound?: (totalEnabledTools: number, matchedAdapters: number) => void, onToolProcessed?: (displayName: string, patternCount: number, usesConfigFile: boolean) => void, onIgnoredFilesFetched?: (count: number, capped: boolean) => void): Promise<{
|
|
547
612
|
config: CodacyConfig;
|
|
548
613
|
stats: InitRemoteStats;
|
|
549
614
|
}>;
|
|
@@ -604,7 +669,7 @@ interface InitAutoStats {
|
|
|
604
669
|
* those patterns are gated on detected frameworks exactly like supported tools;
|
|
605
670
|
* tools without mappings have every committed pattern treated as universal.
|
|
606
671
|
*/
|
|
607
|
-
declare function initAutoConfig(repositoryRoot: string, adapters: Readonly<ToolAdapter>[], descriptors: AdapterDescriptor[], filters?: AutoFilters, onDiscoveryComplete?: (result: DiscoveryResult) => void, rawFilterString?: string, loadUnsupportedPatterns?: (toolId: string) => readonly PatternEntry[]): Promise<{
|
|
672
|
+
declare function initAutoConfig(repositoryRoot: string, adapters: Readonly<ToolAdapter>[], descriptors: AdapterDescriptor[], filters?: AutoFilters, onDiscoveryComplete?: (result: DiscoveryResult) => void, rawFilterString?: string, loadUnsupportedPatterns?: (toolId: string) => readonly PatternEntry[], options?: InitDiscoveryOptions): Promise<{
|
|
608
673
|
config: CodacyConfig;
|
|
609
674
|
stats: InitAutoStats;
|
|
610
675
|
}>;
|
|
@@ -666,6 +731,41 @@ declare function resolveEngineToAdapter(engineName: string, adapters: Readonly<T
|
|
|
666
731
|
* Returns a new config object (does not mutate the input).
|
|
667
732
|
*/
|
|
668
733
|
declare function applyCodacyYamlExcludes(config: CodacyConfig, yamlConfig: CodacyYamlConfig, adapters: Readonly<ToolAdapter>[], logger?: Logger): CodacyConfig;
|
|
734
|
+
/**
|
|
735
|
+
* The exclude patterns repository discovery must honor, resolved from every
|
|
736
|
+
* source that will also constrain `analyze`.
|
|
737
|
+
*/
|
|
738
|
+
interface DiscoveryExcludes {
|
|
739
|
+
/** Parsed `.codacy.yaml`, or null when the repository has none. Reused by `applyCodacyYamlExcludes` so the file is read once per init. */
|
|
740
|
+
yamlConfig: CodacyYamlConfig | null;
|
|
741
|
+
/** Global patterns — applied to every file-derived decision (languages, frameworks, tool selection). */
|
|
742
|
+
global: string[];
|
|
743
|
+
/** Per-adapter-ID patterns, applied on top of `global` when deciding whether that specific tool has files. */
|
|
744
|
+
perTool: Map<string, string[]>;
|
|
745
|
+
}
|
|
746
|
+
/**
|
|
747
|
+
* Resolves the exclude patterns that repository discovery must honor so that
|
|
748
|
+
* tool/language selection sees the same file set `analyze` will.
|
|
749
|
+
*
|
|
750
|
+
* Without this, discovery reads the raw `git ls-files` output while `analyze`
|
|
751
|
+
* reads that output minus `exclude` — so `init --auto` enables tools whose only
|
|
752
|
+
* evidence sits in excluded paths (e.g. language fixtures under
|
|
753
|
+
* `**\/test/fixtures/**`), and every one of them then receives zero files.
|
|
754
|
+
*
|
|
755
|
+
* Sources, unioned:
|
|
756
|
+
* - `.codacy.yaml` global `exclude_paths` → `global`
|
|
757
|
+
* - `.codacy.yaml` per-engine `exclude_paths` → `perTool` (engine names resolved
|
|
758
|
+
* via {@link resolveEngineToAdapter}; unresolvable names are skipped)
|
|
759
|
+
* - `existingConfig.exclude` / `existingConfig.tools[].exclude` → both, for
|
|
760
|
+
* `update-config`, so excludes the user hand-wrote into `codacy.config.json`
|
|
761
|
+
* (or that arrived from Codacy Cloud's ignored-files list) also constrain
|
|
762
|
+
* re-discovery
|
|
763
|
+
*
|
|
764
|
+
* `.codacy.yaml` is always re-read rather than trusted from the existing config,
|
|
765
|
+
* since it is the user-editable source of truth and may have changed since the
|
|
766
|
+
* config was generated.
|
|
767
|
+
*/
|
|
768
|
+
declare function resolveDiscoveryExcludes(repositoryRoot: string, adapters: Readonly<ToolAdapter>[], existingConfig?: CodacyConfig): Promise<DiscoveryExcludes>;
|
|
669
769
|
|
|
670
770
|
/**
|
|
671
771
|
* Computes pattern-level summary statistics for analysis results.
|
|
@@ -794,6 +894,7 @@ declare function createLogger(options?: LoggerOptions): Logger;
|
|
|
794
894
|
*
|
|
795
895
|
* All crypto uses Node.js built-in `crypto` — no external dependencies.
|
|
796
896
|
*/
|
|
897
|
+
|
|
797
898
|
/**
|
|
798
899
|
* Encrypts and saves an API token to ~/.codacy/credentials.
|
|
799
900
|
* Creates the ~/.codacy/ directory if it doesn't exist.
|
|
@@ -818,6 +919,41 @@ declare function deleteCredentials(): Promise<boolean>;
|
|
|
818
919
|
* 3. Throws with instructions if neither source has a token.
|
|
819
920
|
*/
|
|
820
921
|
declare function resolveApiToken(): Promise<string>;
|
|
922
|
+
/**
|
|
923
|
+
* Resolves auth for `init --remote` / `update-config --remote`: an explicit
|
|
924
|
+
* repository token (`repositoryToken` argument, or `CODACY_PROJECT_TOKEN`)
|
|
925
|
+
* wins outright — matching `upload`'s precedence for the same flag
|
|
926
|
+
* (`upload.ts:87-90`) — without even attempting to resolve an account token,
|
|
927
|
+
* so an explicitly-scoped run never pays the cost of loading a stored login
|
|
928
|
+
* it didn't ask for, and is never silently re-scoped to a broader token an
|
|
929
|
+
* ambient `CODACY_API_TOKEN` or prior `login` happens to leave lying around.
|
|
930
|
+
* Only when no repository token is given does this fall back to an account
|
|
931
|
+
* token, read the same way {@link resolveApiToken} does (env var, then
|
|
932
|
+
* stored credentials) — inlined here rather than calling it, so a missing
|
|
933
|
+
* account token falls through to the error below instead of throwing.
|
|
934
|
+
*/
|
|
935
|
+
declare function resolveRemoteAuth(repositoryToken?: string): Promise<RemoteAuth>;
|
|
936
|
+
|
|
937
|
+
/**
|
|
938
|
+
* Turning a raw manifest identifier into an entity.
|
|
939
|
+
*
|
|
940
|
+
* Classification is **scoped to the ecosystem the identifier came from**, with no
|
|
941
|
+
* global fallback. A fallback is the bug this module exists to prevent: with one
|
|
942
|
+
* name-keyed catalog, the sbt artifact `requests` (com.lihaoyi) matched PyPI's
|
|
943
|
+
* Requests, and any bare gem or crate name could borrow another language's
|
|
944
|
+
* package. An artifact id is only meaningful inside its own registry, so that is
|
|
945
|
+
* the only place it is looked up.
|
|
946
|
+
*/
|
|
947
|
+
|
|
948
|
+
/**
|
|
949
|
+
* Display names of every entity discovery can emit.
|
|
950
|
+
*
|
|
951
|
+
* Kept for consumers that report on the catalog. Note it is **not** the set of
|
|
952
|
+
* gating keys — those are entity keys ({@link getEntityProviders}) — precisely
|
|
953
|
+
* because display names are not unique: Angular 2+, AngularJS and AngularDart all
|
|
954
|
+
* display as "Angular".
|
|
955
|
+
*/
|
|
956
|
+
declare function getKnownDisplayNames(): Set<string>;
|
|
821
957
|
|
|
822
958
|
/**
|
|
823
959
|
* Repository discovery — scans a codebase and identifies languages, file patterns,
|
|
@@ -826,14 +962,30 @@ declare function resolveApiToken(): Promise<string>;
|
|
|
826
962
|
* The discover() function is the main entry point. It runs a 4-phase pipeline:
|
|
827
963
|
* 1. File discovery (extensions, notable files)
|
|
828
964
|
* 2. Language detection (reuses detectLanguages)
|
|
829
|
-
* 3. Manifest parsing (dependency extraction)
|
|
830
|
-
* 4.
|
|
965
|
+
* 3. Manifest parsing (dependency extraction, per owning ecosystem)
|
|
966
|
+
* 4. Classification (raw identifier → entity, scoped to that ecosystem)
|
|
967
|
+
*
|
|
968
|
+
* The static knowledge behind phases 3 and 4 lives in `./ecosystems/` (one module
|
|
969
|
+
* per package registry), `./signals.ts` and `./notable-files.ts`; the entity
|
|
970
|
+
* vocabulary itself is in `@codacy/tooling`.
|
|
831
971
|
*/
|
|
832
972
|
|
|
833
973
|
/** Options for the discover function. */
|
|
834
974
|
interface DiscoverOptions {
|
|
835
975
|
/** Skip dependency extraction from manifests (only detect files and languages). */
|
|
836
976
|
skipDependencies?: boolean;
|
|
977
|
+
/**
|
|
978
|
+
* Glob patterns to exclude from the scan, on top of `.gitignore`.
|
|
979
|
+
*
|
|
980
|
+
* Callers that feed discovery into configuration decisions **must** pass the
|
|
981
|
+
* same excludes `analyze` will apply (see `resolveDiscoveryExcludes` in
|
|
982
|
+
* `../codacy-yaml`). Otherwise discovery reports languages, frameworks, and
|
|
983
|
+
* libraries that only exist in excluded paths — e.g. a tool-orchestration
|
|
984
|
+
* monorepo whose per-language sample files all live under
|
|
985
|
+
* `**\/test/fixtures/**` looks like a 20-language polyglot repo, and every
|
|
986
|
+
* tool selected from those languages then analyzes zero files.
|
|
987
|
+
*/
|
|
988
|
+
exclude?: readonly string[];
|
|
837
989
|
}
|
|
838
990
|
/**
|
|
839
991
|
* Scans a repository and returns a structured report of languages, file patterns,
|
|
@@ -841,23 +993,6 @@ interface DiscoverOptions {
|
|
|
841
993
|
*/
|
|
842
994
|
declare function discover(repositoryRoot: string, options?: DiscoverOptions): Promise<DiscoveryResult>;
|
|
843
995
|
|
|
844
|
-
/**
|
|
845
|
-
* Discovery catalog — static knowledge base for the discover command.
|
|
846
|
-
*
|
|
847
|
-
* Contains manifest file parsers, a curated dependency classification catalog,
|
|
848
|
-
* and notable file detection rules. All parsers are pure functions that accept
|
|
849
|
-
* raw file content and return dependency name arrays. They never throw.
|
|
850
|
-
*/
|
|
851
|
-
|
|
852
|
-
/**
|
|
853
|
-
* Every display name discovery can emit from a dependency/file/package.json signal.
|
|
854
|
-
* This is the authoritative set a framework-mapping key must belong to (together
|
|
855
|
-
* with detected language names) for its patterns to ever gate on. The drift-guard
|
|
856
|
-
* test uses it to catch mapping keys that no signal can produce (e.g. a rename
|
|
857
|
-
* like react-intl → formatjs that updates the mapping but not the catalog).
|
|
858
|
-
*/
|
|
859
|
-
declare function getKnownDisplayNames(): Set<string>;
|
|
860
|
-
|
|
861
996
|
/**
|
|
862
997
|
* Git repository introspection helpers used by commands that need to know
|
|
863
998
|
* *where* they are (repository root) and *what* they are looking at (the current
|
|
@@ -902,6 +1037,10 @@ declare function resolveHeadCommit(repositoryRoot: string): string;
|
|
|
902
1037
|
* Codacy patterns). We normalize either format into a flat issue list and build the
|
|
903
1038
|
* payload directly.
|
|
904
1039
|
*
|
|
1040
|
+
* Issues from tools that group many findings under one pattern additionally carry
|
|
1041
|
+
* `sourceId` (e.g. Trivy's CVE id), gated on the adapter descriptor's
|
|
1042
|
+
* `needsSourceIdUpload` — see {@link buildPayloads}.
|
|
1043
|
+
*
|
|
905
1044
|
* ## Where it uploads
|
|
906
1045
|
*
|
|
907
1046
|
* The **legacy v2 API** (`https://api.codacy.com/2.0`), matching the Go CLI: one
|
|
@@ -933,6 +1072,12 @@ interface NormalizedIssue {
|
|
|
933
1072
|
message: string;
|
|
934
1073
|
/** Codacy level string (Info/Warning/High/Error for json; Info/Warning/Error for sarif). */
|
|
935
1074
|
level: string;
|
|
1075
|
+
/**
|
|
1076
|
+
* The tool's own finding id (e.g. a CVE), when the report carries one. Only
|
|
1077
|
+
* forwarded to the payload for tools whose descriptor sets
|
|
1078
|
+
* `needsSourceIdUpload` — see {@link buildPayloads}.
|
|
1079
|
+
*/
|
|
1080
|
+
sourceId?: string;
|
|
936
1081
|
}
|
|
937
1082
|
/** Authentication + routing for the upload. */
|
|
938
1083
|
type UploadAuth = {
|
|
@@ -995,6 +1140,8 @@ interface PayloadIssue {
|
|
|
995
1140
|
line: number;
|
|
996
1141
|
};
|
|
997
1142
|
};
|
|
1143
|
+
/** Present only for tools that need it; see {@link buildPayloads}. */
|
|
1144
|
+
sourceId?: string;
|
|
998
1145
|
}
|
|
999
1146
|
/**
|
|
1000
1147
|
* Resolves the base URL for the legacy v2 results API. Defaults to Codacy SaaS;
|
|
@@ -1012,8 +1159,17 @@ declare function parseReport(fileContents: string): NormalizedIssue[];
|
|
|
1012
1159
|
* Builds one v2 payload per tool, grouping issues by file. `resolveShortName` maps
|
|
1013
1160
|
* our internal tool id to the Codacy tool short-name expected in the `tool` field
|
|
1014
1161
|
* (which becomes an S3 key segment consumed downstream).
|
|
1162
|
+
*
|
|
1163
|
+
* `needsSourceId` decides, per tool, whether `sourceId` is included on each issue —
|
|
1164
|
+
* mirroring the Go CLI, which gates it on the tool's `needs_source_id_upload`
|
|
1165
|
+
* manifest flag. This is not cosmetic: `sourceId` is one of the four inputs to
|
|
1166
|
+
* Codacy's deterministic result UUID, so sending it for a tool the cloud engine
|
|
1167
|
+
* doesn't send it for would give the same finding a different UUID. Tools that
|
|
1168
|
+
* don't need it omit the field entirely rather than sending an empty string.
|
|
1169
|
+
* Defaults to never including it, so a caller that hasn't opted in can't change
|
|
1170
|
+
* UUIDs by accident.
|
|
1015
1171
|
*/
|
|
1016
|
-
declare function buildPayloads(issues: NormalizedIssue[], resolveShortName: (toolId: string) => string): ToolPayload[];
|
|
1172
|
+
declare function buildPayloads(issues: NormalizedIssue[], resolveShortName: (toolId: string) => string, needsSourceId?: (toolId: string) => boolean): ToolPayload[];
|
|
1017
1173
|
/**
|
|
1018
1174
|
* Uploads an analysis report to Codacy. Reads and parses the report, resolves tool
|
|
1019
1175
|
* short-names, POSTs one `issuesRemoteResults` per tool, then a single `resultsFinal`.
|
|
@@ -1028,4 +1184,4 @@ declare function buildPayloads(issues: NormalizedIssue[], resolveShortName: (too
|
|
|
1028
1184
|
*/
|
|
1029
1185
|
declare function uploadReport(options: UploadOptions): Promise<UploadResult>;
|
|
1030
1186
|
|
|
1031
|
-
export { type AdapterFactory, type AnalyzeOptions, type AutoFilters, type CategoryFilter, type CodacyYamlConfig, type CodacyYamlEngineConfig, type ConfigOperation, type DiscoverOptions, type ExecutionMode, type IgnoredFilesResult, type InitAutoStats, type InitDefaultStats, type InitLocalStats, type InitRemoteStats, type LoggerOptions, type MergeOptions, type NormalizedIssue, type PatternMetadataLookup, type SeverityFilter, type UploadAuth, type UploadOptions, type UploadResult, analyze, applyCodacyYamlExcludes, applyConfigOperation, buildPayloads, buildToolConfig, clearAdapters, computePatternSummary, configureApiToken, createCodacyConfig, createLogger, createNullLogger, deleteCredentials, detectLanguages, diffConfigs, discover, formatOutput, formatTextSummary, getAdapter, getKnownDisplayNames, getRegisteredAdapters, getRegisteredDescriptors, initAutoConfig, initContainerConfig, initDefaultConfig, initLocalConfig, initRemoteConfig, intersectConfigs, listDiffFiles, listIgnoredFiles, listPrFiles, listStagedFiles, loadCredentials, mergeConfigs, parseAutoFilters, parseReport, pruneEmptyTools, readBaselineConfig, readCodacyConfig, readCodacyYaml, registerAdapter, registerLazyAdapter, registerUnsupportedTool, resolveApiToken, resolveBaselinePath, resolveConfigPath, resolveEngineToAdapter, resolveHeadCommit, resolveRepositoryRoot, resolveResultsApiBaseUrl, rotateLogFiles, saveCredentials, updateConfigIncremental, uploadReport, validateApiToken, writeBaselineConfig, writeCodacyConfig, writeCodacyConfigFile };
|
|
1187
|
+
export { type AdapterFactory, type AnalyzeOptions, type AutoFilters, type CategoryFilter, type CodacyYamlConfig, type CodacyYamlEngineConfig, type ConfigOperation, type DiscoverOptions, type DiscoveryExcludes, type ExecutionMode, type IgnoredFilesResult, type InitAutoStats, type InitDefaultStats, type InitDiscoveryOptions, type InitLocalStats, type InitRemoteStats, type LoggerOptions, type MergeOptions, type NormalizedIssue, type PatternMetadataLookup, type RemoteAuth, type SeverityFilter, type UploadAuth, type UploadOptions, type UploadResult, analyze, applyCodacyYamlExcludes, applyConfigOperation, buildPayloads, buildToolConfig, clearAdapters, computePatternSummary, configureApiToken, createCodacyConfig, createLogger, createNullLogger, deleteCredentials, detectLanguages, diffConfigs, discover, formatOutput, formatTextSummary, getAdapter, getKnownDisplayNames, getRegisteredAdapters, getRegisteredDescriptors, initAutoConfig, initContainerConfig, initDefaultConfig, initLocalConfig, initRemoteConfig, intersectConfigs, listDiffFiles, listIgnoredFiles, listPrFiles, listStagedFiles, loadCredentials, mergeConfigs, parseAutoFilters, parseReport, pruneEmptyTools, readBaselineConfig, readCodacyConfig, readCodacyYaml, registerAdapter, registerLazyAdapter, registerUnsupportedTool, resolveApiToken, resolveBaselinePath, resolveConfigPath, resolveDiscoveryExcludes, resolveEngineToAdapter, resolveHeadCommit, resolveRemoteAuth, resolveRepositoryRoot, resolveResultsApiBaseUrl, rotateLogFiles, saveCredentials, updateConfigIncremental, uploadReport, validateApiToken, writeBaselineConfig, writeCodacyConfig, writeCodacyConfigFile };
|