Skip to content

Commit

Permalink
Merge pull request finos#6768 from davidwatkins73/waltz-6764-codefactor
Browse files Browse the repository at this point in the history
codefactor
  • Loading branch information
jessica-woodland-scott-db authored Sep 18, 2023
2 parents ed36530 + 54115aa commit 712265d
Show file tree
Hide file tree
Showing 15 changed files with 77 additions and 31 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@ npm-debug.log
/waltz-ng/.vscode/
pom.xml.versionsBackup
/waltz-test-common/screenshots/
/waltz-ng/mocha-test-results.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ private Select<Record1<Long>> mkForApplication(IdSelectionOptions options) {
.innerJoin(LOGICAL_FLOW).on(PHYSICAL_FLOW.LOGICAL_FLOW_ID.eq(LOGICAL_FLOW.ID))
.where(isSourceOrTarget)
.and(lifecycleCondition);
;

SelectConditionStep<Record1<Long>> specsOwnedByApp = DSL
.select(PHYSICAL_SPECIFICATION.ID)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,8 @@ public Map<String, Integer> 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;
}


Expand Down
10 changes: 8 additions & 2 deletions waltz-model/src/main/java/org/finos/waltz/model/either/Left.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

}
4 changes: 2 additions & 2 deletions waltz-ng/client/common/svelte/ViewLink.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down Expand Up @@ -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": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@
<g transform={`translate(${determineColumn(idx) * dimensions.month.width}, ${determineRow(idx) * dimensions.month.height})`}>
<g on:click={() => 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">
<title>{format(monthData?.startDate)}</title>
<rect width={dimensions.month.width}
Expand Down
14 changes: 7 additions & 7 deletions waltz-ng/client/data-flow/components/svelte/Arcs.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,15 @@
$rainbowTipProportion = 0.35;
selectAll(`.arc.showing.highlight`)
.each(function(d, i){
.each(function() {
const elem = select(this);
const arcId = elem.attr("data-arc-id");
const isLinear = elem.attr("linear");
elem.attr("stroke", isLinear === "true" ? `url(#dynamic_linear_grad_${arcId})` : `url(#dynamic_grad_${arcId})`);
});
} else {
selectAll(`.arc.showing.highlight`)
.each(function(d, i){
.each(function() {
const elem = select(this);
const arcId = elem.attr("data-arc-id");
const isLinear = elem.attr("linear");
Expand Down Expand Up @@ -146,10 +146,10 @@
<!-- DYNAMIC -->
<linearGradient id={`dynamic_grad_${def.defId}`} gradientUnits="objectBoundingBox">
{#each reverse(def.colorStops) as colorStop}
<stop stop-color={colorStop.color} offset={(0 + $rainbowTipProportion) - colorStop.offsetEnd * $rainbowTipProportion}/>
<stop stop-color={colorStop.color} offset={(0 + $rainbowTipProportion) - colorStop.offsetStart * $rainbowTipProportion}/>
<stop stop-color={colorStop.color} offset={($rainbowTipProportion) - colorStop.offsetEnd * $rainbowTipProportion}/>
<stop stop-color={colorStop.color} offset={($rainbowTipProportion) - colorStop.offsetStart * $rainbowTipProportion}/>
{/each}
<stop stop-color={def.color} offset={0 + $rainbowTipProportion}/> <!-- middle of bar is solid color -->
<stop stop-color={def.color} offset={$rainbowTipProportion}/> <!-- middle of bar is solid color -->
<stop stop-color={def.color} offset={1 - $rainbowTipProportion}/> <!-- rainbow tip - main color - rainbow tip -->
{#each def.colorStops as colorStop}
<stop stop-color={colorStop.color} offset={(1 - $rainbowTipProportion) + colorStop.offsetStart * $rainbowTipProportion}/>
Expand All @@ -158,8 +158,8 @@
</linearGradient>
<linearGradient id={`dynamic_linear_grad_${def.defId}`} gradientUnits="userSpaceOnUse">
{#each reverse(def.colorStops) as colorStop}
<stop stop-color={colorStop.color} offset={(0 + $rainbowTipProportion + 0.08) - colorStop.offsetEnd * ($rainbowTipProportion + 0.08)}/>
<stop stop-color={colorStop.color} offset={(0 + $rainbowTipProportion + 0.08) - colorStop.offsetStart * ($rainbowTipProportion + 0.08)}/>
<stop stop-color={colorStop.color} offset={($rainbowTipProportion + 0.08) - colorStop.offsetEnd * ($rainbowTipProportion + 0.08)}/>
<stop stop-color={colorStop.color} offset={($rainbowTipProportion + 0.08) - colorStop.offsetStart * ($rainbowTipProportion + 0.08)}/>
{/each}
<stop stop-color={def.color} offset={0 + $rainbowTipProportion + 0.1}/> <!-- middle of bar is solid color -->
<stop stop-color={def.color} offset={1 - $rainbowTipProportion - 0.1}/> <!-- rainbow tip - main color - rainbow tip -->
Expand Down
3 changes: 3 additions & 0 deletions waltz-ng/client/data-flow/components/svelte/Categories.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
<g transform={`translate(0, ${$categoryScale(category.id)})`}
class="no-text-select category">
<rect class="pill"
role="button"
on:mouseenter={() => onMouseEnter(category)}
on:mouseleave={() => onMouseLeave()}
rx={dimensions.category.height / 2}
Expand All @@ -84,6 +85,7 @@
<g transform={mkTranslateStr(downNavigationOffset)}
class="navigation-control">
<path d={symbol().type(symbolCircle).size(500)()}
role="button"
on:click|stopPropagation={() => navigateToCategory(category)}
on:keydown|stopPropagation={() => navigateToCategory(category)}
class="clickable navigation-circle">
Expand All @@ -99,6 +101,7 @@
<g transform={mkTranslateStr(upNavigationOffset)}
class="navigation-control">
<path d={symbol().type(symbolCircle).size(500)()}
role="button"
on:click|stopPropagation={() => navigateToCategory($parentCategory)}
on:keydown|stopPropagation={() => navigateToCategory($parentCategory)}
class="clickable navigation-circle">
Expand Down
1 change: 1 addition & 0 deletions waltz-ng/client/data-flow/components/svelte/Clients.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
{#each $displayedClients as client}
<g transform={`translate(0, ${$clientScale(client.id)})`}
class={mkClasses(client)}
role="button"
on:click|stopPropagation={() => selectClient(client)}
on:keydown|stopPropagation={() => selectClient(client)}>
<rect stroke={getNodeColors(client.kind).stroke}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@
<g class="app-summary">
<rect x="0"
y={height - (height * appCountProportion + height * paddingProportion)}
role="button"
on:click={() => clickAppCount()}
on:keydown={() => clickAppCount()}
width={width * graphWidthProportion}
Expand Down Expand Up @@ -170,6 +171,7 @@
</rect>
<rect x={columnScale(outboundCount.quarter.additionalQuarters)}
y={countScale(0)}
role="button"
on:click={() => clickChart(outboundCount, "Outbound")}
on:keydown={d => clickChart(outboundCount, "Outbound")}
width={yearScale.bandwidth() / 4}
Expand All @@ -195,6 +197,7 @@
</rect>
<rect x={columnScale(inboundCount.quarter.additionalQuarters)}
y="0"
role="button"
on:click={() => clickChart(inboundCount, "Inbound")}
on:keydown={d => clickChart(inboundCount, "Inbound")}
width={yearScale.bandwidth() / 4}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
6 changes: 3 additions & 3 deletions waltz-ng/style/_waltz.scss
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ textarea {
border: 1px solid #ccc;
font-size: x-small;
margin: auto;
padding: 0 3px 0 3px;
padding: 0 3px;
}


Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -419,7 +419,7 @@ a.subtle-link:hover {
width: 10px;

:first-of-type(span) {
padding: 5px 5px;
padding: 5px;
}
}
}
Expand Down

0 comments on commit 712265d

Please sign in to comment.