Found by dogfooding on nuwayze: `pipe queries lib` from the repo root
failed with
no resolved package graph at .dart_tool/package_config.json
remedy: run `flutter pub get` or `dart pub get` in .../nuwayze-w3/lib
It failed even with the package resolved, because the path was taken
as the project root: pipe looked for lib/.dart_tool/package_config.json,
which never exists, and the remedy sent the user to run pub get in a
directory that has no pubspec.
enclosingPackage() (project.dart) splits a path into the package that
contains it (the path itself when it holds a pubspec.yaml, else the
nearest ancestor that does) and the directory it names under that
root. `pipe queries` loads the package root and scans only that
directory, so `pipe queries lib/services` is `--dir lib/services` on
the package; an explicit --dir with such a path is relative to it.
Without a resolved graph the error now names the package root.
loadProject's own remedy uses the same lookup, so `pipe check lib`
(and the other commands, which still take the path as the root) now
says the path is inside the package at <root> and suggests passing
that with `--dir lib`, instead of pub get in lib.
Tests: enclosingPackage on a root, a nested directory, a nested
package and a missing path; loadProject's remedy for a directory
inside a package; and `pipe queries` on the fixture's lib/data
(root reported as the package, one file discovered), with
`lib --dir data`, and on an unresolved package where the remedy names
the root, not lib.
On nuwayze-w3: `pipe queries lib` exits 0 with 313 queries over 847
files, identical to `pipe queries .`; `pipe queries lib/services` scans
161 files and every one of its 212 queries sits under lib/services.
233 tests pass.
96 lines
2.7 KiB
Dart
96 lines
2.7 KiB
Dart
/// pipe — static state-flow analysis for Dart and Flutter applications.
|
|
library;
|
|
|
|
export 'src/analysis.dart' show Analyzer, FileOutcome, ScanCoverage;
|
|
export 'src/errors.dart' show PipeException;
|
|
export 'src/firestore_facts.dart'
|
|
show
|
|
FirestoreModel,
|
|
QueryComposite,
|
|
QueryFilter,
|
|
QueryLimit,
|
|
QueryOrder,
|
|
QueryRecord,
|
|
UnresolvedFirestoreUri,
|
|
buildFirestoreModel,
|
|
queryOperators,
|
|
safeNamePattern;
|
|
export 'src/gateway_facts.dart'
|
|
show AdapterMethod, AdapterType, ArgRef, QueryAdapter, parseAdapterConfig;
|
|
export 'src/guide.dart'
|
|
show
|
|
Guidance,
|
|
buildGuidance,
|
|
checkCommand,
|
|
emitToYams,
|
|
findYams,
|
|
gitHead,
|
|
rankFindings,
|
|
ruleEpithet,
|
|
ruleFix,
|
|
ruleFixFor,
|
|
ruleGlossary,
|
|
yamsMetadata;
|
|
export 'src/index.dart'
|
|
show
|
|
DiagnosticRecord,
|
|
IndexReport,
|
|
ResolutionRun,
|
|
buildIndexReport,
|
|
resolveProject,
|
|
runIndex;
|
|
export 'src/model.dart'
|
|
show DeclarationInfo, FileModel, ProjectModel, buildProjectModel;
|
|
export 'src/pipeline.dart' show ProjectAnalysis, analyzeProject;
|
|
export 'src/facts.dart';
|
|
export 'src/provider_rules.dart' show providerRuleNote;
|
|
export 'src/recall.dart'
|
|
show RecallCase, RecallOutcome, RecallReport, loadRecallCases, runRecall;
|
|
export 'src/project.dart'
|
|
show PackageTarget, Project, enclosingPackage, loadProject;
|
|
export 'src/sdk.dart' show SdkResolution, resolveSdk;
|
|
export 'src/rules.dart'
|
|
show
|
|
BaselineEntry,
|
|
Finding,
|
|
FindingReport,
|
|
PipeSeverity,
|
|
FixPolicy,
|
|
allRules,
|
|
decodeBaseline,
|
|
decodeBaselineEntries,
|
|
encodeBaseline,
|
|
ruleDeadHandler,
|
|
ruleEmittedNotRendered,
|
|
ruleEventWithoutHandler,
|
|
ruleLoadingFlagNotReset,
|
|
ruleLoadingNotReset,
|
|
ruleNotifierInert,
|
|
ruleNotifierFieldUnread,
|
|
ruleNotifierNeverNotifies,
|
|
ruleProviderCreatedInBuild,
|
|
ruleProviderReadInBuild,
|
|
ruleRiverpodAsyncGap,
|
|
ruleRenderedNotEmitted,
|
|
runChecks;
|
|
export 'src/state_flow.dart'
|
|
show
|
|
EmissionSite,
|
|
EventDispatch,
|
|
EventHandler,
|
|
EventUnion,
|
|
FlagState,
|
|
RenderBranch,
|
|
RenderSite,
|
|
StateFlow,
|
|
StateUnion,
|
|
StateVariant,
|
|
UnionCoverage,
|
|
UnionStyle,
|
|
buildStateFlow,
|
|
stateFlowFromJson;
|
|
export 'src/state_flow.dart'
|
|
show RiverpodGap, RiverpodModel, RiverpodProvider, RiverpodSite;
|
|
export 'src/suggest.dart' show FilePlan, FixAction, WorkPlan, buildWorkPlan;
|
|
export 'src/verify.dart'
|
|
show VerificationReport, verifyAgainstBaseline, verifyAnalysis;
|