Skip to content

Commit

Permalink
fix: applies suggestions from code review
Browse files Browse the repository at this point in the history
  • Loading branch information
sverweij authored Jul 20, 2024
1 parent e45a960 commit b4bf557
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 12 deletions.
1 change: 0 additions & 1 deletion src/config-utl/extract-depcruise-config/merge-configs.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { isDeepStrictEqual } from "node:util";

import { uniqBy, uniqWith } from "#utl/array-util.mjs";

function extendNamedRule(pExtendedRule, pForbiddenArrayBase) {
Expand Down
1 change: 0 additions & 1 deletion src/enrich/summarize/summarize-modules.mjs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import isSameViolation from "./is-same-violation.mjs";
import { findRuleByName } from "#graph-utl/rule-set.mjs";
import compare from "#graph-utl/compare.mjs";

import { uniqWith } from "#utl/array-util.mjs";

function cutNonTransgressions(pModule) {
Expand Down
5 changes: 2 additions & 3 deletions src/main/rule-set/assert-validity.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import safeRegex from "safe-regex";
import { assertCruiseOptionsValid } from "../options/assert-validity.mjs";
import { normalizeToREAsString } from "../helpers.mjs";
import configurationSchema from "#configuration-schema";

import { has, get } from "#utl/object-util.mjs";

const ajv = new Ajv();
Expand All @@ -29,8 +28,8 @@ function assertSchemaCompliance(pSchema, pConfiguration) {
}

function hasPath(pObject, pSection, pCondition) {
// pCondition can be nested properties, so we use _.has instead
// of elvis operators
// pCondition can be nested properties, so we use a bespoke
// 'has' function instead of simple elvis operators
return has(pObject, pSection) && has(pObject[pSection], pCondition);
}

Expand Down
4 changes: 2 additions & 2 deletions src/report/dot/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,8 @@ function pryReporterOptionsFromResults(pGranularity, pResults) {
const lFallbackReporterOptions =
pResults?.summary?.optionsUsed?.reporterOptions?.dot;

// using _.get here because the reporter options will contain nested
// properties, which it handles for us
// using a bespoke 'get' function here because the reporter options will
// contain nested properties, which it handles for us
return get(
pResults,
GRANULARITY2REPORTER_OPTIONS.get(pGranularity),
Expand Down
7 changes: 3 additions & 4 deletions src/report/dot/theming.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,9 @@ function moduleOrDependencyMatchesCriteria(pSchemeEntry, pModule) {
// To get the criterion treat that key as a string and not as a path
// eslint-disable-next-line security/detect-object-injection
const lCriterion = pSchemeEntry.criteria[pKey];
// we use _.get here because in the criteria you can enter
// nested keys like "rules[0].severity" : "error", and _.get handles
// that for us
// console.error(pSchemeEntry.criteria, pKey, pc.bold(lCriterion));
// we use a bespoke 'get' here because in the criteria you can enter
// nested keys like "rules[0].severity" : "error", and that function
// handles those for us
const lModuleKey = get(pModule, pKey);

if (!(lModuleKey || has(pModule, pKey))) {
Expand Down
1 change: 0 additions & 1 deletion test/cli/index.spec.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,6 @@ function setModuleType(pTestPairs, pModuleType) {

function runFileBasedTests(pModuleType) {
setModuleType(TEST_PAIRS, pModuleType).forEach((pPair) => {
// if (pPair.description === "regular dot with default theme")
it(pPair.description, async () => {
const lExitCode = await cli([pPair.dirOrFile], pPair.options);

Expand Down

0 comments on commit b4bf557

Please sign in to comment.