Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
31 changes: 30 additions & 1 deletion src/Umbraco.Web.UI.Client/devops/icons/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* eslint-disable local-rules/enforce-umbraco-external-imports */

Check notice on line 1 in src/Umbraco.Web.UI.Client/devops/icons/index.js

View check run for this annotation

CodeScene Delta Analysis / CodeScene Code Health Review (main)

✅ No longer an issue: Large Method

collectDictionaryIcons is no longer above the threshold for lines of code
import { readFileSync, writeFile, mkdir, rmSync } from 'fs';
import * as pathModule from 'path';
import * as globModule from 'tiny-glob';
Expand All @@ -15,6 +15,7 @@

const lucideSvgDirectory = 'node_modules/lucide-static/icons';
const simpleIconsSvgDirectory = 'node_modules/simple-icons/icons';
const customSvgDirectory = `${moduleDirectory}/svgs/custom`;

const IS_GITHUB_ACTIONS = process.env.GITHUB_ACTIONS === 'true';

Expand Down Expand Up @@ -124,11 +125,39 @@
}
});

// Custom:
if (fileJSON['custom']) {
fileJSON['custom'].forEach((iconDef) => {
if (iconDef.file && iconDef.name) {
const path = customSvgDirectory + '/' + iconDef.file;
Copy link

Copilot AI Nov 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use path joining utility instead of string concatenation. Consider using Node.js path.join() for more robust cross-platform path handling.

Suggested change
const path = customSvgDirectory + '/' + iconDef.file;
const path = path.join(customSvgDirectory, iconDef.file);

Copilot uses AI. Check for mistakes.

try {
const rawData = readFileSync(path);
const svg = rawData.toString();
const iconFileName = iconDef.name;

const icon = {
name: iconDef.name,
legacy: iconDef.legacy,
fileName: iconFileName,
svg,
output: `${iconsOutputDirectory}/${iconFileName}.ts`,
};

icons.push(icon);
} catch {
errors.push(`[Custom] Could not load file: '${path}'`);
console.log(`[Custom] Could not load file: '${path}'`);
Comment on lines +148 to +150
Copy link

Copilot AI Nov 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The catch block silently swallows errors without logging the actual error details. Consider capturing and logging the error parameter (e.g., catch (error)) to aid in debugging file loading issues.

Copilot uses AI. Check for mistakes.
}
}
});
}

Check warning on line 155 in src/Umbraco.Web.UI.Client/devops/icons/index.js

View check run for this annotation

CodeScene Delta Analysis / CodeScene Code Health Review (main)

❌ New issue: Complex Method

collectDictionaryIcons has a cyclomatic complexity of 11, threshold = 9. This function has many conditional statements (e.g. if, for, while), leading to lower code health. Avoid adding more conditionals and code to it without refactoring.

Check warning on line 155 in src/Umbraco.Web.UI.Client/devops/icons/index.js

View check run for this annotation

CodeScene Delta Analysis / CodeScene Code Health Review (main)

❌ New issue: Bumpy Road Ahead

collectDictionaryIcons has 2 blocks with nested conditional logic. Any nesting of 2 or deeper is considered. Threshold is 2 blocks per function. The Bumpy Road code smell is a function that contains multiple chunks of nested conditional logic. The deeper the nesting and the more bumps, the lower the code health.
return icons;
};

const collectDiskIcons = async (icons) => {
const iconPaths = await glob(`${umbracoSvgDirectory}/icon-*.svg`);
const iconPaths = await glob(`${umbracoSvgDirectory}/legacy/icon-*.svg`);

iconPaths.forEach((path) => {
const rawData = readFileSync(path);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2593,6 +2593,7 @@
"file": "land-plot.svg"
}
],
"custom": [],
"simpleIcons": [
{
"name": "icon-facebook",
Expand Down Expand Up @@ -2626,282 +2627,282 @@
"umbraco": [
{
"name": "icon-art-easel",
"file": "icon-art-easel.svg",
"file": "legacy/icon-art-easel.svg",
"legacy": true
},
{
"name": "icon-article",
"file": "icon-article.svg",
"file": "legacy/icon-article.svg",
"legacy": true
},
{
"name": "icon-auction-hammer",
"file": "icon-auction-hammer.svg",
"file": "legacy/icon-auction-hammer.svg",
"legacy": true
},
{
"name": "icon-badge-count",
"file": "icon-badge-count.svg",
"file": "legacy/icon-badge-count.svg",
"legacy": true
},
{
"name": "icon-band-aid",
"file": "icon-band-aid.svg",
"file": "legacy/icon-band-aid.svg",
"legacy": true
},
{
"name": "icon-baby-stroller",
"file": "icon-baby-stroller.svg",
"file": "legacy/icon-baby-stroller.svg",
"legacy": true
},
{
"name": "icon-bill-dollar",
"file": "icon-bill-dollar.svg",
"file": "legacy/icon-bill-dollar.svg",
"legacy": true
},
{
"name": "icon-bill-euro",
"file": "icon-bill-euro.svg",
"file": "legacy/icon-bill-euro.svg",
"legacy": true
},
{
"name": "icon-bill-pound",
"file": "icon-bill-pound.svg",
"file": "legacy/icon-bill-pound.svg",
"legacy": true
},
{
"name": "icon-bill-yen",
"file": "icon-bill-yen.svg",
"file": "legacy/icon-bill-yen.svg",
"legacy": true
},
{
"name": "icon-bill",
"file": "icon-bill.svg",
"file": "legacy/icon-bill.svg",
"legacy": true
},
{
"name": "icon-billboard",
"file": "icon-billboard.svg",
"file": "legacy/icon-billboard.svg",
"legacy": true
},
{
"name": "icon-bills-dollar",
"file": "icon-bills-dollar.svg",
"file": "legacy/icon-bills-dollar.svg",
"legacy": true
},
{
"name": "icon-bills-euro",
"file": "icon-bills-euro.svg",
"file": "legacy/icon-bills-euro.svg",
"legacy": true
},
{
"name": "icon-bills-pound",
"file": "icon-bills-pound.svg",
"file": "legacy/icon-bills-pound.svg",
"legacy": true
},
{
"name": "icon-bills-yen",
"file": "icon-bills-yen.svg",
"file": "legacy/icon-bills-yen.svg",
"legacy": true
},
{
"name": "icon-bills",
"file": "icon-bills.svg",
"file": "legacy/icon-bills.svg",
"legacy": true
},
{
"name": "icon-blueprint",
"file": "icon-blueprint.svg",
"file": "legacy/icon-blueprint.svg",
"legacy": true
},
{
"name": "icon-bomb",
"file": "icon-bomb.svg",
"file": "legacy/icon-bomb.svg",
"legacy": true
},
{
"name": "icon-cash-register",
"file": "icon-cash-register.svg",
"file": "legacy/icon-cash-register.svg",
"legacy": true
},
{
"name": "icon-checkbox-dotted-active",
"file": "icon-checkbox-dotted-active.svg",
"file": "legacy/icon-checkbox-dotted-active.svg",
"legacy": true
},
{
"name": "icon-chess",
"file": "icon-chess.svg",
"file": "legacy/icon-chess.svg",
"legacy": true
},
{
"name": "icon-circus",
"file": "icon-circus.svg",
"file": "legacy/icon-circus.svg",
"legacy": true
},
{
"name": "icon-clothes-hanger",
"file": "icon-clothes-hanger.svg",
"file": "legacy/icon-clothes-hanger.svg",
"legacy": true
},
{
"name": "icon-coin",
"file": "icon-coin.svg",
"file": "legacy/icon-coin.svg",
"legacy": true
},
{
"name": "icon-coins-dollar-alt",
"file": "icon-coins-dollar-alt.svg",
"file": "legacy/icon-coins-dollar-alt.svg",
"legacy": true
},
{
"name": "icon-coins-dollar",
"file": "icon-coins-dollar.svg",
"file": "legacy/icon-coins-dollar.svg",
"legacy": true
},
{
"name": "icon-coins-euro-alt",
"file": "icon-coins-euro-alt.svg",
"file": "legacy/icon-coins-euro-alt.svg",
"legacy": true
},
{
"name": "icon-coins-euro",
"file": "icon-coins-euro.svg",
"file": "legacy/icon-coins-euro.svg",
"legacy": true
},
{
"name": "icon-coins-pound-alt",
"file": "icon-coins-pound-alt.svg",
"file": "legacy/icon-coins-pound-alt.svg",
"legacy": true
},
{
"name": "icon-coins-pound",
"file": "icon-coins-pound.svg",
"file": "legacy/icon-coins-pound.svg",
"legacy": true
},
{
"name": "icon-coins-yen-alt",
"file": "icon-coins-yen-alt.svg",
"file": "legacy/icon-coins-yen-alt.svg",
"legacy": true
},
{
"name": "icon-coins-yen",
"file": "icon-coins-yen.svg",
"file": "legacy/icon-coins-yen.svg",
"legacy": true
},
{
"name": "icon-comb",
"file": "icon-comb.svg",
"file": "legacy/icon-comb.svg",
"legacy": true
},
{
"name": "icon-desk",
"file": "icon-desk.svg",
"file": "legacy/icon-desk.svg",
"legacy": true
},
{
"name": "icon-dollar-bag",
"file": "icon-dollar-bag.svg",
"file": "legacy/icon-dollar-bag.svg",
"legacy": true
},
{
"name": "icon-eject",
"file": "icon-eject.svg",
"file": "legacy/icon-eject.svg",
"legacy": true
},
{
"name": "icon-euro-bag",
"file": "icon-euro-bag.svg",
"file": "legacy/icon-euro-bag.svg",
"legacy": true
},
{
"name": "icon-female-symbol",
"file": "icon-female-symbol.svg",
"file": "legacy/icon-female-symbol.svg",
"legacy": true
},
{
"name": "icon-firewall",
"file": "icon-firewall.svg",
"file": "legacy/icon-firewall.svg",
"legacy": true
},
{
"name": "icon-folder-open",
"file": "icon-folder-open.svg",
"file": "legacy/icon-folder-open.svg",
"legacy": true
},
{
"name": "icon-folder-outline",
"file": "icon-folder-outline.svg",
"file": "legacy/icon-folder-outline.svg",
"legacy": true
},
{
"name": "icon-handprint",
"file": "icon-handprint.svg",
"file": "legacy/icon-handprint.svg",
"legacy": true
},
{
"name": "icon-hat",
"file": "icon-hat.svg",
"file": "legacy/icon-hat.svg",
"legacy": true
},
{
"name": "icon-hd",
"file": "icon-hd.svg",
"file": "legacy/icon-hd.svg",
"legacy": true
},
{
"name": "icon-inactive-line",
"file": "icon-inactive-line.svg",
"file": "legacy/icon-inactive-line.svg",
"legacy": true
},
{
"name": "icon-keychain",
"file": "icon-keychain.svg",
"file": "legacy/icon-keychain.svg",
"legacy": true
},
{
"name": "icon-keyhole",
"file": "icon-keyhole.svg",
"file": "legacy/icon-keyhole.svg",
"legacy": true
},
{
"name": "icon-linkedin",
"file": "icon-linkedin.svg",
"file": "legacy/icon-linkedin.svg",
"legacy": true
},
{
"name": "icon-linux-tux",
"file": "icon-linux-tux.svg",
"file": "legacy/icon-linux-tux.svg",
"legacy": true
},
{
"name": "icon-male-and-female",
"file": "icon-users.svg",
"file": "legacy/icon-users.svg",
"legacy": true
},
{
"name": "icon-male-symbol",
"file": "icon-male-symbol.svg",
"file": "legacy/icon-male-symbol.svg",
"legacy": true
},
{
"name": "icon-molecular-network",
"file": "icon-molecular-network.svg",
"file": "legacy/icon-molecular-network.svg",
"legacy": true
},
{
"name": "icon-molecular",
"file": "icon-molecular.svg",
"file": "legacy/icon-molecular.svg",
"legacy": true
},
{
"name": "icon-trash-empty",
"file": "icon-trash-empty.svg",
"file": "legacy/icon-trash-empty.svg",
"internal": true
},
{
"name": "icon-umbraco",
"file": "icon-umbraco.svg"
"file": "legacy/icon-umbraco.svg"
}
]
}
Loading
Loading