From 9e2aae7b41cb85a85c164c2f1b4d6a06e2b365db Mon Sep 17 00:00:00 2001 From: Lyndros <38167685+Lyndros@users.noreply.github.com> Date: Tue, 1 Sep 2026 10:11:57 +0200 Subject: [PATCH] Improved nested ternary by using early return (Sonarqube S3358) --- CHANGELOG.md | 6 ++++++ .../portfolio-proportion-chart.component.ts | 12 +++++++----- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bf8ec7c268..08b85d7300 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## Unreleased + +### Added + +- Improved nested ternary by using early return (Sonarqube S3358) + ## 3.65.0 - 2026-08-31 ### Added diff --git a/libs/ui/src/lib/portfolio-proportion-chart/portfolio-proportion-chart.component.ts b/libs/ui/src/lib/portfolio-proportion-chart/portfolio-proportion-chart.component.ts index b50f89a8eb..9a215ee5b3 100644 --- a/libs/ui/src/lib/portfolio-proportion-chart/portfolio-proportion-chart.component.ts +++ b/libs/ui/src/lib/portfolio-proportion-chart/portfolio-proportion-chart.component.ts @@ -397,11 +397,13 @@ export class GfPortfolioProportionChartComponent context.dataIndex ] as string; - return value > 0 - ? isUUID(symbol) - ? (this.data[symbol]?.name ?? symbol) - : symbol - : ''; + if (value <= 0) { + return ''; + } + + return isUUID(symbol) + ? (this.data[symbol]?.name ?? symbol) + : symbol; }, offset: 8 }