From 92c0b7cce8e233e2de3417f1b35501e9f48d8790 Mon Sep 17 00:00:00 2001 From: David Watkins Date: Mon, 11 Sep 2023 17:36:53 +0100 Subject: [PATCH 1/2] Fixing minor code issues as reported by codefactor #6764 --- ...ionUtilities_getTimeUsingSupplierTest.java | 42 +++++++++++++++---- ...hysicalSpecificationIdSelectorFactory.java | 1 - .../generators/PhysicalFlowGenerator.java | 3 +- .../org/finos/waltz/model/either/Left.java | 10 ++++- .../org/finos/waltz/model/either/Right.java | 9 +++- waltz-ng/client/common/svelte/ViewLink.svelte | 4 +- .../calendar-heatmap/CalendarHeatmap.svelte | 3 +- .../data-flow/components/svelte/Arcs.svelte | 14 +++---- .../components/svelte/Categories.svelte | 3 ++ .../components/svelte/Clients.svelte | 1 + .../overlays/ApplicationChangesOverlay.svelte | 3 ++ .../panel/related-measurables-panel.scss | 4 +- .../svelte/ReportGridOverview.svelte | 4 +- waltz-ng/style/_waltz.scss | 6 +-- 14 files changed, 76 insertions(+), 31 deletions(-) diff --git a/waltz-common/src/test/java/org/finos/waltz/common/FunctionUtilities_getTimeUsingSupplierTest.java b/waltz-common/src/test/java/org/finos/waltz/common/FunctionUtilities_getTimeUsingSupplierTest.java index 9651eae15d..79607b114b 100644 --- a/waltz-common/src/test/java/org/finos/waltz/common/FunctionUtilities_getTimeUsingSupplierTest.java +++ b/waltz-common/src/test/java/org/finos/waltz/common/FunctionUtilities_getTimeUsingSupplierTest.java @@ -28,33 +28,59 @@ public class FunctionUtilities_getTimeUsingSupplierTest { @Test public void timeChecksHowLongAFunctionRunsFor() { - String result = FunctionUtilities.time("foo", Unchecked.supplier(() -> { - Thread.sleep(500); - return "a"; - })); + String result = FunctionUtilities.time( + "foo", + Unchecked.supplier(() -> { + Thread.sleep(500); + return "a"; + })); assertEquals("a", result); } + @Test public void timeWithFuncRunningForZeroSec() { - String result = FunctionUtilities.time("foo", Unchecked.supplier(() -> { Thread.sleep(0); return "a"; })); + String result = FunctionUtilities.time( + "foo", + Unchecked.supplier(() -> { + Thread.sleep(0); + return "a"; + })); assertEquals("a", result); } + @Test public void timeDurationOfFuncRunningForNegSec() throws IllegalArgumentException{ - FunctionUtilities.time("foo", Unchecked.supplier(() -> { Thread.sleep(-1); return "a"; })); + FunctionUtilities.time( + "foo", + Unchecked.supplier(() -> { + Thread.sleep(-1); + return "a"; + })); } + @Test public void timeDurationForFuncRunningWithEmptyName(){ - String result = FunctionUtilities.time("", Unchecked.supplier(() -> { Thread.sleep(500); return "a"; })); + String result = FunctionUtilities.time( + "", + Unchecked.supplier(() -> { + Thread.sleep(500); + return "a"; + })); assertEquals("a", result); } + @Test public void timeDurationForFuncRunningWithNullName(){ - String result = FunctionUtilities.time(null, Unchecked.supplier(() -> { Thread.sleep(500); return "a"; })); + String result = FunctionUtilities.time( + null, + Unchecked.supplier(() -> { + Thread.sleep(500); + return "a"; + })); assertEquals("a", result); } } diff --git a/waltz-data/src/main/java/org/finos/waltz/data/physical_specification/PhysicalSpecificationIdSelectorFactory.java b/waltz-data/src/main/java/org/finos/waltz/data/physical_specification/PhysicalSpecificationIdSelectorFactory.java index 8cb67b7fd1..bdf43cd673 100644 --- a/waltz-data/src/main/java/org/finos/waltz/data/physical_specification/PhysicalSpecificationIdSelectorFactory.java +++ b/waltz-data/src/main/java/org/finos/waltz/data/physical_specification/PhysicalSpecificationIdSelectorFactory.java @@ -92,7 +92,6 @@ private Select> mkForApplication(IdSelectionOptions options) { .innerJoin(LOGICAL_FLOW).on(PHYSICAL_FLOW.LOGICAL_FLOW_ID.eq(LOGICAL_FLOW.ID)) .where(isSourceOrTarget) .and(lifecycleCondition); - ; SelectConditionStep> specsOwnedByApp = DSL .select(PHYSICAL_SPECIFICATION.ID) diff --git a/waltz-jobs/src/main/java/org/finos/waltz/jobs/generators/PhysicalFlowGenerator.java b/waltz-jobs/src/main/java/org/finos/waltz/jobs/generators/PhysicalFlowGenerator.java index c67a271e61..868c31b580 100644 --- a/waltz-jobs/src/main/java/org/finos/waltz/jobs/generators/PhysicalFlowGenerator.java +++ b/waltz-jobs/src/main/java/org/finos/waltz/jobs/generators/PhysicalFlowGenerator.java @@ -152,7 +152,8 @@ public Map create(ApplicationContext ctx) { log(String.format("--- saving records: count: %s", flowBatch.size())); dsl.batchInsert(flowBatch).execute(); flowBatch.clear(); - log("---done"); return null; + log("---done"); + return null; } diff --git a/waltz-model/src/main/java/org/finos/waltz/model/either/Left.java b/waltz-model/src/main/java/org/finos/waltz/model/either/Left.java index d72e18c553..e03e03656b 100644 --- a/waltz-model/src/main/java/org/finos/waltz/model/either/Left.java +++ b/waltz-model/src/main/java/org/finos/waltz/model/either/Left.java @@ -14,6 +14,12 @@ public R right() { @Override public abstract L left(); - public boolean isRight() { return false; }; - public boolean isLeft() { return true; }; + public boolean isRight() { + return false; + } + + + public boolean isLeft() { + return true; + } } diff --git a/waltz-model/src/main/java/org/finos/waltz/model/either/Right.java b/waltz-model/src/main/java/org/finos/waltz/model/either/Right.java index e54ab3c293..6ad5425d4a 100644 --- a/waltz-model/src/main/java/org/finos/waltz/model/either/Right.java +++ b/waltz-model/src/main/java/org/finos/waltz/model/either/Right.java @@ -14,7 +14,12 @@ public L left() { @Override public abstract R right(); - public boolean isRight() { return true; }; - public boolean isLeft() { return false; }; + public boolean isRight() { + return true; + } + + public boolean isLeft() { + return false; + } } diff --git a/waltz-ng/client/common/svelte/ViewLink.svelte b/waltz-ng/client/common/svelte/ViewLink.svelte index 2067927b6b..a3b148a295 100644 --- a/waltz-ng/client/common/svelte/ViewLink.svelte +++ b/waltz-ng/client/common/svelte/ViewLink.svelte @@ -66,7 +66,7 @@ title: "Legal Entity Relationship Kind View" }, "main.legal-entity-relationship-kind.list": { - path: ctx => `legal-entity-relationship-kind/list`, + path: () => `legal-entity-relationship-kind/list`, title: "Legal Entity Relationship Kind List" }, "main.logical-flow.view": { @@ -110,7 +110,7 @@ title: "Survey Edit" }, "main.involvement-kind.list": { - path: ctx => `involvement-kind/list`, + path: () => `involvement-kind/list`, title: "Involvement Kind List" }, "main.involvement-kind.view": { diff --git a/waltz-ng/client/common/svelte/calendar-heatmap/CalendarHeatmap.svelte b/waltz-ng/client/common/svelte/calendar-heatmap/CalendarHeatmap.svelte index dc877332b1..0247227ea1 100644 --- a/waltz-ng/client/common/svelte/calendar-heatmap/CalendarHeatmap.svelte +++ b/waltz-ng/client/common/svelte/calendar-heatmap/CalendarHeatmap.svelte @@ -55,7 +55,8 @@ onSelectMonth(_.map(monthData.days, d => d.date))} - on:keydown={() => onSelectMonth(_.map(monthData.days, d => d.date))}> + on:keydown={() => onSelectMonth(_.map(monthData.days, d => d.date))} + role="button"> {format(monthData?.startDate)} {#each reverse(def.colorStops) as colorStop} - - + + {/each} - + {#each def.colorStops as colorStop} @@ -158,8 +158,8 @@ {#each reverse(def.colorStops) as colorStop} - - + + {/each} diff --git a/waltz-ng/client/data-flow/components/svelte/Categories.svelte b/waltz-ng/client/data-flow/components/svelte/Categories.svelte index 957d72445b..991086968e 100644 --- a/waltz-ng/client/data-flow/components/svelte/Categories.svelte +++ b/waltz-ng/client/data-flow/components/svelte/Categories.svelte @@ -70,6 +70,7 @@ onMouseEnter(category)} on:mouseleave={() => onMouseLeave()} rx={dimensions.category.height / 2} @@ -84,6 +85,7 @@ navigateToCategory(category)} on:keydown|stopPropagation={() => navigateToCategory(category)} class="clickable navigation-circle"> @@ -99,6 +101,7 @@ navigateToCategory($parentCategory)} on:keydown|stopPropagation={() => navigateToCategory($parentCategory)} class="clickable navigation-circle"> diff --git a/waltz-ng/client/data-flow/components/svelte/Clients.svelte b/waltz-ng/client/data-flow/components/svelte/Clients.svelte index 5007af96bc..e50249d14e 100644 --- a/waltz-ng/client/data-flow/components/svelte/Clients.svelte +++ b/waltz-ng/client/data-flow/components/svelte/Clients.svelte @@ -42,6 +42,7 @@ {#each $displayedClients as client} selectClient(client)} on:keydown|stopPropagation={() => selectClient(client)}> clickAppCount()} on:keydown={() => clickAppCount()} width={width * graphWidthProportion} @@ -170,6 +171,7 @@ clickChart(outboundCount, "Outbound")} on:keydown={d => clickChart(outboundCount, "Outbound")} width={yearScale.bandwidth() / 4} @@ -195,6 +197,7 @@ clickChart(inboundCount, "Inbound")} on:keydown={d => clickChart(inboundCount, "Inbound")} width={yearScale.bandwidth() / 4} diff --git a/waltz-ng/client/measurable-relationship/components/panel/related-measurables-panel.scss b/waltz-ng/client/measurable-relationship/components/panel/related-measurables-panel.scss index 2239c93aed..6cb3697408 100644 --- a/waltz-ng/client/measurable-relationship/components/panel/related-measurables-panel.scss +++ b/waltz-ng/client/measurable-relationship/components/panel/related-measurables-panel.scss @@ -21,8 +21,8 @@ border: 1px solid #ccc; border-radius: 3px; - padding: 0 4px 0 4px; - margin: 0 4px 0 4px; + padding: 0 4px; + margin: 0 4px; vertical-align: center; &.wrmp-counterpart { diff --git a/waltz-ng/client/report-grid/components/svelte/ReportGridOverview.svelte b/waltz-ng/client/report-grid/components/svelte/ReportGridOverview.svelte index c56ab1e2c4..cd7842326a 100644 --- a/waltz-ng/client/report-grid/components/svelte/ReportGridOverview.svelte +++ b/waltz-ng/client/report-grid/components/svelte/ReportGridOverview.svelte @@ -91,12 +91,12 @@ let rmPromise = reportGridStore.remove(grid.id); Promise.resolve(rmPromise) - .then(r => { + .then(() => { toasts.success("Grid removed successfully") gridService.reset(); reportGridStore.findInfoForUser(true); }) - .catch(e => toasts.error("Could not remove grid")); + .catch(e => toasts.error("Could not remove grid. " + e.error)); } function saveReportGrid(grid) { diff --git a/waltz-ng/style/_waltz.scss b/waltz-ng/style/_waltz.scss index b3dadd49df..a7d41e9322 100644 --- a/waltz-ng/style/_waltz.scss +++ b/waltz-ng/style/_waltz.scss @@ -264,7 +264,7 @@ textarea { border: 1px solid #ccc; font-size: x-small; margin: auto; - padding: 0 3px 0 3px; + padding: 0 3px; } @@ -316,7 +316,7 @@ textarea { .waltz-detail-callout { background-color: lighten($waltz-background-color, 0.5); - padding: 0 6px 4px 6px; + padding: 0 6px 4px; border-radius: 3px; border: 1px solid $waltz-border-color-lighter; @include waltz-box-shadow(); @@ -419,7 +419,7 @@ a.subtle-link:hover { width: 10px; :first-of-type(span) { - padding: 5px 5px; + padding: 5px; } } } From 54115aa5701191660feb767ec7147dbfd16a9469 Mon Sep 17 00:00:00 2001 From: David Watkins Date: Tue, 12 Sep 2023 22:10:07 +0100 Subject: [PATCH 2/2] #6764 --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 824f981b3c..a25e852395 100644 --- a/.gitignore +++ b/.gitignore @@ -21,3 +21,4 @@ npm-debug.log /waltz-ng/.vscode/ pom.xml.versionsBackup /waltz-test-common/screenshots/ +/waltz-ng/mocha-test-results.txt