Skip to content

Commit c03a82c

Browse files
committed
fix sonarqube issues - unused imports, complexity, stringification
1 parent 8f4152e commit c03a82c

11 files changed

Lines changed: 93 additions & 61 deletions

File tree

src/components/forms/advanced-form/advanced-form.component.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { Component, computed, inject, signal } from '@angular/core';
22
import { CommonModule } from '@angular/common';
33
import { FormsModule } from '@angular/forms';
4-
import { KittyAdvancedConfig } from '../../../models/kitty-types';
54
import { NumberInputComponent } from '../../shared/number-input/number-input.component';
65
import { VersionBadgeComponent } from '../../shared/version-badge/version-badge.component';
76
import { createFormHelper } from '../../../utils/form-helpers';

src/components/forms/bell-form/bell-form.component.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { Component, computed, inject } from '@angular/core';
22
import { CommonModule } from '@angular/common';
33
import { FormsModule } from '@angular/forms';
4-
import { KittyBellConfig } from '../../../models/kitty-types';
54
import { NumberInputComponent } from '../../shared/number-input/number-input.component';
65
import { ColorInputComponent } from '../../shared/color-input/color-input.component';
76
import { VersionBadgeComponent } from '../../shared/version-badge/version-badge.component';

src/components/forms/fonts-form/fonts-form.component.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import { Component, computed, inject } from '@angular/core';
22
import { CommonModule } from '@angular/common';
33
import { FormsModule } from '@angular/forms';
44
import { FontPresetsService } from '../../../services/font-presets.service';
5-
import { KittyFontsConfig } from '../../../models/kitty-types';
65
import { NumberInputComponent } from '../../shared/number-input/number-input.component';
76
import { VersionBadgeComponent } from '../../shared/version-badge/version-badge.component';
87
import { SliderInputComponent } from '../../shared/slider-input/slider-input.component';
@@ -358,7 +357,7 @@ export class FontsFormComponent {
358357
}
359358

360359
setBoxDrawingScale(value: string): void {
361-
const scale = value.split(',').map(s => parseFloat(s.trim())).filter(n => !isNaN(n));
360+
const scale = value.split(',').map(s => Number.parseFloat(s.trim())).filter(n => !Number.isNaN(n));
362361
this.helper.updateField('box_drawing_scale', scale);
363362
}
364363

src/components/forms/os-specific-form/os-specific-form.component.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
import { Component } from '@angular/core';
1+
import { Component, inject } from '@angular/core';
22
import { CommonModule } from '@angular/common';
33
import { FormsModule } from '@angular/forms';
4-
import { KittyOSSpecificConfig } from '../../../models/kitty-types';
5-
import { VersionBadgeComponent } from '../../shared/version-badge/version-badge.component';
64
import { SliderInputComponent } from '../../shared/slider-input/slider-input.component';
75
import { NumberInputComponent } from '../../shared/number-input/number-input.component';
86
import { createFormHelper } from '../../../utils/form-helpers';

src/components/forms/performance-form/performance-form.component.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
1-
import { Component } from '@angular/core';
1+
import { Component, inject } from '@angular/core';
22
import { CommonModule } from '@angular/common';
3-
import { FormsModule } from '@angular/forms';
4-
import { KittyPerformanceConfig } from '../../../models/kitty-types';
5-
import { NumberInputComponent } from '../../shared/number-input/number-input.component';
63
import { SliderInputComponent } from '../../shared/slider-input/slider-input.component';
74
import { createFormHelper } from '../../../utils/form-helpers';
85

96
@Component({
107
selector: 'app-performance-form',
11-
imports: [CommonModule, FormsModule, SliderInputComponent],
8+
imports: [CommonModule, SliderInputComponent],
129
template: `
1310
<div class="space-y-6">
1411
<div>

src/components/forms/scrollback-form/scrollback-form.component.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { Component, computed, inject } from '@angular/core';
22
import { CommonModule } from '@angular/common';
33
import { FormsModule } from '@angular/forms';
4-
import { KittyScrollbackConfig } from '../../../models/kitty-types';
54
import { NumberInputComponent } from '../../shared/number-input/number-input.component';
65
import { VersionBadgeComponent } from '../../shared/version-badge/version-badge.component';
76
import { SliderInputComponent } from '../../shared/slider-input/slider-input.component';

src/components/forms/tab-bar-form/tab-bar-form.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Component, computed, inject } from '@angular/core';
22
import { CommonModule } from '@angular/common';
33
import { FormsModule } from '@angular/forms';
4-
import { KittyTabBarConfig, KittyTabBarEdge } from '../../../models/kitty-types';
4+
import { KittyTabBarEdge } from '../../../models/kitty-types';
55
import { NumberInputComponent } from '../../shared/number-input/number-input.component';
66
import { VersionBadgeComponent } from '../../shared/version-badge/version-badge.component';
77
import { createFormHelper } from '../../../utils/form-helpers';

src/components/forms/window-layout-form/window-layout-form.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Component, computed, inject } from '@angular/core';
22
import { CommonModule } from '@angular/common';
33
import { FormsModule } from '@angular/forms';
4-
import { KittyWindowLayoutConfig, KittyLayout } from '../../../models/kitty-types';
4+
import { KittyLayout } from '../../../models/kitty-types';
55
import { NumberInputComponent } from '../../shared/number-input/number-input.component';
66
import { VersionBadgeComponent } from '../../shared/version-badge/version-badge.component';
77
import { SliderInputComponent } from '../../shared/slider-input/slider-input.component';

src/components/live-preview/terminal-window.component.ts

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,21 @@ export class TerminalWindowComponent {
216216
cursorBlinking = computed(() => this.cursorCfg().cursor_blink_interval !== 0);
217217
urlColor = computed(() => this.mouseCfg().url_color || this.colors().color4 || '#0087bd');
218218

219-
private parseBorderWidth(val: string): string { if (!val || val === '0' || val === '0pt' || val === '0px') return '0px'; if (val.endsWith('pt')) { const n = Number.parseFloat(val); return `${Math.max(0, Math.round(n * 1.333))}px`; } return val.endsWith('px') ? val : '1px'; }
220-
private darken(hex: string, amount: number): string { if (!hex?.startsWith('#')) return '#333'; const c = hex.slice(1); if (c.length !== 6) return hex; const r = Math.max(0, Math.min(255, Number.parseInt(c.slice(0, 2), 16) - amount)); const g = Math.max(0, Math.min(255, Number.parseInt(c.slice(2, 4), 16) - amount)); const b = Math.max(0, Math.min(255, Number.parseInt(c.slice(4, 6), 16) - amount)); return `#${r.toString(16).padStart(2,'0')}${g.toString(16).padStart(2,'0')}${b.toString(16).padStart(2,'0')}`; }
219+
private parseBorderWidth(val: string): string {
220+
if (!val || val === '0' || val === '0pt' || val === '0px') return '0px';
221+
if (val.endsWith('pt')) {
222+
const n = Number.parseFloat(val);
223+
return `${Math.max(0, Math.round(n * 1.333))}px`;
224+
}
225+
return val.endsWith('px') ? val : '1px';
226+
}
227+
private darken(hex: string, amount: number): string {
228+
if (!hex?.startsWith('#')) return '#333';
229+
const c = hex.slice(1);
230+
if (c.length !== 6) return hex;
231+
const r = Math.max(0, Math.min(255, Number.parseInt(c.slice(0, 2), 16) - amount));
232+
const g = Math.max(0, Math.min(255, Number.parseInt(c.slice(2, 4), 16) - amount));
233+
const b = Math.max(0, Math.min(255, Number.parseInt(c.slice(4, 6), 16) - amount));
234+
return `#${r.toString(16).padStart(2,'0')}${g.toString(16).padStart(2,'0')}${b.toString(16).padStart(2,'0')}`;
235+
}
221236
}

src/index.html

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,6 @@
5757
<!-- PWA -->
5858
<link rel="manifest" href="/manifest.json" />
5959
<meta name="mobile-web-app-capable" content="yes" />
60-
61-
<!-- Verification (add your own) -->
62-
<!-- <meta name="google-site-verification" content="YOUR_CODE" /> -->
63-
<!-- <meta name="msvalidate.01" content="YOUR_CODE" /> -->
6460
<script>
6561
(function () {
6662
var saved = localStorage.getItem('confitty-theme');

0 commit comments

Comments
 (0)