github-advanced-security[bot] commented on code in PR #16359:
URL: https://github.com/apache/druid/pull/16359#discussion_r1585138621
##########
web-console/src/ace-modes/dsql.ts:
##########
@@ -122,24 +128,67 @@
ace.define(
'ace/mode/dsql',
['require', 'exports', 'module', 'ace/lib/oop', 'ace/mode/text',
'ace/mode/dsql_highlight_rules'],
- function (acequire, exports, module) {
+ function (acequire: any, exports: any) {
'use strict';
- var oop = acequire('../lib/oop');
- var TextMode = acequire('./text').Mode;
- var SqlHighlightRules =
acequire('./dsql_highlight_rules').SqlHighlightRules;
-
- var Mode = function () {
+ const oop = acequire('../lib/oop');
+ const TextMode = acequire('./text').Mode;
+ const SqlHighlightRules =
acequire('./dsql_highlight_rules').SqlHighlightRules;
+
+ const completions = ([] as Ace.Completion[]).concat(
+ druidKeywords.SQL_KEYWORDS.map(v => ({ name: v, value: v, score: 0,
meta: 'keyword' })),
+ druidKeywords.SQL_EXPRESSION_PARTS.map(v => ({
+ name: v,
+ value: v,
+ score: 0,
+ meta: 'keyword',
+ })),
+ druidKeywords.SQL_CONSTANTS.map(v => ({ name: v, value: v, score: 0,
meta: 'constant' })),
+ druidKeywords.SQL_DYNAMICS.map(v => ({ name: v, value: v, score: 0,
meta: 'dynamic' })),
+ Object.entries(druidFunctions.SQL_DATA_TYPES).map(([name, [runtime,
description]]) => {
+ const item: ItemDescription = {
+ name,
+ description,
+ syntax: `Druid runtime type: ${runtime}`,
+ };
+ return {
+ name,
+ value: name,
+ score: 0,
+ meta: 'type',
+ docHTML: makeDocHtml(item),
+ docText: description,
+ };
+ }),
+ Object.entries(druidFunctions.SQL_FUNCTIONS).flatMap(([name, versions])
=> {
Review Comment:
## Property access on null or undefined
The base expression of this property access is always undefined.
[Show more
details](https://github.com/apache/druid/security/code-scanning/7325)
##########
web-console/src/ace-modes/dsql.ts:
##########
@@ -122,24 +128,67 @@
ace.define(
'ace/mode/dsql',
['require', 'exports', 'module', 'ace/lib/oop', 'ace/mode/text',
'ace/mode/dsql_highlight_rules'],
- function (acequire, exports, module) {
+ function (acequire: any, exports: any) {
'use strict';
- var oop = acequire('../lib/oop');
- var TextMode = acequire('./text').Mode;
- var SqlHighlightRules =
acequire('./dsql_highlight_rules').SqlHighlightRules;
-
- var Mode = function () {
+ const oop = acequire('../lib/oop');
+ const TextMode = acequire('./text').Mode;
+ const SqlHighlightRules =
acequire('./dsql_highlight_rules').SqlHighlightRules;
+
+ const completions = ([] as Ace.Completion[]).concat(
+ druidKeywords.SQL_KEYWORDS.map(v => ({ name: v, value: v, score: 0,
meta: 'keyword' })),
+ druidKeywords.SQL_EXPRESSION_PARTS.map(v => ({
+ name: v,
+ value: v,
+ score: 0,
+ meta: 'keyword',
+ })),
+ druidKeywords.SQL_CONSTANTS.map(v => ({ name: v, value: v, score: 0,
meta: 'constant' })),
+ druidKeywords.SQL_DYNAMICS.map(v => ({ name: v, value: v, score: 0,
meta: 'dynamic' })),
+ Object.entries(druidFunctions.SQL_DATA_TYPES).map(([name, [runtime,
description]]) => {
Review Comment:
## Property access on null or undefined
The base expression of this property access is always undefined.
[Show more
details](https://github.com/apache/druid/security/code-scanning/7324)
##########
web-console/src/ace-modes/dsql.ts:
##########
@@ -21,36 +21,42 @@
// Originally licensed under the MIT license
(https://github.com/thlorenz/brace/blob/master/LICENSE)
// This file was modified to make the list of keywords more closely adhere to
what is found in DruidSQL
-var druidKeywords = require('../../lib/keywords');
-var druidFunctions = require('../../lib/sql-docs');
+import type { Ace } from 'ace-builds';
+import ace from 'ace-builds/src-noconflict/ace';
+
+import druidKeywords from '../../lib/keywords';
+import druidFunctions from '../../lib/sql-docs';
+
+import type { ItemDescription } from './make-doc-html';
+import { makeDocHtml } from './make-doc-html';
ace.define(
'ace/mode/dsql_highlight_rules',
['require', 'exports', 'module', 'ace/lib/oop',
'ace/mode/text_highlight_rules'],
- function (acequire, exports, module) {
+ function (acequire: any, exports: any) {
'use strict';
- var oop = acequire('../lib/oop');
- var TextHighlightRules =
acequire('./text_highlight_rules').TextHighlightRules;
+ const oop = acequire('../lib/oop');
+ const TextHighlightRules =
acequire('./text_highlight_rules').TextHighlightRules;
- var SqlHighlightRules = function () {
+ const SqlHighlightRules = function (this: any) {
// Stuff like:
'with|select|from|where|and|or|group|by|order|limit|having|as|case|'
- var keywords =
druidKeywords.SQL_KEYWORDS.concat(druidKeywords.SQL_EXPRESSION_PARTS)
+ const keywords =
druidKeywords.SQL_KEYWORDS.concat(druidKeywords.SQL_EXPRESSION_PARTS)
.join('|')
.replace(/\s/g, '|');
// Stuff like: 'true|false'
- var builtinConstants = druidKeywords.SQL_CONSTANTS.join('|');
+ const builtinConstants = druidKeywords.SQL_CONSTANTS.join('|');
// Stuff like: 'avg|count|first|last|max|min'
- var builtinFunctions = druidKeywords.SQL_DYNAMICS.concat(
+ const builtinFunctions = druidKeywords.SQL_DYNAMICS.concat(
Object.keys(druidFunctions.SQL_FUNCTIONS),
).join('|');
// Stuff like:
'int|numeric|decimal|date|varchar|char|bigint|float|double|bit|binary|text|set|timestamp'
- var dataTypes = Object.keys(druidFunctions.SQL_DATA_TYPES).join('|');
+ const dataTypes = Object.keys(druidFunctions.SQL_DATA_TYPES).join('|');
Review Comment:
## Property access on null or undefined
The base expression of this property access is always undefined.
[Show more
details](https://github.com/apache/druid/security/code-scanning/7323)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]