SonarCloud fixes (#4235)

This commit is contained in:
MichalKinas 2024-11-13 14:26:24 +01:00 committed by GitHub
parent 27e318aaa0
commit 90ca3707f7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 9 additions and 10 deletions

View File

@ -37,8 +37,7 @@ const isRuleActionValid = (value: unknown, actionDefinitions: ActionDefinitionTr
: undefined; : undefined;
return ( return (
isRuleAction(value) && isRuleAction(value) &&
actionDefinition && actionDefinition?.parameterDefinitions.reduce(
actionDefinition.parameterDefinitions.reduce(
(isValid: boolean, paramDef: ActionParameterDefinitionTransformed) => isValid && (!paramDef.mandatory || !!value.params[paramDef.name]), (isValid: boolean, paramDef: ActionParameterDefinitionTransformed) => isValid && (!paramDef.mandatory || !!value.params[paramDef.name]),
true true
) )

View File

@ -37,7 +37,7 @@ import { Rule } from '../model/rule.model';
providedIn: 'root' providedIn: 'root'
}) })
export class FolderRuleSetsService { export class FolderRuleSetsService {
public static MAX_RULE_SETS_PER_GET = 100; public static readonly MAX_RULE_SETS_PER_GET = 100;
static isOwnedRuleSet(ruleSet: RuleSet, nodeId: string): boolean { static isOwnedRuleSet(ruleSet: RuleSet, nodeId: string): boolean {
return ruleSet?.owningFolder?.id === nodeId; return ruleSet?.owningFolder?.id === nodeId;

View File

@ -40,7 +40,7 @@ interface GetRulesResult {
providedIn: 'root' providedIn: 'root'
}) })
export class FolderRulesService { export class FolderRulesService {
public static MAX_RULES_PER_GET = 100; public static readonly MAX_RULES_PER_GET = 100;
public static get emptyCompositeCondition(): RuleCompositeCondition { public static get emptyCompositeCondition(): RuleCompositeCondition {
return { return {

View File

@ -83,7 +83,7 @@ export class LocationLinkComponent implements OnInit {
ngOnInit() { ngOnInit() {
if (this.context) { if (this.context) {
const node: NodeEntry = this.context.row.node; const node: NodeEntry = this.context.row.node;
if (node?.entry && node?.entry?.path) { if (node?.entry?.path) {
const path = node.entry.path; const path = node.entry.path;
if (path?.name && path?.elements) { if (path?.name && path?.elements) {

View File

@ -30,8 +30,8 @@ import StreamZip from 'node-stream-zip';
import { NodesApi, SitesApi, TrashcanApi } from '../api'; import { NodesApi, SitesApi, TrashcanApi } from '../api';
export class Utils { export class Utils {
static string257Long = 'x'.repeat(257); static readonly string257Long = 'x'.repeat(257);
static string513Long = 'x'.repeat(513); static readonly string513Long = 'x'.repeat(513);
static random(): string { static random(): string {
return crypto.getRandomValues(new Uint32Array(1))[0].toString(36).substring(0, 5).toLowerCase(); return crypto.getRandomValues(new Uint32Array(1))[0].toString(36).substring(0, 5).toLowerCase();

View File

@ -37,7 +37,7 @@ export interface PermissionOptions {
providedIn: 'root' providedIn: 'root'
}) })
export class NodePermissionService implements NodePermissions { export class NodePermissionService implements NodePermissions {
static DEFAULT_OPERATION = 'OR'; static readonly DEFAULT_OPERATION = 'OR';
private defaultOptions: PermissionOptions = { private defaultOptions: PermissionOptions = {
operation: NodePermissionService.DEFAULT_OPERATION, operation: NodePermissionService.DEFAULT_OPERATION,

View File

@ -34,12 +34,12 @@ module.exports = async ({ exec, github, dependencyName, tag }) => {
} }
} }
const latestPkgToUpdate = availablePackages.find((package) => package.name === matchedPkgVersion); const latestPkgToUpdate = availablePackages.find((pkg) => pkg.name === matchedPkgVersion);
if (localVersion === latestPkgToUpdate?.name) { if (localVersion === latestPkgToUpdate?.name) {
return { hasNewVersion: 'false' }; return { hasNewVersion: 'false' };
} else { } else {
const findLocalVersionOnRemote = availablePackages.find((package) => package.name === localVersion); const findLocalVersionOnRemote = availablePackages.find((pkg) => pkg.name === localVersion);
let rangeInDays = 'N/A'; let rangeInDays = 'N/A';
if (findLocalVersionOnRemote !== undefined) { if (findLocalVersionOnRemote !== undefined) {
const creationLocal = new Date(findLocalVersionOnRemote.created_at); const creationLocal = new Date(findLocalVersionOnRemote.created_at);