Skip to content

Commit 57e55a0

Browse files
committed
sonar fixs
1 parent 2a0915f commit 57e55a0

11 files changed

Lines changed: 19 additions & 19 deletions

File tree

src/generate-partial-ast.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
import * as fs from 'fs'
2+
import * as fs from 'node:fs'
33

44
const INPUT_FILE = "./src/language/generated/ast.ts";
55
const OUTPUT_FILE = "./src/language/generated/ast-partial.ts";

src/language/generator/copyright-notice-provider.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export function getCopyrightNotice(document: LangiumDocument | undefined, prefix
1010
return notice;
1111
}
1212
if (notice) {
13-
return prefix + notice.replace(/\r?\n/g, `\n${prefix}`);
13+
return prefix + notice.replaceAll(/\r?\n/g, `\n${prefix}`);
1414
}
1515
return undefined;
1616
}
@@ -41,7 +41,7 @@ function computeCopyrightNotice(document: LangiumDocument): string | undefined {
4141
}
4242

4343
return processVariables(
44-
node.text.replace(mlEndsPattern, '')
44+
node.text.replaceAll(mlEndsPattern, '')
4545
.replaceAll(mlMiddlePattern, '\n')
4646
.trim()
4747
);

src/language/generator/cpp/clang-format.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { spawn, spawnSync } from 'child_process';
1+
import { spawn, spawnSync } from 'node:child_process';
22
const clangFormatCommand = process.platform.startsWith('win') ? 'clang-format.exe' : 'clang-format';
33
const isClangFormatAvailable = computeIsClangFormatAvailable();
44

src/language/generator/cpp/gap-pattern-generator.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import * as ast from '../../generated/ast.js';
2-
import * as fs from 'fs';
2+
import * as fs from 'node:fs';
33
import { expandToString as s } from 'langium/generate';
44
import { type URI, UriUtils } from 'langium';
55
import { fqn, getAccessKind, getRealVisibility, isInput, isOutput, isState, isString8 } from '../../utils/xsmp-utils.js';
66
import { CppGenerator, CxxStandard } from './generator.js';
77
import type { TaskAcceptor } from '../generator.js';
88
import type { XsmpSharedServices } from '../../xsmp-module.js';
9-
import * as Path from 'path';
9+
import * as Path from 'node:path';
1010
import { VisibilityKind } from '../../utils/visibility-kind.js';
1111

1212
export abstract class GapPatternCppGenerator extends CppGenerator {

src/language/generator/cpp/generator.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import * as ast from '../../generated/ast.js';
22
import { type AstNode, AstUtils, type JSDocElement, type JSDocTag, type URI, UriUtils, WorkspaceCache } from 'langium';
3-
import * as fs from 'fs';
3+
import * as fs from 'node:fs';
44
import type { TaskAcceptor, XsmpGenerator } from '../generator.js';
55
import { escape, fqn, getAccessKind, getNodeType, getPTK, isAbstractType, isInput, isOutput, isState } from '../../utils/xsmp-utils.js';
66
import * as CopyrightNoticeProvider from '../copyright-notice-provider.js';
77
import { expandToString as s } from 'langium/generate';
8-
import * as Path from 'path';
8+
import * as Path from 'node:path';
99
import { format as ClangFormat } from './clang-format.js';
1010
import type { XsmpSharedServices } from '../../xsmp-module.js';
1111
import type { XsmpTypeProvider } from '../../references/type-provider.js';

src/language/parser/value-converter.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,11 +99,11 @@ export class XsmpValueConverter extends DefaultValueConverter {
9999
} else if (ch === 'u' || ch === 'U') {
100100
const hexLength = ch === 'u' ? 4 : 8,
101101
hexCode = str.slice(i, i + hexLength);
102-
result += String.fromCodePoint(parseInt(hexCode, 16));
102+
result += String.fromCodePoint(Number.parseInt(hexCode, 16));
103103
i += hexLength;
104104
} else if (ch === 'x') {
105105
const hexCode = str.slice(i, i + 2);
106-
result += String.fromCharCode(parseInt(hexCode, 16));
106+
result += String.fromCodePoint(Number.parseInt(hexCode, 16));
107107
i += 2;
108108
} else if (ch >= '0' && ch <= '7') {
109109

@@ -118,7 +118,7 @@ export class XsmpValueConverter extends DefaultValueConverter {
118118
octalCode += ch;
119119
i++;
120120
}
121-
result += String.fromCharCode(parseInt(octalCode, 8));
121+
result += String.fromCodePoint(Number.parseInt(octalCode, 8));
122122
} else {
123123
result += ch;
124124
}

src/language/profiles/tas-mdk/generator.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { expandToString as s } from 'langium/generate';
66
import { getAccessKind, isInput, isOutput, isState, isAbstractType } from '../../utils/xsmp-utils.js';
77
import { VisibilityKind } from '../../utils/visibility-kind.js';
88
import { xsmpVersion } from '../../version.js';
9-
import * as Path from 'path';
9+
import * as Path from 'node:path';
1010
import { AstUtils } from 'langium';
1111

1212
export class TasMdkGenerator extends GapPatternCppGenerator {

src/language/profiles/tas-mdk/python-generator.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import * as ast from '../../generated/ast.js';
22
import { type AstNode, type URI, UriUtils } from 'langium';
3-
import * as fs from 'fs';
3+
import * as fs from 'node:fs';
44
import type { TaskAcceptor, XsmpGenerator } from '../../generator/generator.js';
55
import { fqn } from '../../utils/xsmp-utils.js';
66
import * as CopyrightNoticeProvider from '../../generator/copyright-notice-provider.js';
77
import { expandToString as s } from 'langium/generate';
8-
import * as Path from 'path';
8+
import * as Path from 'node:path';
99
import type { XsmpSharedServices } from '../../xsmp-module.js';
1010
import { type DocumentationHelper } from '../../utils/documentation-helper.js';
1111

src/language/tools/adoc/generator.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import * as fs from 'fs';
1+
import * as fs from 'node:fs';
22
import * as ast from '../../generated/ast.js';
33
import { type URI, UriUtils, type AstNode, type Reference, AstUtils, isReference } from 'langium';
44
import { type TaskAcceptor, type XsmpGenerator } from '../../generator/generator.js';
@@ -102,7 +102,7 @@ export class ADocGenerator implements XsmpGenerator {
102102
if (!str) {
103103
return '';
104104
}
105-
return str.replace(/\|/g, '\\|');
105+
return str.replaceAll('\|', '\\|');
106106
}
107107

108108
/**

src/language/tools/python/generator.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ import { expandToString as s } from 'langium/generate';
33
import * as CopyrightNoticeProvider from '../../generator/copyright-notice-provider.js';
44
import type { AstNode, URI } from 'langium';
55
import { UriUtils } from 'langium';
6-
import * as fs from 'fs';
7-
import * as Path from 'path';
6+
import * as fs from 'node:fs';
7+
import * as Path from 'node:path';
88
import type { TaskAcceptor, XsmpGenerator } from '../../generator/generator.js';
99
import { xsmpVersion } from '../../version.js';
1010
import { type XsmpSharedServices } from '../../xsmp-module.js';

0 commit comments

Comments
 (0)