@repometry/core 0.3.0 → 0.5.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@repometry/core",
3
- "version": "0.3.0",
3
+ "version": "0.5.0",
4
4
  "description": "The Repometry plugin API and inspection engine",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -1,11 +1,12 @@
1
1
  import type { DataContract } from './plugin.js';
2
+ import type { recoveredSyntax } from '../model/code-structure.js';
2
3
  import type { CodeStructure as StoredStructure, StructuralObservation as StoredObservation } from '../model/code-structure.js';
3
4
  import type { Finding as StoredFinding, FindingResult as StoredFindings } from '../model/finding.js';
4
5
  import type { PluginCategory } from '../model/inspection-category.js';
5
6
  export type StructuralObservation = Omit<StoredObservation, 'rule'> & {
6
7
  readonly check: StoredObservation['rule'];
7
8
  };
8
- export type CodeStructure = Omit<StoredStructure, 'observations'> & {
9
+ export type CodeStructure = Omit<StoredStructure, 'observations' | typeof recoveredSyntax> & {
9
10
  readonly observations?: readonly StructuralObservation[];
10
11
  };
11
12
  export type Finding = Omit<StoredFinding, 'tool' | 'rule' | 'category'> & {
@@ -5,6 +5,12 @@ declare const structuralCheckIds: readonly ['function-parameters', 'return-state
5
5
  export type StructuralCheck = typeof structuralCheckIds[number];
6
6
  export declare const structureMeasures: readonly ['functions', 'cyclomaticComplexity', 'cognitiveComplexity', 'classes', 'commentLines', 'codeLines', 'duplication', 'structuralRules'];
7
7
  export type StructureMeasure = typeof structureMeasures[number];
8
+ export declare const recoveredSyntax: unique symbol;
9
+ export interface RecoveryDetails {
10
+ readonly reason: string;
11
+ readonly location: string;
12
+ readonly omitted: number;
13
+ }
8
14
  export interface FunctionComplexity {
9
15
  /** Functions without a name omit this field. Reports display them as (anonymous). */
10
16
  readonly name?: string;
@@ -22,6 +28,7 @@ export interface StructuralObservation {
22
28
  readonly anchor?: string;
23
29
  }
24
30
  export interface CodeStructure {
31
+ readonly [recoveredSyntax]?: RecoveryDetails;
25
32
  readonly path: string;
26
33
  readonly lines: number;
27
34
  readonly functions?: number;
@@ -7,6 +7,9 @@ const structuralCheckIds = [
7
7
  ];
8
8
  export const structureMeasures = ['functions', 'cyclomaticComplexity', 'cognitiveComplexity', 'classes',
9
9
  'commentLines', 'codeLines', 'duplication', 'structuralRules'];
10
+ // The CLI and a separately installed parser can load different instances of this package.
11
+ // The operation cache excludes symbol-keyed data, so the transient marker never lands on disk.
12
+ export const recoveredSyntax = Symbol.for('repometry.internal.recovered-syntax');
10
13
  const checkIds = new Set(structuralCheckIds);
11
14
  function isCount(value) {
12
15
  return typeof value === 'number' && Number.isSafeInteger(value) && value >= 0;
@@ -30,6 +30,7 @@ export const fileTypes = [
30
30
  { id: 'cpp', label: 'C++', color: '#f34b7d', extensions: ['.cc', '.cpp', '.cxx', '.hpp', '.hh'], syntax: cppSyntax },
31
31
  { id: 'swift', label: 'Swift', color: '#f05138', extensions: ['.swift'] },
32
32
  { id: 'scala', label: 'Scala', color: '#c22d40', extensions: ['.scala'] },
33
+ { id: 'elixir', label: 'Elixir', color: '#6e4a7e', extensions: ['.ex', '.exs'] },
33
34
  { id: 'vue', label: 'Vue', color: '#41b883', extensions: ['.vue'] },
34
35
  { id: 'svelte', label: 'Svelte', color: '#ff3e00', extensions: ['.svelte'] },
35
36
  { id: 'text', label: 'Plain text', color: '#7b8794', extensions: ['.txt'] },
@@ -4,6 +4,7 @@ import type { IgnoredFinding } from './ignore-rule.js';
4
4
  import type { PluginData } from './plugin-data.js';
5
5
  import type { Subject } from './source.js';
6
6
  export declare const reportSchema = "urn:repometry:schema:report:2";
7
+ export declare const recoveredSourceOperation = "source/recovered";
7
8
  export interface Diagnostic {
8
9
  readonly operation: string;
9
10
  readonly state: 'failed' | 'blocked' | 'partial';
@@ -28,6 +29,7 @@ export interface Report {
28
29
  readonly scope: {
29
30
  readonly files: number;
30
31
  readonly parsed: number;
32
+ readonly recovered?: number;
31
33
  };
32
34
  readonly status: 'complete' | 'partial' | 'not-applicable';
33
35
  readonly measurements: readonly Measurement[];
@@ -1,4 +1,5 @@
1
1
  export const reportSchema = 'urn:repometry:schema:report:2';
2
+ export const recoveredSourceOperation = 'source/recovered';
2
3
  export function validSubjectId(kind, id) {
3
4
  return /^[a-f0-9]{64}$/.test(id) || (kind === 'commit' && /^[a-f0-9]{40}$/.test(id));
4
5
  }