repopo 0.10.0 → 0.13.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/CHANGELOG.md +113 -0
- package/README.md +76 -77
- package/THIRD-PARTY-LICENSES.txt +232 -14
- package/bin/dev.js +5 -1
- package/esm/adapters/fluidFramework.d.ts +13 -9
- package/esm/adapters/fluidFramework.d.ts.map +1 -1
- package/esm/adapters/fluidFramework.js +20 -43
- package/esm/adapters/fluidFramework.js.map +1 -1
- package/esm/api.d.ts +64 -1
- package/esm/api.d.ts.map +1 -1
- package/esm/api.js +17 -1
- package/esm/api.js.map +1 -1
- package/esm/baseCommand.d.ts +1 -1
- package/esm/baseCommand.d.ts.map +1 -1
- package/esm/baseCommand.js +7 -10
- package/esm/baseCommand.js.map +1 -1
- package/esm/commands/check-native.d.ts +25 -0
- package/esm/commands/check-native.d.ts.map +1 -0
- package/esm/commands/check-native.js +156 -0
- package/esm/commands/check-native.js.map +1 -0
- package/esm/commands/check.d.ts +7 -34
- package/esm/commands/check.d.ts.map +1 -1
- package/esm/commands/check.js +76 -265
- package/esm/commands/check.js.map +1 -1
- package/esm/commands/list.d.ts.map +1 -1
- package/esm/commands/list.js +6 -6
- package/esm/commands/list.js.map +1 -1
- package/esm/concurrency.d.ts +3 -0
- package/esm/concurrency.d.ts.map +1 -0
- package/esm/concurrency.js +8 -0
- package/esm/concurrency.js.map +1 -0
- package/esm/config.d.ts +5 -39
- package/esm/config.d.ts.map +1 -1
- package/esm/config.js +3 -7
- package/esm/config.js.map +1 -1
- package/esm/context.d.ts +20 -3
- package/esm/context.d.ts.map +1 -1
- package/esm/context.js +18 -1
- package/esm/context.js.map +1 -1
- package/esm/executionContractError.d.ts +4 -0
- package/esm/executionContractError.d.ts.map +1 -0
- package/esm/executionContractError.js +4 -0
- package/esm/executionContractError.js.map +1 -0
- package/esm/fileCache.d.ts +12 -0
- package/esm/fileCache.d.ts.map +1 -0
- package/esm/fileCache.js +37 -0
- package/esm/fileCache.js.map +1 -0
- package/esm/filePaths.d.ts +2 -0
- package/esm/filePaths.d.ts.map +1 -0
- package/esm/filePaths.js +9 -0
- package/esm/filePaths.js.map +1 -0
- package/esm/generators.d.ts +0 -20
- package/esm/generators.d.ts.map +1 -1
- package/esm/generators.js.map +1 -1
- package/esm/index.d.ts +3 -11
- package/esm/index.d.ts.map +1 -1
- package/esm/index.js +3 -14
- package/esm/index.js.map +1 -1
- package/esm/makePolicy.d.ts +26 -79
- package/esm/makePolicy.d.ts.map +1 -1
- package/esm/makePolicy.js +51 -95
- package/esm/makePolicy.js.map +1 -1
- package/esm/perf.d.ts +10 -2
- package/esm/perf.d.ts.map +1 -1
- package/esm/perf.js +10 -9
- package/esm/perf.js.map +1 -1
- package/esm/policies/CargoLicenceValidated.d.ts +41 -0
- package/esm/policies/CargoLicenceValidated.d.ts.map +1 -0
- package/esm/policies/CargoLicenceValidated.js +47 -0
- package/esm/policies/CargoLicenceValidated.js.map +1 -0
- package/esm/policies/CargoLintsConfigured.d.ts +30 -0
- package/esm/policies/CargoLintsConfigured.d.ts.map +1 -0
- package/esm/policies/CargoLintsConfigured.js +65 -0
- package/esm/policies/CargoLintsConfigured.js.map +1 -0
- package/esm/policies/CargoLockPolicy.d.ts +34 -0
- package/esm/policies/CargoLockPolicy.d.ts.map +1 -0
- package/esm/policies/CargoLockPolicy.js +61 -0
- package/esm/policies/CargoLockPolicy.js.map +1 -0
- package/esm/policies/CargoTomlRequired.d.ts +34 -0
- package/esm/policies/CargoTomlRequired.d.ts.map +1 -0
- package/esm/policies/CargoTomlRequired.js +77 -0
- package/esm/policies/CargoTomlRequired.js.map +1 -0
- package/esm/policies/CargoTomlSorted.d.ts +20 -0
- package/esm/policies/CargoTomlSorted.d.ts.map +1 -0
- package/esm/policies/CargoTomlSorted.js +168 -0
- package/esm/policies/CargoTomlSorted.js.map +1 -0
- package/esm/policies/ConditionalScripts.d.ts +10 -8
- package/esm/policies/ConditionalScripts.d.ts.map +1 -1
- package/esm/policies/ConditionalScripts.js +27 -24
- package/esm/policies/ConditionalScripts.js.map +1 -1
- package/esm/policies/ExactScripts.d.ts +8 -6
- package/esm/policies/ExactScripts.d.ts.map +1 -1
- package/esm/policies/ExactScripts.js +18 -20
- package/esm/policies/ExactScripts.js.map +1 -1
- package/esm/policies/GleamDepVersions.d.ts +25 -0
- package/esm/policies/GleamDepVersions.d.ts.map +1 -0
- package/esm/policies/GleamDepVersions.js +67 -0
- package/esm/policies/GleamDepVersions.js.map +1 -0
- package/esm/policies/GleamDocExists.d.ts +24 -0
- package/esm/policies/GleamDocExists.d.ts.map +1 -0
- package/esm/policies/GleamDocExists.js +39 -0
- package/esm/policies/GleamDocExists.js.map +1 -0
- package/esm/policies/GleamInternalModulesConfigured.d.ts +21 -0
- package/esm/policies/GleamInternalModulesConfigured.d.ts.map +1 -0
- package/esm/policies/GleamInternalModulesConfigured.js +32 -0
- package/esm/policies/GleamInternalModulesConfigured.js.map +1 -0
- package/esm/policies/GleamLicenceConfigured.d.ts +29 -0
- package/esm/policies/GleamLicenceConfigured.d.ts.map +1 -0
- package/esm/policies/GleamLicenceConfigured.js +36 -0
- package/esm/policies/GleamLicenceConfigured.js.map +1 -0
- package/esm/policies/GleamManifestCommitted.d.ts +16 -0
- package/esm/policies/GleamManifestCommitted.d.ts.map +1 -0
- package/esm/policies/GleamManifestCommitted.js +27 -0
- package/esm/policies/GleamManifestCommitted.js.map +1 -0
- package/esm/policies/GleamMonorepoConsistency.d.ts +38 -0
- package/esm/policies/GleamMonorepoConsistency.d.ts.map +1 -0
- package/esm/policies/GleamMonorepoConsistency.js +74 -0
- package/esm/policies/GleamMonorepoConsistency.js.map +1 -0
- package/esm/policies/GleamNameRestrictions.d.ts +25 -0
- package/esm/policies/GleamNameRestrictions.d.ts.map +1 -0
- package/esm/policies/GleamNameRestrictions.js +44 -0
- package/esm/policies/GleamNameRestrictions.js.map +1 -0
- package/esm/policies/GleamNoPathDepsInPublished.d.ts +22 -0
- package/esm/policies/GleamNoPathDepsInPublished.d.ts.map +1 -0
- package/esm/policies/GleamNoPathDepsInPublished.js +43 -0
- package/esm/policies/GleamNoPathDepsInPublished.js.map +1 -0
- package/esm/policies/GleamPathDepsValid.d.ts +9 -0
- package/esm/policies/GleamPathDepsValid.d.ts.map +1 -0
- package/esm/policies/GleamPathDepsValid.js +59 -0
- package/esm/policies/GleamPathDepsValid.js.map +1 -0
- package/esm/policies/GleamProjectStructure.d.ts +32 -0
- package/esm/policies/GleamProjectStructure.d.ts.map +1 -0
- package/esm/policies/GleamProjectStructure.js +32 -0
- package/esm/policies/GleamProjectStructure.js.map +1 -0
- package/esm/policies/GleamSharedDependencyVersions.d.ts +37 -0
- package/esm/policies/GleamSharedDependencyVersions.d.ts.map +1 -0
- package/esm/policies/GleamSharedDependencyVersions.js +101 -0
- package/esm/policies/GleamSharedDependencyVersions.js.map +1 -0
- package/esm/policies/GleamTomlRequired.d.ts +30 -0
- package/esm/policies/GleamTomlRequired.d.ts.map +1 -0
- package/esm/policies/GleamTomlRequired.js +37 -0
- package/esm/policies/GleamTomlRequired.js.map +1 -0
- package/esm/policies/GleamTomlSorted.d.ts +20 -0
- package/esm/policies/GleamTomlSorted.d.ts.map +1 -0
- package/esm/policies/GleamTomlSorted.js +157 -0
- package/esm/policies/GleamTomlSorted.js.map +1 -0
- package/esm/policies/GleamVersionConstraint.d.ts +20 -0
- package/esm/policies/GleamVersionConstraint.d.ts.map +1 -0
- package/esm/policies/GleamVersionConstraint.js +68 -0
- package/esm/policies/GleamVersionConstraint.js.map +1 -0
- package/esm/policies/HtmlFileHeaders.d.ts +4 -2
- package/esm/policies/HtmlFileHeaders.d.ts.map +1 -1
- package/esm/policies/HtmlFileHeaders.js +2 -2
- package/esm/policies/HtmlFileHeaders.js.map +1 -1
- package/esm/policies/JsTsFileHeaders.d.ts +4 -2
- package/esm/policies/JsTsFileHeaders.d.ts.map +1 -1
- package/esm/policies/JsTsFileHeaders.js +1 -1
- package/esm/policies/JsTsFileHeaders.js.map +1 -1
- package/esm/policies/LicenseFileExists.d.ts +10 -4
- package/esm/policies/LicenseFileExists.d.ts.map +1 -1
- package/esm/policies/LicenseFileExists.js +27 -20
- package/esm/policies/LicenseFileExists.js.map +1 -1
- package/esm/policies/MutuallyExclusiveScripts.d.ts +8 -6
- package/esm/policies/MutuallyExclusiveScripts.d.ts.map +1 -1
- package/esm/policies/MutuallyExclusiveScripts.js +9 -13
- package/esm/policies/MutuallyExclusiveScripts.js.map +1 -1
- package/esm/policies/NoBuildDirectory.d.ts +15 -0
- package/esm/policies/NoBuildDirectory.d.ts.map +1 -0
- package/esm/policies/NoBuildDirectory.js +24 -0
- package/esm/policies/NoBuildDirectory.js.map +1 -0
- package/esm/policies/NoJsFileExtensions.d.ts +9 -3
- package/esm/policies/NoJsFileExtensions.d.ts.map +1 -1
- package/esm/policies/NoJsFileExtensions.js +9 -14
- package/esm/policies/NoJsFileExtensions.js.map +1 -1
- package/esm/policies/NoLargeBinaryFiles.d.ts +9 -4
- package/esm/policies/NoLargeBinaryFiles.d.ts.map +1 -1
- package/esm/policies/NoLargeBinaryFiles.js +10 -16
- package/esm/policies/NoLargeBinaryFiles.js.map +1 -1
- package/esm/policies/NoPrivateWorkspaceDependencies.d.ts +10 -6
- package/esm/policies/NoPrivateWorkspaceDependencies.d.ts.map +1 -1
- package/esm/policies/NoPrivateWorkspaceDependencies.js +12 -14
- package/esm/policies/NoPrivateWorkspaceDependencies.js.map +1 -1
- package/esm/policies/NoTargetArtifacts.d.ts +14 -0
- package/esm/policies/NoTargetArtifacts.d.ts.map +1 -0
- package/esm/policies/NoTargetArtifacts.js +37 -0
- package/esm/policies/NoTargetArtifacts.js.map +1 -0
- package/esm/policies/NoUnsafeWithoutJustification.d.ts +31 -0
- package/esm/policies/NoUnsafeWithoutJustification.d.ts.map +1 -0
- package/esm/policies/NoUnsafeWithoutJustification.js +79 -0
- package/esm/policies/NoUnsafeWithoutJustification.js.map +1 -0
- package/esm/policies/NoWildcardDependencies.d.ts +30 -0
- package/esm/policies/NoWildcardDependencies.d.ts.map +1 -0
- package/esm/policies/NoWildcardDependencies.js +83 -0
- package/esm/policies/NoWildcardDependencies.js.map +1 -0
- package/esm/policies/PackageAllowedScopes.d.ts +9 -5
- package/esm/policies/PackageAllowedScopes.d.ts.map +1 -1
- package/esm/policies/PackageAllowedScopes.js +15 -16
- package/esm/policies/PackageAllowedScopes.js.map +1 -1
- package/esm/policies/PackageEsmType.d.ts +7 -5
- package/esm/policies/PackageEsmType.d.ts.map +1 -1
- package/esm/policies/PackageEsmType.js +38 -36
- package/esm/policies/PackageEsmType.js.map +1 -1
- package/esm/policies/PackageFolderName.d.ts +8 -6
- package/esm/policies/PackageFolderName.d.ts.map +1 -1
- package/esm/policies/PackageFolderName.js +13 -16
- package/esm/policies/PackageFolderName.js.map +1 -1
- package/esm/policies/PackageJsonProperties.d.ts +5 -3
- package/esm/policies/PackageJsonProperties.d.ts.map +1 -1
- package/esm/policies/PackageJsonProperties.js +18 -21
- package/esm/policies/PackageJsonProperties.js.map +1 -1
- package/esm/policies/PackageJsonRepoDirectoryProperty.d.ts +2 -7
- package/esm/policies/PackageJsonRepoDirectoryProperty.d.ts.map +1 -1
- package/esm/policies/PackageJsonRepoDirectoryProperty.js +29 -42
- package/esm/policies/PackageJsonRepoDirectoryProperty.js.map +1 -1
- package/esm/policies/PackageJsonSorted.d.ts +2 -2
- package/esm/policies/PackageJsonSorted.d.ts.map +1 -1
- package/esm/policies/PackageJsonSorted.js +51 -31
- package/esm/policies/PackageJsonSorted.js.map +1 -1
- package/esm/policies/PackageLicense.d.ts +4 -4
- package/esm/policies/PackageLicense.d.ts.map +1 -1
- package/esm/policies/PackageLicense.js +32 -54
- package/esm/policies/PackageLicense.js.map +1 -1
- package/esm/policies/PackagePrivateField.d.ts +12 -8
- package/esm/policies/PackagePrivateField.d.ts.map +1 -1
- package/esm/policies/PackagePrivateField.js +34 -25
- package/esm/policies/PackagePrivateField.js.map +1 -1
- package/esm/policies/PackageReadme.d.ts +6 -5
- package/esm/policies/PackageReadme.d.ts.map +1 -1
- package/esm/policies/PackageReadme.js +24 -61
- package/esm/policies/PackageReadme.js.map +1 -1
- package/esm/policies/PackageScripts.d.ts +26 -22
- package/esm/policies/PackageScripts.d.ts.map +1 -1
- package/esm/policies/PackageScripts.js +42 -38
- package/esm/policies/PackageScripts.js.map +1 -1
- package/esm/policies/PackageTestScripts.d.ts +10 -6
- package/esm/policies/PackageTestScripts.d.ts.map +1 -1
- package/esm/policies/PackageTestScripts.js +17 -19
- package/esm/policies/PackageTestScripts.js.map +1 -1
- package/esm/policies/PublicApiDocumented.d.ts +21 -0
- package/esm/policies/PublicApiDocumented.d.ts.map +1 -0
- package/esm/policies/PublicApiDocumented.js +38 -0
- package/esm/policies/PublicApiDocumented.js.map +1 -0
- package/esm/policies/RequiredGitignorePatterns.d.ts +11 -4
- package/esm/policies/RequiredGitignorePatterns.d.ts.map +1 -1
- package/esm/policies/RequiredGitignorePatterns.js +29 -36
- package/esm/policies/RequiredGitignorePatterns.js.map +1 -1
- package/esm/policies/RequiredScripts.d.ts +9 -7
- package/esm/policies/RequiredScripts.d.ts.map +1 -1
- package/esm/policies/RequiredScripts.js +27 -26
- package/esm/policies/RequiredScripts.js.map +1 -1
- package/esm/policies/RustDocExists.d.ts +24 -0
- package/esm/policies/RustDocExists.d.ts.map +1 -0
- package/esm/policies/RustDocExists.js +49 -0
- package/esm/policies/RustDocExists.js.map +1 -0
- package/esm/policies/RustToolchainExists.d.ts +27 -0
- package/esm/policies/RustToolchainExists.d.ts.map +1 -0
- package/esm/policies/RustToolchainExists.js +28 -0
- package/esm/policies/RustToolchainExists.js.map +1 -0
- package/esm/policies/RustfmtConfigExists.d.ts +27 -0
- package/esm/policies/RustfmtConfigExists.d.ts.map +1 -0
- package/esm/policies/RustfmtConfigExists.js +28 -0
- package/esm/policies/RustfmtConfigExists.js.map +1 -0
- package/esm/policies/ScriptContains.d.ts +9 -7
- package/esm/policies/ScriptContains.d.ts.map +1 -1
- package/esm/policies/ScriptContains.js +9 -13
- package/esm/policies/ScriptContains.js.map +1 -1
- package/esm/policies/SharedDependencyVersions.d.ts +29 -0
- package/esm/policies/SharedDependencyVersions.d.ts.map +1 -0
- package/esm/policies/SharedDependencyVersions.js +143 -0
- package/esm/policies/SharedDependencyVersions.js.map +1 -0
- package/esm/policies/WorkspaceInheritance.d.ts +31 -0
- package/esm/policies/WorkspaceInheritance.d.ts.map +1 -0
- package/esm/policies/WorkspaceInheritance.js +93 -0
- package/esm/policies/WorkspaceInheritance.js.map +1 -0
- package/esm/policies/WorkspaceMembersValid.d.ts +27 -0
- package/esm/policies/WorkspaceMembersValid.d.ts.map +1 -0
- package/esm/policies/WorkspaceMembersValid.js +87 -0
- package/esm/policies/WorkspaceMembersValid.js.map +1 -0
- package/esm/policies/constants.d.ts +8 -0
- package/esm/policies/constants.d.ts.map +1 -1
- package/esm/policies/constants.js +9 -1
- package/esm/policies/constants.js.map +1 -1
- package/esm/policies.d.ts +43 -5
- package/esm/policies.d.ts.map +1 -1
- package/esm/policies.js +63 -6
- package/esm/policies.js.map +1 -1
- package/esm/policy.d.ts +65 -269
- package/esm/policy.d.ts.map +1 -1
- package/esm/policy.js +1 -122
- package/esm/policy.js.map +1 -1
- package/esm/policyDefiners/defineCargoPolicy.d.ts +82 -0
- package/esm/policyDefiners/defineCargoPolicy.d.ts.map +1 -0
- package/esm/policyDefiners/defineCargoPolicy.js +42 -0
- package/esm/policyDefiners/defineCargoPolicy.js.map +1 -0
- package/esm/policyDefiners/defineFileHeaderPolicy.d.ts +27 -14
- package/esm/policyDefiners/defineFileHeaderPolicy.d.ts.map +1 -1
- package/esm/policyDefiners/defineFileHeaderPolicy.js +19 -39
- package/esm/policyDefiners/defineFileHeaderPolicy.js.map +1 -1
- package/esm/policyDefiners/defineGleamPolicy.d.ts +81 -0
- package/esm/policyDefiners/defineGleamPolicy.d.ts.map +1 -0
- package/esm/policyDefiners/defineGleamPolicy.js +42 -0
- package/esm/policyDefiners/defineGleamPolicy.js.map +1 -0
- package/esm/policyDefiners/definePackagePolicy.d.ts +24 -13
- package/esm/policyDefiners/definePackagePolicy.d.ts.map +1 -1
- package/esm/policyDefiners/definePackagePolicy.js +9 -32
- package/esm/policyDefiners/definePackagePolicy.js.map +1 -1
- package/esm/policyDefiners/spdxValidator.d.ts +66 -0
- package/esm/policyDefiners/spdxValidator.d.ts.map +1 -0
- package/esm/policyDefiners/spdxValidator.js +139 -0
- package/esm/policyDefiners/spdxValidator.js.map +1 -0
- package/esm/policyDefiners/tomlParser.d.ts +8 -0
- package/esm/policyDefiners/tomlParser.d.ts.map +1 -0
- package/esm/policyDefiners/tomlParser.js +17 -0
- package/esm/policyDefiners/tomlParser.js.map +1 -0
- package/esm/policyExecution.d.ts +19 -0
- package/esm/policyExecution.d.ts.map +1 -0
- package/esm/policyExecution.js +224 -0
- package/esm/policyExecution.js.map +1 -0
- package/esm/repositoryFiles.d.ts +4 -0
- package/esm/repositoryFiles.d.ts.map +1 -0
- package/esm/repositoryFiles.js +8 -0
- package/esm/repositoryFiles.js.map +1 -0
- package/esm/runner.d.ts +85 -0
- package/esm/runner.d.ts.map +1 -0
- package/esm/runner.js +189 -0
- package/esm/runner.js.map +1 -0
- package/esm/settlePolicyPromise.d.ts +4 -0
- package/esm/settlePolicyPromise.d.ts.map +1 -0
- package/esm/settlePolicyPromise.js +10 -0
- package/esm/settlePolicyPromise.js.map +1 -0
- package/esm/tsdoc-metadata.json +1 -1
- package/esm/utils/safePaths.d.ts +9 -0
- package/esm/utils/safePaths.d.ts.map +1 -0
- package/esm/utils/safePaths.js +40 -0
- package/esm/utils/safePaths.js.map +1 -0
- package/oclif.manifest.json +117 -3
- package/package.json +66 -36
- package/scripts/benchmark.mjs +341 -0
- package/scripts/postinstall.mjs +154 -0
- package/sidecar/sidecar.mjs +399 -0
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Build output extensions and directory patterns that should not be committed.
|
|
3
|
+
*/
|
|
4
|
+
const BUILD_DIR_REGEX = /(?:^|\/)(build)\//;
|
|
5
|
+
/**
|
|
6
|
+
* A policy that prevents accidental commits of build directory contents.
|
|
7
|
+
* Applies to Gleam's `build/` output directory.
|
|
8
|
+
*
|
|
9
|
+
* @public
|
|
10
|
+
*/
|
|
11
|
+
export const NoBuildDirectory = {
|
|
12
|
+
name: "NoBuildDirectory",
|
|
13
|
+
description: "Prevents accidental commits of build directory contents (Gleam build/ output).",
|
|
14
|
+
match: BUILD_DIR_REGEX,
|
|
15
|
+
handler: function* ({ file }) {
|
|
16
|
+
return [
|
|
17
|
+
`Build artifact detected in build/ directory: ${file}. The build/ directory should be in .gitignore.`,
|
|
18
|
+
].map((message) => ({
|
|
19
|
+
message,
|
|
20
|
+
manualFix: "Remove the build/ directory from source control and add it to .gitignore.",
|
|
21
|
+
}));
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=NoBuildDirectory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NoBuildDirectory.js","sourceRoot":"","sources":["../../src/policies/NoBuildDirectory.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,MAAM,eAAe,GAAG,mBAAmB,CAAC;AAE5C;;;;;GAKG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC/B,IAAI,EAAE,kBAAkB;IACxB,WAAW,EACV,gFAAgF;IACjF,KAAK,EAAE,eAAe;IACtB,OAAO,EAAE,QAAQ,CAAC,EAAE,EAAE,IAAI,EAAE;QAC3B,OAAO;YACN,gDAAgD,IAAI,iDAAiD;SACrG,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;YACnB,OAAO;YACP,SAAS,EACR,2EAA2E;SAC5E,CAAC,CAAC,CAAC;IACL,CAAC;CAC8B,CAAC","sourcesContent":["import type { Operation } from \"effection\";\nimport type { FilePolicyDefinition, PolicyFinding } from \"../policy.js\";\n\n/**\n * Build output extensions and directory patterns that should not be committed.\n */\nconst BUILD_DIR_REGEX = /(?:^|\\/)(build)\\//;\n\n/**\n * A policy that prevents accidental commits of build directory contents.\n * Applies to Gleam's `build/` output directory.\n *\n * @public\n */\nexport const NoBuildDirectory = {\n\tname: \"NoBuildDirectory\",\n\tdescription:\n\t\t\"Prevents accidental commits of build directory contents (Gleam build/ output).\",\n\tmatch: BUILD_DIR_REGEX,\n\thandler: function* ({ file }): Operation<PolicyFinding[]> {\n\t\treturn [\n\t\t\t`Build artifact detected in build/ directory: ${file}. The build/ directory should be in .gitignore.`,\n\t\t].map((message) => ({\n\t\t\tmessage,\n\t\t\tmanualFix:\n\t\t\t\t\"Remove the build/ directory from source control and add it to .gitignore.\",\n\t\t}));\n\t},\n} satisfies FilePolicyDefinition;\n"]}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Operation } from "effection";
|
|
2
|
+
import type { PolicyFinding } from "../policy.js";
|
|
2
3
|
/**
|
|
3
4
|
* A repo policy that checks for JavaScript source files that just use the .js file extension. Such files may be
|
|
4
5
|
* interpreted by node as either CommonJS or ESM based on the `type` field in the nearest package.json file. This
|
|
@@ -6,7 +7,12 @@ import type { PolicyDefinition } from "../policy.js";
|
|
|
6
7
|
* is processed by node. Using explicit file extensions reduces ambiguity and ensures a CJS file isn't suddenly treated
|
|
7
8
|
* like an ESM file.
|
|
8
9
|
*
|
|
9
|
-
* @
|
|
10
|
+
* @public
|
|
10
11
|
*/
|
|
11
|
-
export declare const NoJsFileExtensions:
|
|
12
|
+
export declare const NoJsFileExtensions: {
|
|
13
|
+
name: string;
|
|
14
|
+
description: string;
|
|
15
|
+
match: RegExp;
|
|
16
|
+
handler: () => Operation<PolicyFinding[]>;
|
|
17
|
+
};
|
|
12
18
|
//# sourceMappingURL=NoJsFileExtensions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NoJsFileExtensions.d.ts","sourceRoot":"","sources":["../../src/policies/NoJsFileExtensions.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"NoJsFileExtensions.d.ts","sourceRoot":"","sources":["../../src/policies/NoJsFileExtensions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,KAAK,EAAwB,aAAa,EAAE,MAAM,cAAc,CAAC;AACxE;;;;;;;;GAQG;AACH,eAAO,MAAM,kBAAkB;;;;mBAKP,SAAS,CAAC,aAAa,EAAE,CAAC;CAQlB,CAAC"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { makePolicyDefinition } from "../makePolicy.js";
|
|
2
1
|
/**
|
|
3
2
|
* A repo policy that checks for JavaScript source files that just use the .js file extension. Such files may be
|
|
4
3
|
* interpreted by node as either CommonJS or ESM based on the `type` field in the nearest package.json file. This
|
|
@@ -6,23 +5,19 @@ import { makePolicyDefinition } from "../makePolicy.js";
|
|
|
6
5
|
* is processed by node. Using explicit file extensions reduces ambiguity and ensures a CJS file isn't suddenly treated
|
|
7
6
|
* like an ESM file.
|
|
8
7
|
*
|
|
9
|
-
* @
|
|
8
|
+
* @public
|
|
10
9
|
*/
|
|
11
|
-
export const NoJsFileExtensions =
|
|
10
|
+
export const NoJsFileExtensions = {
|
|
12
11
|
name: "NoJsFileExtensions",
|
|
13
12
|
description: "Prevents ambiguous .js files by requiring explicit .mjs or .cjs extensions based on module format.",
|
|
14
13
|
match: /(^|\/)[^/]+\.js$/i,
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
autoFixable: false,
|
|
21
|
-
errorMessages: [
|
|
22
|
-
"JavaScript files should have a .cjs or .mjs file extension based on the module format of the file.",
|
|
23
|
-
],
|
|
14
|
+
handler: function* () {
|
|
15
|
+
return [
|
|
16
|
+
"JavaScript files should have a .cjs or .mjs file extension based on the module format of the file.",
|
|
17
|
+
].map((message) => ({
|
|
18
|
+
message,
|
|
24
19
|
manualFix: "Rename the file to have a .cjs or .mjs file extension.",
|
|
25
|
-
};
|
|
20
|
+
}));
|
|
26
21
|
},
|
|
27
|
-
}
|
|
22
|
+
};
|
|
28
23
|
//# sourceMappingURL=NoJsFileExtensions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NoJsFileExtensions.js","sourceRoot":"","sources":["../../src/policies/NoJsFileExtensions.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"NoJsFileExtensions.js","sourceRoot":"","sources":["../../src/policies/NoJsFileExtensions.ts"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG;IACjC,IAAI,EAAE,oBAAoB;IAC1B,WAAW,EACV,oGAAoG;IACrG,KAAK,EAAE,mBAAmB;IAC1B,OAAO,EAAE,QAAQ,CAAC;QACjB,OAAO;YACN,oGAAoG;SACpG,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;YACnB,OAAO;YACP,SAAS,EAAE,wDAAwD;SACnE,CAAC,CAAC,CAAC;IACL,CAAC;CAC8B,CAAC","sourcesContent":["import type { Operation } from \"effection\";\nimport type { FilePolicyDefinition, PolicyFinding } from \"../policy.js\";\n/**\n * A repo policy that checks for JavaScript source files that just use the .js file extension. Such files may be\n * interpreted by node as either CommonJS or ESM based on the `type` field in the nearest package.json file. This\n * can create unexpected behavior for JS files; changing the package.json nearest to one will change how the JS\n * is processed by node. Using explicit file extensions reduces ambiguity and ensures a CJS file isn't suddenly treated\n * like an ESM file.\n *\n * @public\n */\nexport const NoJsFileExtensions = {\n\tname: \"NoJsFileExtensions\",\n\tdescription:\n\t\t\"Prevents ambiguous .js files by requiring explicit .mjs or .cjs extensions based on module format.\",\n\tmatch: /(^|\\/)[^/]+\\.js$/i,\n\thandler: function* (): Operation<PolicyFinding[]> {\n\t\treturn [\n\t\t\t\"JavaScript files should have a .cjs or .mjs file extension based on the module format of the file.\",\n\t\t].map((message) => ({\n\t\t\tmessage,\n\t\t\tmanualFix: \"Rename the file to have a .cjs or .mjs file extension.\",\n\t\t}));\n\t},\n} satisfies FilePolicyDefinition;\n"]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { PolicyFinding } from "../policy.js";
|
|
2
2
|
/**
|
|
3
3
|
* Policy settings for the NoLargeBinaryFiles repo policy.
|
|
4
4
|
*
|
|
5
|
-
* @
|
|
5
|
+
* @public
|
|
6
6
|
*/
|
|
7
7
|
export interface NoLargeBinaryFilesSettings {
|
|
8
8
|
/**
|
|
@@ -24,7 +24,12 @@ export interface NoLargeBinaryFilesSettings {
|
|
|
24
24
|
* A repo policy that prevents large binary files from being committed to the repository.
|
|
25
25
|
* Large files can bloat the repository and slow down clones. Consider using Git LFS for large assets.
|
|
26
26
|
*
|
|
27
|
-
* @
|
|
27
|
+
* @public
|
|
28
28
|
*/
|
|
29
|
-
export declare const NoLargeBinaryFiles:
|
|
29
|
+
export declare const NoLargeBinaryFiles: {
|
|
30
|
+
name: string;
|
|
31
|
+
description: string;
|
|
32
|
+
match: RegExp;
|
|
33
|
+
handler: ({ file, root, config }: import("../policy.js").PolicyArgs<NoLargeBinaryFilesSettings>) => Promise<PolicyFinding[]>;
|
|
34
|
+
};
|
|
30
35
|
//# sourceMappingURL=NoLargeBinaryFiles.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NoLargeBinaryFiles.d.ts","sourceRoot":"","sources":["../../src/policies/NoLargeBinaryFiles.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"NoLargeBinaryFiles.d.ts","sourceRoot":"","sources":["../../src/policies/NoLargeBinaryFiles.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAwB,aAAa,EAAE,MAAM,cAAc,CAAC;AACxE;;;;GAIG;AACH,MAAM,WAAW,0BAA0B;IAC1C;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;;OAGG;IACH,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;IAE7B;;;OAGG;IACH,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;CAC3B;AA2FD;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB;;;;;CAsC6B,CAAC"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { statSync } from "node:fs";
|
|
2
2
|
import path from "pathe";
|
|
3
|
-
import { makePolicyDefinition } from "../makePolicy.js";
|
|
4
3
|
/**
|
|
5
4
|
* Default maximum file size (10MB in bytes).
|
|
6
5
|
*/
|
|
@@ -80,9 +79,9 @@ function formatBytes(bytes) {
|
|
|
80
79
|
* A repo policy that prevents large binary files from being committed to the repository.
|
|
81
80
|
* Large files can bloat the repository and slow down clones. Consider using Git LFS for large assets.
|
|
82
81
|
*
|
|
83
|
-
* @
|
|
82
|
+
* @public
|
|
84
83
|
*/
|
|
85
|
-
export const NoLargeBinaryFiles =
|
|
84
|
+
export const NoLargeBinaryFiles = {
|
|
86
85
|
name: "NoLargeBinaryFiles",
|
|
87
86
|
description: "Prevents large binary files from being committed to avoid repository bloat; consider using Git LFS for large assets.",
|
|
88
87
|
// Match all files
|
|
@@ -93,32 +92,27 @@ export const NoLargeBinaryFiles = makePolicyDefinition({
|
|
|
93
92
|
const excludePatterns = config?.excludePatterns ?? [];
|
|
94
93
|
// Skip excluded files
|
|
95
94
|
if (isExcluded(file, excludePatterns, excludeExtensions)) {
|
|
96
|
-
return
|
|
95
|
+
return [];
|
|
97
96
|
}
|
|
98
97
|
try {
|
|
99
98
|
const filePath = path.resolve(root, file);
|
|
100
99
|
const stats = statSync(filePath);
|
|
101
100
|
// Skip directories
|
|
102
101
|
if (stats.isDirectory()) {
|
|
103
|
-
return
|
|
102
|
+
return [];
|
|
104
103
|
}
|
|
105
104
|
if (stats.size > maxSizeBytes) {
|
|
106
|
-
const result =
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
autoFixable: false,
|
|
110
|
-
errorMessages: [
|
|
111
|
-
`File is too large: ${formatBytes(stats.size)} (max: ${formatBytes(maxSizeBytes)}). Consider using Git LFS or removing the file.`,
|
|
112
|
-
],
|
|
113
|
-
};
|
|
105
|
+
const result = [
|
|
106
|
+
`File is too large: ${formatBytes(stats.size)} (max: ${formatBytes(maxSizeBytes)}). Consider using Git LFS or removing the file.`,
|
|
107
|
+
].map((message) => ({ message }));
|
|
114
108
|
return result;
|
|
115
109
|
}
|
|
116
|
-
return
|
|
110
|
+
return [];
|
|
117
111
|
}
|
|
118
112
|
catch (_error) {
|
|
119
113
|
// File doesn't exist or can't be accessed, skip it
|
|
120
|
-
return
|
|
114
|
+
return [];
|
|
121
115
|
}
|
|
122
116
|
},
|
|
123
|
-
}
|
|
117
|
+
};
|
|
124
118
|
//# sourceMappingURL=NoLargeBinaryFiles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NoLargeBinaryFiles.js","sourceRoot":"","sources":["../../src/policies/NoLargeBinaryFiles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACnC,OAAO,IAAI,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"NoLargeBinaryFiles.js","sourceRoot":"","sources":["../../src/policies/NoLargeBinaryFiles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACnC,OAAO,IAAI,MAAM,OAAO,CAAC;AA0BzB;;GAEG;AACH,MAAM,gBAAgB,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC;AAE1C;;GAEG;AACH,MAAM,0BAA0B,GAAG;IAClC,KAAK;IACL,MAAM;IACN,OAAO;IACP,KAAK;IACL,KAAK;IACL,MAAM;IACN,MAAM;IACN,MAAM;IACN,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,MAAM;IACN,MAAM;IACN,OAAO;IACP,OAAO;IACP,MAAM;IACN,OA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;YAED,IAAI,KAAK,CAAC,IAAI,GAAG,YAAY,EAAE,CAAC;gBAC/B,MAAM,MAAM,GAAoB;oBAC/B,sBAAsB,WAAW,CAAC,KAAK,CAAC,IAAI,CAAC,UAAU,WAAW,CAAC,YAAY,CAAC,iDAAiD;iBACjI,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC;gBAClC,OAAO,MAAM,CAAC;YACf,CAAC;YACD,OAAO,EAAE,CAAC;QACX,CAAC;QAAC,OAAO,MAAe,EAAE,CAAC;YAC1B,mDAAmD;YACnD,OAAO,EAAE,CAAC;QACX,CAAC;IACF,CAAC;CAC0D,CAAC","sourcesContent":["import { statSync } from \"node:fs\";\nimport path from \"pathe\";\nimport type { FilePolicyDefinition, PolicyFinding } from \"../policy.js\";\n/**\n * Policy settings for the NoLargeBinaryFiles repo policy.\n *\n * @public\n */\nexport interface NoLargeBinaryFilesSettings {\n\t/**\n\t * Maximum file size in bytes. Defaults to 10MB.\n\t */\n\tmaxSizeBytes?: number;\n\n\t/**\n\t * File extensions to exclude from size checking.\n\t * Useful for known large files that should be allowed.\n\t */\n\texcludeExtensions?: string[];\n\n\t/**\n\t * File patterns to exclude from size checking.\n\t * Uses glob-style patterns.\n\t */\n\texcludePatterns?: string[];\n}\n\n/**\n * Default maximum file size (10MB in bytes).\n */\nconst DEFAULT_MAX_SIZE = 10 * 1024 * 1024;\n\n/**\n * Default file extensions that are typically safe to exclude from size limits.\n */\nconst DEFAULT_EXCLUDE_EXTENSIONS = [\n\t\".md\",\n\t\".txt\",\n\t\".json\",\n\t\".js\",\n\t\".ts\",\n\t\".jsx\",\n\t\".tsx\",\n\t\".css\",\n\t\".scss\",\n\t\".sass\",\n\t\".less\",\n\t\".html\",\n\t\".xml\",\n\t\".yml\",\n\t\".yaml\",\n\t\".toml\",\n\t\".ini\",\n\t\".conf\",\n\t\".config\",\n];\n\n/**\n * Convert a glob pattern to a regex pattern by escaping special characters\n * and converting * to .* for wildcard matching.\n */\nfunction globToRegex(pattern: string): RegExp {\n\t// Escape all regex special characters except *\n\tconst escaped = pattern.replace(/[.+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n\t// Convert * to .* for wildcard matching\n\tconst regexPattern = escaped.replace(/\\*/g, \".*\");\n\treturn new RegExp(`^${regexPattern}$`);\n}\n\n/**\n * Check if a file matches any of the exclude patterns.\n */\nfunction isExcluded(\n\tfilePath: string,\n\texcludePatterns: string[],\n\texcludeExtensions: string[],\n): boolean {\n\tconst ext = path.extname(filePath).toLowerCase();\n\n\t// Check extensions\n\tif (excludeExtensions.includes(ext)) {\n\t\treturn true;\n\t}\n\n\t// Check patterns (simple glob-like matching)\n\tfor (const pattern of excludePatterns) {\n\t\tif (pattern.includes(\"*\")) {\n\t\t\tconst regex = globToRegex(pattern);\n\t\t\tif (regex.test(filePath)) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t} else if (filePath.includes(pattern)) {\n\t\t\treturn true;\n\t\t}\n\t}\n\n\treturn false;\n}\n\n/**\n * Format bytes in a human-readable format.\n */\nfunction formatBytes(bytes: number): string {\n\tif (bytes === 0) {\n\t\treturn \"0 B\";\n\t}\n\tconst k = 1024;\n\tconst sizes = [\"B\", \"KB\", \"MB\", \"GB\", \"TB\"];\n\tconst i = Math.min(\n\t\tMath.floor(Math.log(bytes) / Math.log(k)),\n\t\tsizes.length - 1,\n\t);\n\tconst formatted = (bytes / k ** i).toFixed(1);\n\treturn `${formatted} ${sizes[i]}`;\n}\n\n/**\n * A repo policy that prevents large binary files from being committed to the repository.\n * Large files can bloat the repository and slow down clones. Consider using Git LFS for large assets.\n *\n * @public\n */\nexport const NoLargeBinaryFiles = {\n\tname: \"NoLargeBinaryFiles\",\n\tdescription:\n\t\t\"Prevents large binary files from being committed to avoid repository bloat; consider using Git LFS for large assets.\",\n\t// Match all files\n\tmatch: /.*/,\n\thandler: async ({ file, root, config }) => {\n\t\tconst maxSizeBytes = config?.maxSizeBytes ?? DEFAULT_MAX_SIZE;\n\t\tconst excludeExtensions =\n\t\t\tconfig?.excludeExtensions ?? DEFAULT_EXCLUDE_EXTENSIONS;\n\t\tconst excludePatterns = config?.excludePatterns ?? [];\n\n\t\t// Skip excluded files\n\t\tif (isExcluded(file, excludePatterns, excludeExtensions)) {\n\t\t\treturn [];\n\t\t}\n\n\t\ttry {\n\t\t\tconst filePath = path.resolve(root, file);\n\t\t\tconst stats = statSync(filePath);\n\n\t\t\t// Skip directories\n\t\t\tif (stats.isDirectory()) {\n\t\t\t\treturn [];\n\t\t\t}\n\n\t\t\tif (stats.size > maxSizeBytes) {\n\t\t\t\tconst result: PolicyFinding[] = [\n\t\t\t\t\t`File is too large: ${formatBytes(stats.size)} (max: ${formatBytes(maxSizeBytes)}). Consider using Git LFS or removing the file.`,\n\t\t\t\t].map((message) => ({ message }));\n\t\t\t\treturn result;\n\t\t\t}\n\t\t\treturn [];\n\t\t} catch (_error: unknown) {\n\t\t\t// File doesn't exist or can't be accessed, skip it\n\t\t\treturn [];\n\t\t}\n\t},\n} satisfies FilePolicyDefinition<NoLargeBinaryFilesSettings>;\n"]}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Configuration for the NoPrivateWorkspaceDependencies policy.
|
|
3
|
+
*
|
|
4
|
+
* @public
|
|
3
5
|
*/
|
|
4
6
|
export interface NoPrivateWorkspaceDependenciesSettings {
|
|
5
7
|
/**
|
|
6
8
|
* Whether to check devDependencies in addition to dependencies.
|
|
7
|
-
* @
|
|
9
|
+
* @defaultValue false
|
|
8
10
|
*/
|
|
9
11
|
checkDevDependencies?: boolean;
|
|
10
12
|
}
|
|
@@ -21,17 +23,19 @@ export interface NoPrivateWorkspaceDependenciesSettings {
|
|
|
21
23
|
* @example
|
|
22
24
|
* ```typescript
|
|
23
25
|
* // In repopo.config.ts
|
|
26
|
+
* import { makePolicy } from "repopo";
|
|
24
27
|
* import { NoPrivateWorkspaceDependencies } from "repopo/policies";
|
|
25
28
|
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
* });
|
|
29
|
+
* // Only check production dependencies (default)
|
|
30
|
+
* makePolicy(NoPrivateWorkspaceDependencies);
|
|
29
31
|
*
|
|
30
32
|
* // Or check both dependencies and devDependencies
|
|
31
33
|
* makePolicy(NoPrivateWorkspaceDependencies, {
|
|
32
|
-
* checkDevDependencies: true,
|
|
34
|
+
* config: { checkDevDependencies: true },
|
|
33
35
|
* });
|
|
34
36
|
* ```
|
|
37
|
+
*
|
|
38
|
+
* @public
|
|
35
39
|
*/
|
|
36
|
-
export declare const NoPrivateWorkspaceDependencies: import("../policy.js").
|
|
40
|
+
export declare const NoPrivateWorkspaceDependencies: import("../policy.js").FilePolicyDefinition<NoPrivateWorkspaceDependenciesSettings | undefined>;
|
|
37
41
|
//# sourceMappingURL=NoPrivateWorkspaceDependencies.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NoPrivateWorkspaceDependencies.d.ts","sourceRoot":"","sources":["../../src/policies/NoPrivateWorkspaceDependencies.ts"],"names":[],"mappings":"AAYA
|
|
1
|
+
{"version":3,"file":"NoPrivateWorkspaceDependencies.d.ts","sourceRoot":"","sources":["../../src/policies/NoPrivateWorkspaceDependencies.ts"],"names":[],"mappings":"AAYA;;;;GAIG;AACH,MAAM,WAAW,sCAAsC;IACtD;;;OAGG;IACH,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAC/B;AA6ED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,eAAO,MAAM,8BAA8B,iGAoEzC,CAAC"}
|
|
@@ -77,26 +77,27 @@ function isWorkspaceDependency(version) {
|
|
|
77
77
|
* @example
|
|
78
78
|
* ```typescript
|
|
79
79
|
* // In repopo.config.ts
|
|
80
|
+
* import { makePolicy } from "repopo";
|
|
80
81
|
* import { NoPrivateWorkspaceDependencies } from "repopo/policies";
|
|
81
82
|
*
|
|
82
|
-
*
|
|
83
|
-
*
|
|
84
|
-
* });
|
|
83
|
+
* // Only check production dependencies (default)
|
|
84
|
+
* makePolicy(NoPrivateWorkspaceDependencies);
|
|
85
85
|
*
|
|
86
86
|
* // Or check both dependencies and devDependencies
|
|
87
87
|
* makePolicy(NoPrivateWorkspaceDependencies, {
|
|
88
|
-
* checkDevDependencies: true,
|
|
88
|
+
* config: { checkDevDependencies: true },
|
|
89
89
|
* });
|
|
90
90
|
* ```
|
|
91
|
+
*
|
|
92
|
+
* @public
|
|
91
93
|
*/
|
|
92
94
|
export const NoPrivateWorkspaceDependencies = definePackagePolicy({
|
|
93
95
|
name: "NoPrivateWorkspaceDependencies",
|
|
94
96
|
description: "Prevents publishable packages from depending on private workspace packages that won't be available on npm.",
|
|
95
|
-
|
|
96
|
-
handler: function* (json, { file, root, config }) {
|
|
97
|
+
handler: function* (json, { root, config }) {
|
|
97
98
|
// Private packages can depend on anything - they won't be published
|
|
98
99
|
if (json.private === true) {
|
|
99
|
-
return
|
|
100
|
+
return [];
|
|
100
101
|
}
|
|
101
102
|
const checkDevDeps = config?.checkDevDependencies ?? false;
|
|
102
103
|
// Collect dependencies to check
|
|
@@ -131,15 +132,12 @@ export const NoPrivateWorkspaceDependencies = definePackagePolicy({
|
|
|
131
132
|
errorMessages.push(`Could not resolve workspace dependencies (verify they exist):\n\t${unresolvableDeps.join("\n\t")}`);
|
|
132
133
|
}
|
|
133
134
|
if (errorMessages.length > 0) {
|
|
134
|
-
const failResult = {
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
autoFixable: false,
|
|
138
|
-
errorMessages,
|
|
139
|
-
};
|
|
135
|
+
const failResult = errorMessages.map((message) => ({
|
|
136
|
+
message,
|
|
137
|
+
}));
|
|
140
138
|
return failResult;
|
|
141
139
|
}
|
|
142
|
-
return
|
|
140
|
+
return [];
|
|
143
141
|
},
|
|
144
142
|
});
|
|
145
143
|
//# sourceMappingURL=NoPrivateWorkspaceDependencies.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NoPrivateWorkspaceDependencies.js","sourceRoot":"","sources":["../../src/policies/NoPrivateWorkspaceDependencies.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,uDAAuD;AACvD,mDAAmD;AACnD,OAAO,oBAAoB,MAAM,wBAAwB,CAAC;AAE1D,MAAM,EAAE,iBAAiB,EAAE,GAAG,oBAAoB,CAAC;AAEnD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAGtC,OAAO,EAAE,mBAAmB,EAAE,MAAM,0CAA0C,CAAC;
|
|
1
|
+
{"version":3,"file":"NoPrivateWorkspaceDependencies.js","sourceRoot":"","sources":["../../src/policies/NoPrivateWorkspaceDependencies.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,uDAAuD;AACvD,mDAAmD;AACnD,OAAO,oBAAoB,MAAM,wBAAwB,CAAC;AAE1D,MAAM,EAAE,iBAAiB,EAAE,GAAG,oBAAoB,CAAC;AAEnD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAGtC,OAAO,EAAE,mBAAmB,EAAE,MAAM,0CAA0C,CAAC;AAe/E;;GAEG;AACH,MAAM,qBAAqB,GAAG,IAAI,GAAG,EAGlC,CAAC;AAEJ;;;GAGG;AACH,SAAS,wBAAwB,CAChC,IAAY;IAEZ,oBAAoB;IACpB,MAAM,MAAM,GAAG,qBAAqB,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAC/C,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;QAC1B,OAAO,MAAM,CAAC;IACf,CAAC;IAED,MAAM,UAAU,GAAG,IAAI,GAAG,EAAmC,CAAC;IAE9D,+DAA+D;IAC/D,MAAM,cAAc,GAAG,iBAAiB,CAAC,IAAI,CAAC,CAAC;IAC/C,IAAI,cAAc,KAAK,IAAI,EAAE,CAAC;QAC7B,qCAAqC;QACrC,qBAA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,EAAE,CAAC;QAEnC,IAAI,oBAAoB,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACrC,aAAa,CAAC,IAAI,CACjB,yGAAyG,oBAAoB,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAC5I,CAAC;QACH,CAAC;QAED,IAAI,gBAAgB,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACjC,aAAa,CAAC,IAAI,CACjB,oEAAoE,gBAAgB,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CACnG,CAAC;QACH,CAAC;QAED,IAAI,aAAa,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC9B,MAAM,UAAU,GAAoB,aAAa,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;gBACnE,OAAO;aACP,CAAC,CAAC,CAAC;YACJ,OAAO,UAAU,CAAC;QACnB,CAAC;QACD,OAAO,EAAE,CAAC;IACX,CAAC;CACD,CAAC,CAAC","sourcesContent":["import { readFileSync } from \"node:fs\";\n// Use default import + destructure for CJS/ESM interop\n// (resolve-workspace-root is a bundled CJS module)\nimport resolveWorkspaceRoot from \"resolve-workspace-root\";\n\nconst { getWorkspaceGlobs } = resolveWorkspaceRoot;\n\nimport { globSync } from \"tinyglobby\";\nimport type { PackageJson } from \"type-fest\";\nimport type { PolicyFinding } from \"../policy.js\";\nimport { definePackagePolicy } from \"../policyDefiners/definePackagePolicy.js\";\n\n/**\n * Configuration for the NoPrivateWorkspaceDependencies policy.\n *\n * @public\n */\nexport interface NoPrivateWorkspaceDependenciesSettings {\n\t/**\n\t * Whether to check devDependencies in addition to dependencies.\n\t * @defaultValue false\n\t */\n\tcheckDevDependencies?: boolean;\n}\n\n/**\n * Cache for workspace package lookups to avoid repeated filesystem operations.\n */\nconst workspacePackageCache = new Map<\n\tstring,\n\tMap<string, PackageJson | undefined>\n>();\n\n/**\n * Builds a map of package name to package.json for all packages in the workspace.\n * Uses the workspace configuration (pnpm-workspace.yaml or package.json workspaces) to find packages.\n */\nfunction buildWorkspacePackageMap(\n\troot: string,\n): Map<string, PackageJson | undefined> {\n\t// Check cache first\n\tconst cached = workspacePackageCache.get(root);\n\tif (cached !== undefined) {\n\t\treturn cached;\n\t}\n\n\tconst packageMap = new Map<string, PackageJson | undefined>();\n\n\t// Get workspace globs from pnpm-workspace.yaml or package.json\n\tconst workspaceGlobs = getWorkspaceGlobs(root);\n\tif (workspaceGlobs === null) {\n\t\t// Not a workspace - return empty map\n\t\tworkspacePackageCache.set(root, packageMap);\n\t\treturn packageMap;\n\t}\n\n\t// Find all package.json files matching the workspace globs\n\tconst packageGlobs = workspaceGlobs.map((g) => `${g}/package.json`);\n\tconst packageJsonPaths = globSync(packageGlobs, {\n\t\tcwd: root,\n\t\tignore: [\"**/node_modules/**\"],\n\t\tonlyFiles: true,\n\t\tabsolute: true,\n\t});\n\n\t// Load each package.json and map by name\n\tfor (const pkgPath of packageJsonPaths) {\n\t\ttry {\n\t\t\tconst content = readFileSync(pkgPath, \"utf-8\");\n\t\t\tconst pkg = JSON.parse(content) as PackageJson;\n\t\t\tif (pkg.name) {\n\t\t\t\tpackageMap.set(pkg.name, pkg);\n\t\t\t}\n\t\t} catch {\n\t\t\t// Ignore parse errors\n\t\t}\n\t}\n\n\tworkspacePackageCache.set(root, packageMap);\n\treturn packageMap;\n}\n\n/**\n * Looks up a workspace package by name using the workspace configuration.\n */\nfunction findWorkspacePackage(\n\tdepName: string,\n\troot: string,\n): PackageJson | undefined {\n\tconst packageMap = buildWorkspacePackageMap(root);\n\treturn packageMap.get(depName);\n}\n\n/**\n * Checks if a dependency version uses the workspace protocol.\n */\nfunction isWorkspaceDependency(version: string | undefined): boolean {\n\treturn version?.startsWith(\"workspace:\") ?? false;\n}\n\n/**\n * Policy that prevents publishable packages from depending on private workspace packages.\n *\n * A package is considered \"publishable\" if it does not have `\"private\": true` in its package.json.\n * Such packages cannot have `workspace:` dependencies on packages that are marked as private,\n * because those dependencies won't be resolvable when the package is published to npm.\n *\n * This policy uses the workspace configuration (pnpm-workspace.yaml or package.json workspaces field)\n * to locate workspace packages, rather than hardcoding directory conventions.\n *\n * @example\n * ```typescript\n * // In repopo.config.ts\n * import { makePolicy } from \"repopo\";\n * import { NoPrivateWorkspaceDependencies } from \"repopo/policies\";\n *\n * // Only check production dependencies (default)\n * makePolicy(NoPrivateWorkspaceDependencies);\n *\n * // Or check both dependencies and devDependencies\n * makePolicy(NoPrivateWorkspaceDependencies, {\n * config: { checkDevDependencies: true },\n * });\n * ```\n *\n * @public\n */\nexport const NoPrivateWorkspaceDependencies = definePackagePolicy<\n\tPackageJson,\n\tNoPrivateWorkspaceDependenciesSettings | undefined\n>({\n\tname: \"NoPrivateWorkspaceDependencies\",\n\tdescription:\n\t\t\"Prevents publishable packages from depending on private workspace packages that won't be available on npm.\",\n\thandler: function* (json, { root, config }) {\n\t\t// Private packages can depend on anything - they won't be published\n\t\tif (json.private === true) {\n\t\t\treturn [];\n\t\t}\n\n\t\tconst checkDevDeps = config?.checkDevDependencies ?? false;\n\n\t\t// Collect dependencies to check\n\t\tconst depsToCheck: Record<string, string | undefined> = {\n\t\t\t...(json.dependencies ?? {}),\n\t\t};\n\n\t\tif (checkDevDeps) {\n\t\t\tObject.assign(depsToCheck, json.devDependencies ?? {});\n\t\t}\n\n\t\tconst privateWorkspaceDeps: string[] = [];\n\t\tconst unresolvableDeps: string[] = [];\n\n\t\tfor (const [depName, version] of Object.entries(depsToCheck)) {\n\t\t\tif (!isWorkspaceDependency(version)) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tconst depPackageJson = findWorkspacePackage(depName, root);\n\n\t\t\tif (depPackageJson === undefined) {\n\t\t\t\t// Could not find the package - might be a configuration issue\n\t\t\t\t// We'll warn but not fail, as this could be a valid setup we don't understand\n\t\t\t\tunresolvableDeps.push(depName);\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (depPackageJson.private === true) {\n\t\t\t\tprivateWorkspaceDeps.push(depName);\n\t\t\t}\n\t\t}\n\n\t\tconst errorMessages: string[] = [];\n\n\t\tif (privateWorkspaceDeps.length > 0) {\n\t\t\terrorMessages.push(\n\t\t\t\t`Publishable package has workspace dependencies on private packages that won't be available on npm:\\n\\t${privateWorkspaceDeps.join(\"\\n\\t\")}`,\n\t\t\t);\n\t\t}\n\n\t\tif (unresolvableDeps.length > 0) {\n\t\t\terrorMessages.push(\n\t\t\t\t`Could not resolve workspace dependencies (verify they exist):\\n\\t${unresolvableDeps.join(\"\\n\\t\")}`,\n\t\t\t);\n\t\t}\n\n\t\tif (errorMessages.length > 0) {\n\t\t\tconst failResult: PolicyFinding[] = errorMessages.map((message) => ({\n\t\t\t\tmessage,\n\t\t\t}));\n\t\t\treturn failResult;\n\t\t}\n\t\treturn [];\n\t},\n});\n"]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Operation } from "effection";
|
|
2
|
+
import type { PolicyFinding } from "../policy.js";
|
|
3
|
+
/**
|
|
4
|
+
* A policy that prevents accidental commits of Rust build artifacts.
|
|
5
|
+
*
|
|
6
|
+
* @public
|
|
7
|
+
*/
|
|
8
|
+
export declare const NoTargetArtifacts: {
|
|
9
|
+
name: string;
|
|
10
|
+
description: string;
|
|
11
|
+
match: RegExp;
|
|
12
|
+
handler: ({ file }: import("../policy.js").PolicyArgs<void>) => Operation<PolicyFinding[]>;
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=NoTargetArtifacts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NoTargetArtifacts.d.ts","sourceRoot":"","sources":["../../src/policies/NoTargetArtifacts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,KAAK,EAAwB,aAAa,EAAE,MAAM,cAAc,CAAC;AAqBxE;;;;GAIG;AACH,eAAO,MAAM,iBAAiB;;;;oEAKE,SAAS,CAAC,aAAa,EAAE,CAAC;CAa1B,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Build artifact extensions that should not be committed to source control.
|
|
3
|
+
*/
|
|
4
|
+
const ARTIFACT_EXTENSIONS = [
|
|
5
|
+
".rlib",
|
|
6
|
+
".rmeta",
|
|
7
|
+
".d",
|
|
8
|
+
".so",
|
|
9
|
+
".dylib",
|
|
10
|
+
".dll",
|
|
11
|
+
".exe",
|
|
12
|
+
".pdb",
|
|
13
|
+
];
|
|
14
|
+
const ARTIFACT_REGEX = new RegExp(`(${ARTIFACT_EXTENSIONS.map((ext) => ext.replace(".", "\\.")).join("|")})$`, "i");
|
|
15
|
+
/**
|
|
16
|
+
* A policy that prevents accidental commits of Rust build artifacts.
|
|
17
|
+
*
|
|
18
|
+
* @public
|
|
19
|
+
*/
|
|
20
|
+
export const NoTargetArtifacts = {
|
|
21
|
+
name: "NoTargetArtifacts",
|
|
22
|
+
description: "Prevents accidental commits of Rust build artifacts (.rlib, .rmeta, .so, .dylib, etc.).",
|
|
23
|
+
match: ARTIFACT_REGEX,
|
|
24
|
+
handler: function* ({ file }) {
|
|
25
|
+
// Allow files inside test/fixture directories
|
|
26
|
+
if (file.includes("test/") || file.includes("fixture")) {
|
|
27
|
+
return [];
|
|
28
|
+
}
|
|
29
|
+
return [
|
|
30
|
+
`Build artifact detected: ${file}. Rust build artifacts should not be committed to source control.`,
|
|
31
|
+
].map((message) => ({
|
|
32
|
+
message,
|
|
33
|
+
manualFix: "Remove the file from source control and ensure /target/ is in .gitignore.",
|
|
34
|
+
}));
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
//# sourceMappingURL=NoTargetArtifacts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NoTargetArtifacts.js","sourceRoot":"","sources":["../../src/policies/NoTargetArtifacts.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,MAAM,mBAAmB,GAAG;IAC3B,OAAO;IACP,QAAQ;IACR,IAAI;IACJ,KAAK;IACL,QAAQ;IACR,MAAM;IACN,MAAM;IACN,MAAM;CACN,CAAC;AAEF,MAAM,cAAc,GAAG,IAAI,MAAM,CAChC,IAAI,mBAAmB,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,EAC3E,GAAG,CACH,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAChC,IAAI,EAAE,mBAAmB;IACzB,WAAW,EACV,yFAAyF;IAC1F,KAAK,EAAE,cAAc;IACrB,OAAO,EAAE,QAAQ,CAAC,EAAE,EAAE,IAAI,EAAE;QAC3B,8CAA8C;QAC9C,IAAI,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC;YACxD,OAAO,EAAE,CAAC;QACX,CAAC;QACD,OAAO;YACN,4BAA4B,IAAI,mEAAmE;SACnG,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;YACnB,OAAO;YACP,SAAS,EACR,2EAA2E;SAC5E,CAAC,CAAC,CAAC;IACL,CAAC;CAC8B,CAAC","sourcesContent":["import type { Operation } from \"effection\";\nimport type { FilePolicyDefinition, PolicyFinding } from \"../policy.js\";\n\n/**\n * Build artifact extensions that should not be committed to source control.\n */\nconst ARTIFACT_EXTENSIONS = [\n\t\".rlib\",\n\t\".rmeta\",\n\t\".d\",\n\t\".so\",\n\t\".dylib\",\n\t\".dll\",\n\t\".exe\",\n\t\".pdb\",\n];\n\nconst ARTIFACT_REGEX = new RegExp(\n\t`(${ARTIFACT_EXTENSIONS.map((ext) => ext.replace(\".\", \"\\\\.\")).join(\"|\")})$`,\n\t\"i\",\n);\n\n/**\n * A policy that prevents accidental commits of Rust build artifacts.\n *\n * @public\n */\nexport const NoTargetArtifacts = {\n\tname: \"NoTargetArtifacts\",\n\tdescription:\n\t\t\"Prevents accidental commits of Rust build artifacts (.rlib, .rmeta, .so, .dylib, etc.).\",\n\tmatch: ARTIFACT_REGEX,\n\thandler: function* ({ file }): Operation<PolicyFinding[]> {\n\t\t// Allow files inside test/fixture directories\n\t\tif (file.includes(\"test/\") || file.includes(\"fixture\")) {\n\t\t\treturn [];\n\t\t}\n\t\treturn [\n\t\t\t`Build artifact detected: ${file}. Rust build artifacts should not be committed to source control.`,\n\t\t].map((message) => ({\n\t\t\tmessage,\n\t\t\tmanualFix:\n\t\t\t\t\"Remove the file from source control and ensure /target/ is in .gitignore.\",\n\t\t}));\n\t},\n} satisfies FilePolicyDefinition;\n"]}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configuration for the NoUnsafeWithoutJustification policy.
|
|
3
|
+
*
|
|
4
|
+
* @public
|
|
5
|
+
*/
|
|
6
|
+
export interface NoUnsafeWithoutJustificationConfig {
|
|
7
|
+
/**
|
|
8
|
+
* The comment prefix to look for before unsafe blocks.
|
|
9
|
+
* @defaultValue "// SAFETY:"
|
|
10
|
+
*/
|
|
11
|
+
requireComment?: string;
|
|
12
|
+
/**
|
|
13
|
+
* Paths to exclude from this check (e.g., FFI modules).
|
|
14
|
+
*/
|
|
15
|
+
excludePaths?: string[];
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* A policy that requires SAFETY comments on unsafe blocks in Rust source files.
|
|
19
|
+
*
|
|
20
|
+
* @public
|
|
21
|
+
*/
|
|
22
|
+
export declare const NoUnsafeWithoutJustification: {
|
|
23
|
+
name: string;
|
|
24
|
+
description: string;
|
|
25
|
+
match: RegExp;
|
|
26
|
+
handler: ({ file, root, config }: import("../policy.js").PolicyArgs<NoUnsafeWithoutJustificationConfig>) => Promise<{
|
|
27
|
+
message: string;
|
|
28
|
+
manualFix: string;
|
|
29
|
+
}[]>;
|
|
30
|
+
};
|
|
31
|
+
//# sourceMappingURL=NoUnsafeWithoutJustification.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NoUnsafeWithoutJustification.d.ts","sourceRoot":"","sources":["../../src/policies/NoUnsafeWithoutJustification.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,MAAM,WAAW,kCAAkC;IAClD;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;CACxB;AA+CD;;;;GAIG;AACH,eAAO,MAAM,4BAA4B;;;;;;;;CA0C2B,CAAC"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { readFile } from "node:fs/promises";
|
|
2
|
+
import { resolve } from "pathe";
|
|
3
|
+
const UNSAFE_PATTERN = /\bunsafe\s*\{|\bunsafe\s+fn\b|\bunsafe\s+impl\b/;
|
|
4
|
+
/**
|
|
5
|
+
* Check whether the lines preceding an unsafe block contain the required safety comment.
|
|
6
|
+
*/
|
|
7
|
+
function hasJustificationComment(lines, lineIndex, requiredComment) {
|
|
8
|
+
for (let j = lineIndex - 1; j >= Math.max(0, lineIndex - 5); j--) {
|
|
9
|
+
const prevLine = lines[j];
|
|
10
|
+
if (prevLine === undefined) {
|
|
11
|
+
continue;
|
|
12
|
+
}
|
|
13
|
+
const trimmedPrev = prevLine.trim();
|
|
14
|
+
if (trimmedPrev === "") {
|
|
15
|
+
continue;
|
|
16
|
+
}
|
|
17
|
+
if (trimmedPrev.toUpperCase().includes(requiredComment.toUpperCase())) {
|
|
18
|
+
return true;
|
|
19
|
+
}
|
|
20
|
+
// Stop if we hit a non-comment, non-attribute line
|
|
21
|
+
if (!(trimmedPrev.startsWith("//") || trimmedPrev.startsWith("#["))) {
|
|
22
|
+
break;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Check if a file path should be excluded from the unsafe check.
|
|
29
|
+
*/
|
|
30
|
+
function isExcluded(file, excludePaths) {
|
|
31
|
+
if (!excludePaths) {
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
34
|
+
for (const excludePath of excludePaths) {
|
|
35
|
+
if (file.includes(excludePath)) {
|
|
36
|
+
return true;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* A policy that requires SAFETY comments on unsafe blocks in Rust source files.
|
|
43
|
+
*
|
|
44
|
+
* @public
|
|
45
|
+
*/
|
|
46
|
+
export const NoUnsafeWithoutJustification = {
|
|
47
|
+
name: "NoUnsafeWithoutJustification",
|
|
48
|
+
description: "Requires safety justification comments on unsafe blocks in Rust source files.",
|
|
49
|
+
match: /\.rs$/,
|
|
50
|
+
handler: async ({ file, root, config }) => {
|
|
51
|
+
const requiredComment = config?.requireComment ?? "// SAFETY:";
|
|
52
|
+
if (isExcluded(file, config?.excludePaths)) {
|
|
53
|
+
return [];
|
|
54
|
+
}
|
|
55
|
+
const content = await readFile(resolve(root, file), "utf-8");
|
|
56
|
+
const lines = content.split("\n");
|
|
57
|
+
const violations = [];
|
|
58
|
+
for (let i = 0; i < lines.length; i++) {
|
|
59
|
+
const line = lines[i];
|
|
60
|
+
if (line === undefined) {
|
|
61
|
+
continue;
|
|
62
|
+
}
|
|
63
|
+
const trimmed = line.trim();
|
|
64
|
+
// Look for `unsafe` keyword usage (blocks, functions, impls)
|
|
65
|
+
if (UNSAFE_PATTERN.test(trimmed) &&
|
|
66
|
+
!hasJustificationComment(lines, i, requiredComment)) {
|
|
67
|
+
violations.push(`Line ${i + 1}: unsafe block without ${requiredComment} comment`);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
if (violations.length > 0) {
|
|
71
|
+
return violations.map((message) => ({
|
|
72
|
+
message,
|
|
73
|
+
manualFix: `Add a "${requiredComment}" comment above each unsafe block explaining why it is safe.`,
|
|
74
|
+
}));
|
|
75
|
+
}
|
|
76
|
+
return [];
|
|
77
|
+
},
|
|
78
|
+
};
|
|
79
|
+
//# sourceMappingURL=NoUnsafeWithoutJustification.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NoUnsafeWithoutJustification.js","sourceRoot":"","sources":["../../src/policies/NoUnsafeWithoutJustification.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAoBhC,MAAM,cAAc,GAAG,iDAAiD,CAAC;AAEzE;;GAEG;AACH,SAAS,uBAAuB,CAC/B,KAAe,EACf,SAAiB,EACjB,eAAuB;IAEvB,KAAK,IAAI,CAAC,GAAG,SAAS,GAAG,CAAC,EAAE,CAAC,IAAI,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,SAAS,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;QAClE,MAAM,QAAQ,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;QAC1B,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;YAC5B,SAAS;QACV,CAAC;QACD,MAAM,WAAW,GAAG,QAAQ,CAAC,IAAI,EAAE,CAAC;QACpC,IAAI,WAAW,KAAK,EAAE,EAAE,CAAC;YACxB,SAAS;QACV,CAAC;QACD,IAAI,WAAW,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,eAAe,CAAC,WAAW,EAAE,CAAC,EAAE,CAAC;YACvE,OAAO,IAAI,CAAC;QACb,CAAC;QACD,mDAAmD;QACnD,IAAI,CAAC,CAAC,WAAW,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,WAAW,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC;YACrE,MAAM;QACP,CAAC;IACF,CAAC;IACD,OAAO,KAAK,CAAC;AACd,CAAC;AAED;;GAEG;AACH,SAAS,UAAU,CAAC,IAAY,EAAE,YAAkC;IACnE,IAAI,CAAC,YA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AClD,CAAC;gBACF,UAAU,CAAC,IAAI,CACd,QAAQ,CAAC,GAAG,CAAC,0BAA0B,eAAe,UAAU,CAChE,CAAC;YACH,CAAC;QACF,CAAC;QAED,IAAI,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC3B,OAAO,UAAU,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;gBACnC,OAAO;gBACP,SAAS,EAAE,UAAU,eAAe,8DAA8D;aAClG,CAAC,CAAC,CAAC;QACL,CAAC;QACD,OAAO,EAAE,CAAC;IACX,CAAC;CACkE,CAAC","sourcesContent":["import { readFile } from \"node:fs/promises\";\nimport { resolve } from \"pathe\";\nimport type { FilePolicyDefinition } from \"../policy.js\";\n/**\n * Configuration for the NoUnsafeWithoutJustification policy.\n *\n * @public\n */\nexport interface NoUnsafeWithoutJustificationConfig {\n\t/**\n\t * The comment prefix to look for before unsafe blocks.\n\t * @defaultValue \"// SAFETY:\"\n\t */\n\trequireComment?: string;\n\n\t/**\n\t * Paths to exclude from this check (e.g., FFI modules).\n\t */\n\texcludePaths?: string[];\n}\n\nconst UNSAFE_PATTERN = /\\bunsafe\\s*\\{|\\bunsafe\\s+fn\\b|\\bunsafe\\s+impl\\b/;\n\n/**\n * Check whether the lines preceding an unsafe block contain the required safety comment.\n */\nfunction hasJustificationComment(\n\tlines: string[],\n\tlineIndex: number,\n\trequiredComment: string,\n): boolean {\n\tfor (let j = lineIndex - 1; j >= Math.max(0, lineIndex - 5); j--) {\n\t\tconst prevLine = lines[j];\n\t\tif (prevLine === undefined) {\n\t\t\tcontinue;\n\t\t}\n\t\tconst trimmedPrev = prevLine.trim();\n\t\tif (trimmedPrev === \"\") {\n\t\t\tcontinue;\n\t\t}\n\t\tif (trimmedPrev.toUpperCase().includes(requiredComment.toUpperCase())) {\n\t\t\treturn true;\n\t\t}\n\t\t// Stop if we hit a non-comment, non-attribute line\n\t\tif (!(trimmedPrev.startsWith(\"//\") || trimmedPrev.startsWith(\"#[\"))) {\n\t\t\tbreak;\n\t\t}\n\t}\n\treturn false;\n}\n\n/**\n * Check if a file path should be excluded from the unsafe check.\n */\nfunction isExcluded(file: string, excludePaths: string[] | undefined): boolean {\n\tif (!excludePaths) {\n\t\treturn false;\n\t}\n\tfor (const excludePath of excludePaths) {\n\t\tif (file.includes(excludePath)) {\n\t\t\treturn true;\n\t\t}\n\t}\n\treturn false;\n}\n\n/**\n * A policy that requires SAFETY comments on unsafe blocks in Rust source files.\n *\n * @public\n */\nexport const NoUnsafeWithoutJustification = {\n\tname: \"NoUnsafeWithoutJustification\",\n\tdescription:\n\t\t\"Requires safety justification comments on unsafe blocks in Rust source files.\",\n\tmatch: /\\.rs$/,\n\thandler: async ({ file, root, config }) => {\n\t\tconst requiredComment = config?.requireComment ?? \"// SAFETY:\";\n\n\t\tif (isExcluded(file, config?.excludePaths)) {\n\t\t\treturn [];\n\t\t}\n\n\t\tconst content = await readFile(resolve(root, file), \"utf-8\");\n\t\tconst lines = content.split(\"\\n\");\n\t\tconst violations: string[] = [];\n\n\t\tfor (let i = 0; i < lines.length; i++) {\n\t\t\tconst line = lines[i];\n\t\t\tif (line === undefined) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst trimmed = line.trim();\n\n\t\t\t// Look for `unsafe` keyword usage (blocks, functions, impls)\n\t\t\tif (\n\t\t\t\tUNSAFE_PATTERN.test(trimmed) &&\n\t\t\t\t!hasJustificationComment(lines, i, requiredComment)\n\t\t\t) {\n\t\t\t\tviolations.push(\n\t\t\t\t\t`Line ${i + 1}: unsafe block without ${requiredComment} comment`,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\tif (violations.length > 0) {\n\t\t\treturn violations.map((message) => ({\n\t\t\t\tmessage,\n\t\t\t\tmanualFix: `Add a \"${requiredComment}\" comment above each unsafe block explaining why it is safe.`,\n\t\t\t}));\n\t\t}\n\t\treturn [];\n\t},\n} satisfies FilePolicyDefinition<NoUnsafeWithoutJustificationConfig>;\n"]}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { FilePolicyDefinition } from "../policy.js";
|
|
2
|
+
/**
|
|
3
|
+
* Configuration for the NoWildcardDependencies policy.
|
|
4
|
+
*
|
|
5
|
+
* @public
|
|
6
|
+
*/
|
|
7
|
+
export interface NoWildcardDependenciesConfig {
|
|
8
|
+
/**
|
|
9
|
+
* Version patterns to deny outright.
|
|
10
|
+
* @defaultValue ["*"]
|
|
11
|
+
*/
|
|
12
|
+
deny?: string[];
|
|
13
|
+
/**
|
|
14
|
+
* Version patterns to warn about.
|
|
15
|
+
* @defaultValue `[">="]`
|
|
16
|
+
*/
|
|
17
|
+
warn?: string[];
|
|
18
|
+
/**
|
|
19
|
+
* If true, dev-dependencies are checked more leniently (only deny, not warn).
|
|
20
|
+
* @defaultValue true
|
|
21
|
+
*/
|
|
22
|
+
allowDev?: boolean;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* A policy that prevents wildcard or overly permissive version specifications in Cargo.toml.
|
|
26
|
+
*
|
|
27
|
+
* @public
|
|
28
|
+
*/
|
|
29
|
+
export declare const NoWildcardDependencies: FilePolicyDefinition<NoWildcardDependenciesConfig>;
|
|
30
|
+
//# sourceMappingURL=NoWildcardDependencies.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NoWildcardDependencies.d.ts","sourceRoot":"","sources":["../../src/policies/NoWildcardDependencies.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAMzD;;;;GAIG;AACH,MAAM,WAAW,4BAA4B;IAC5C;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAEhB;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAEhB;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACnB;AAkED;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,oDA+C4B,CAAC"}
|