Skip to content

Commit

Permalink
code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
schaeferka committed Oct 29, 2024
1 parent f1546a3 commit c74e641
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 17 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/dependency-review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ jobs:
- name: Circular Dependency Check
run: |
npx madge --circular --ts-config tsconfig.json --extensions ts,js src/ > tmp.log || true # Force exit 0 for post-processing
tail -n +4 tmp.log > circular-deps.log
if [ $(wc -l < circular-deps.log) -gt 4 ]; then
echo "circular-deps.log has more than 4 circular dependencies."
tail -n +6 tmp.log > circular-deps.log
if [ $(wc -l < circular-deps.log) -gt 6 ]; then
echo "circular-deps.log has more than 6 circular dependencies."
wc -l circular-deps.log
exit 1
else
echo "circular-deps.log has 4 or fewer circular dependencies."
echo "circular-deps.log has 6 or fewer circular dependencies."
exit 0
fi
3 changes: 3 additions & 0 deletions src/lib/assets/pods.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: 2023-Present The Pepr Authors

import { namespace, watcher, deployment, moduleSecret, genEnv } from "./pods";
import { expect, describe, test, jest, afterEach } from "@jest/globals";
import { AssetsConfig } from "./assetsConfig";
Expand Down
1 change: 0 additions & 1 deletion src/lib/capability.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable max-statements */
import { Capability } from "./capability";
import Log from "./logger";
import { AdmissionRequest, CapabilityCfg, FinalizeAction, MutateAction, ValidateAction, WatchLogAction } from "./types";
Expand Down
15 changes: 3 additions & 12 deletions src/lib/capability.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable max-statements */
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: 2023-Present The Pepr Authors

Expand All @@ -24,7 +23,7 @@ import {
WhenSelector,
} from "./types";
import { Event } from "./enums";
import { PeprMutateRequest } from "./mutate-request";
import { addFinalizer } from "./finalizer";

const registerAdmission = isBuildMode() || !isWatchMode();
const registerWatch = isBuildMode() || isWatchMode() || isDevMode();
Expand Down Expand Up @@ -313,20 +312,12 @@ export class Capability implements CapabilityExport {

// Add binding to inject Pepr finalizer during admission (Mutate)
if (registerAdmission) {
const mutateBinding: Binding = {
const mutateBinding = {
...binding,
isMutate: true,
isFinalize: true,
event: Event.Any,
mutateCallback: async (req, logger) => {
// Wrap req as IPeprMutateRequest
const peprRequest = new PeprMutateRequest(req.Request) as PeprMutateRequest<typeof req.Raw>;

// Ensure the original mutate callback is called with the wrapped request
if (binding.mutateCallback) {
await binding.mutateCallback(peprRequest, logger);
}
},
mutateCallback: addFinalizer,
};
bindings.push(mutateBinding);
}
Expand Down

0 comments on commit c74e641

Please sign in to comment.