Compare commits

..

281 Commits
main ... ke2

Author SHA1 Message Date
Chris Smowton
2aa5cf84ff Merge pull request #18215 from smowton/smowton/ke2/basic-generics
KE2: Upgrade to Kotlin 2.1.0; restore basic type parameter and type argument extraction
2024-12-13 15:39:54 +00:00
Chris Smowton
b60298d033 Rename classId 2024-12-11 15:58:44 +00:00
Chris Smowton
53593a39f0 Note Kotlin class ID distinction is a TODO 2024-12-11 15:57:09 +00:00
Chris Smowton
44e44dcce9 Cascade failures from failure to find a type-parameter parent. 2024-12-11 15:46:03 +00:00
Chris Smowton
504a630123 Note class of unexpected type arguments 2024-12-11 15:32:44 +00:00
Chris Smowton
448d3680f6 Add comment noting structure of argsIncludingOuterClasses 2024-12-11 15:31:45 +00:00
Chris Smowton
43576a169f Add comment noting Caffeiene dependency 2024-12-11 15:29:15 +00:00
Ian Lynagh
fbead0fd63 Merge pull request #18254 from igfoo/igfoo/extractExpressionStmt
KE2: extractExpressionStmt can be used with null statements
2024-12-10 11:25:16 +00:00
Ian Lynagh
0f2634a228 KE2: extractExpressionStmt can be used with null statements 2024-12-09 16:54:23 +00:00
Ian Lynagh
8c8599435e Merge pull request #18250 from igfoo/igfoo/extractExpressionExpr
KE2: extractExpressionExpr can take null expressions
2024-12-09 14:38:42 +00:00
Ian Lynagh
f4ae7f8e81 KE2: extractExpressionExpr can take null expressions 2024-12-09 14:31:43 +00:00
Ian Lynagh
b1683f7549 Merge pull request #18237 from igfoo/igfoo/ret
KE2: extractExpression always returns an ID
2024-12-09 11:48:34 +00:00
Ian Lynagh
ada6801a17 KE2: extractExpression always returns an ID
It used to sometimes return null, which could mean either it extracted a
statement or it failed to extract an expression. Also, what it returned
didn't take into account any ExprStmt or StmtExpr wrappers.

Now, it will always return an ID of the type that it StmtExprParent
corresponds to.
2024-12-06 15:23:42 +00:00
Ian Lynagh
d568d04357 Merge pull request #18210 from igfoo/igfoo/nullExpr
KE2: Start generating errorexprs/errorstmts
2024-12-05 13:19:28 +00:00
Ian Lynagh
d36fabf4ec KE2: Add a TODO 2024-12-05 13:02:09 +00:00
Chris Smowton
784a63b6d5 KE2: Restore the basics of type-parameter and type-argument extraction 2024-12-04 22:38:06 +00:00
Chris Smowton
2cc2d931f3 KE2: Upgrade to Kotlin 2.1.0 2024-12-04 22:38:05 +00:00
Chris Smowton
51a1ea52e1 Merge pull request #18150 from smowton/smowton/ke2/external-class-extraction
KE2: restore basic function label construction
2024-12-04 22:37:37 +00:00
Chris Smowton
0d39ab21c5 Address review comments 2024-12-04 22:37:09 +00:00
Ian Lynagh
7f6818042d KE2: Generate erors for null expressions/statements 2024-12-04 18:03:54 +00:00
Ian Lynagh
af1804380a KE2: Add support for generating error expressions and statements 2024-12-04 17:52:26 +00:00
Ian Lynagh
d8a9615c0c Merge pull request #18182 from igfoo/igfoo/bb
KE2: Remove some unnecessary !!s
2024-12-03 14:18:49 +00:00
Ian Lynagh
769a615de1 KE2: Remove some unnecessary !!s
useType already handles null types, and extracts an error type for them.

The error also includes info about where that came from via the `with`
stack, although we might want to make that finer grained in future.
2024-12-03 14:18:03 +00:00
Ian Lynagh
b1b8717718 Merge pull request #18183 from igfoo/igfoo/callable
KE2: Put 'callable' into 'StmtParent'
2024-12-03 12:42:50 +00:00
Ian Lynagh
703aee2ae6 KE2: Remove most redundant 'callable' args 2024-12-02 18:28:15 +00:00
Ian Lynagh
034f283c4f KE2: Tell StmtExprParent about callable
This should allow us to simplify everything that uses it.
2024-12-02 18:02:11 +00:00
Tamás Vajk
439e8f079c Merge pull request #18128 from tamasvajk/ke-constants
KE2: Extract `bool`, `char`, `float`, `double` constants
2024-12-02 14:59:01 +01:00
Tamas Vajk
98ab6213a4 Code quality improvement 2024-12-02 14:26:10 +01:00
Ian Lynagh
2490606cd1 Merge pull request #18168 from igfoo/igfoo/nofake
KE2: Remove the fakeOverride code
2024-12-02 12:18:39 +00:00
Tamas Vajk
6118253b14 Code quality improvements 2024-12-02 12:07:44 +01:00
Tamas Vajk
149136c2a4 KE2: Extract bool, char, float, double constants 2024-12-02 11:58:12 +01:00
Ian Lynagh
0ccf117bf7 KE2: Remove the fakeOverride code
As far as I can see, the analysis API isn't giving us fake overrides.
2024-11-29 17:49:13 +00:00
Ian Lynagh
7b4e830386 Merge pull request #18149 from igfoo/igfoo/with
KE2: Small method renaming
2024-11-28 15:44:26 +00:00
Chris Smowton
cf78938a0d KE2: restore basic function label construction 2024-11-28 15:38:13 +00:00
Ian Lynagh
078e292c74 Merge pull request #18148 from igfoo/igfoo/dollar
KE2: Simplify escaping a dollar in a string
2024-11-28 15:25:52 +00:00
Ian Lynagh
194a61945e KE2: Small method renaming 2024-11-28 14:50:02 +00:00
Ian Lynagh
4765917d34 KE2: Simplify escaping a dollar in a string 2024-11-28 14:38:51 +00:00
Ian Lynagh
51c79952f3 Merge pull request #18146 from igfoo/igfoo/fix
KE2: Fix build
2024-11-28 13:04:33 +00:00
Ian Lynagh
433f5d311b KE2: Fix build 2024-11-28 12:36:20 +00:00
Tamás Vajk
0572e28adc Merge pull request #18127 from tamasvajk/ke-null
KE2: Extract `null` literal
2024-11-28 09:11:05 +01:00
Chris Smowton
222b50cd5e Merge pull request #18134 from smowton/smowton/ke2/external-class-extraction
KE2: basic external class extraction
2024-11-27 18:15:33 +00:00
Chris Smowton
fe4dc296f5 Don't query non-Kt source elements for locations etc 2024-11-27 18:04:40 +00:00
Chris Smowton
54961ddc88 Fixups 2024-11-27 17:54:45 +00:00
Ian Lynagh
d46cb189d8 Merge pull request #18135 from igfoo/igfoo/priv_unused
KE2: Remove some debugging functions, and mark some others as private
2024-11-27 17:43:52 +00:00
Chris Smowton
d27b5ed96e Remove redundant comment 2024-11-27 17:12:22 +00:00
Chris Smowton
dd9d8720b0 Add doc comment 2024-11-27 17:12:21 +00:00
Chris Smowton
a3d78f1bad Neaten symbol-to-location 2024-11-27 17:12:20 +00:00
Chris Smowton
cc0a112ea6 Generalise warnElement and errorElement 2024-11-27 17:12:19 +00:00
Chris Smowton
97ecd18678 Merge duplicate functions 2024-11-27 17:12:18 +00:00
Chris Smowton
e29d9ddacb Restore location and name reporting for symbols 2024-11-27 17:12:17 +00:00
Chris Smowton
bfdb5e0b17 Add error function taking a throwable to LoggerBase 2024-11-27 17:12:16 +00:00
Chris Smowton
dfad8c8475 Don't bubble TODOs and other unchecked exceptions up to top level 2024-11-27 17:12:15 +00:00
Chris Smowton
1fc2a61f95 KE2: basic external class extraction 2024-11-27 17:12:12 +00:00
Tamas Vajk
def1916fd8 KE2: Extract null literal 2024-11-27 16:47:12 +01:00
Tamás Vajk
7e77ad2e71 Merge pull request #18110 from tamasvajk/ke2-lambda
KE2: Extract lambda expressions
2024-11-27 16:43:47 +01:00
Ian Lynagh
75f1c08ea2 KE2: Remove some debugging functions, and mark some others as private 2024-11-27 15:25:32 +00:00
Tamas Vajk
352e5d0c68 Remove unused code 2024-11-27 15:45:38 +01:00
Tamas Vajk
7d50eb5670 Fix review findings 2024-11-27 14:38:05 +01:00
Tamas Vajk
44e318546f KE2: Extract more constructs for lambda expressions 2024-11-27 14:38:05 +01:00
Tamas Vajk
b42fbde130 KE2: Extract generated class for lambda expressions 2024-11-27 14:37:58 +01:00
Ian Lynagh
5245dad3c1 Merge pull request #18118 from igfoo/igfoo/diag
KE2: Put diagnostics from the analysis API into the database
2024-11-27 10:57:22 +00:00
Ian Lynagh
cc0eb9ab36 KE2: Put diagnostics from the analysis API into the database 2024-11-26 15:42:38 +00:00
Ian Lynagh
48168bf66c Merge pull request #18096 from igfoo/igfoo/deprec
KE2: Don't actually deprecate WhenBranch.getCondition() yet
2024-11-26 14:48:27 +00:00
Ian Lynagh
661fb9ee58 Merge pull request #18095 from igfoo/igfoo/remove
KE2: Remove some old debugging code
2024-11-26 14:48:16 +00:00
Ian Lynagh
2c595417f1 KE2: Don't actually deprecate WhenBranch.getCondition() yet
It makes a lot of noise in the CFG QLL, that we aren't fixing yet
2024-11-25 17:14:35 +00:00
Ian Lynagh
0b529c92bc KE2: Remove some old debugging code 2024-11-25 17:04:27 +00:00
Ian Lynagh
86ddb3b6c1 Merge pull request #18081 from igfoo/igfoo/dbscheme_comments
KE2: Add more dbscheme comments
2024-11-25 12:06:18 +00:00
Tamás Vajk
0103711b47 Merge pull request #18058 from tamasvajk/ke2-when
KE2: Extract `when` expressions
2024-11-25 09:04:24 +01:00
Ian Lynagh
bb50bc0d85 Merge pull request #18075 from igfoo/igfoo/comp
KE2: Small refactoring
2024-11-22 15:34:28 +00:00
Ian Lynagh
37e950dcbf Merge pull request #18076 from igfoo/igfoo/werror
KE2: Add warnings-as-error to build system, but commented out for now
2024-11-22 15:33:51 +00:00
Ian Lynagh
b816c1f396 Merge pull request #18077 from igfoo/igfoo/stmt
KE2: Reenable more code for ExprParent.stmt
2024-11-22 15:33:38 +00:00
Ian Lynagh
bafee5ec10 Merge pull request #18079 from igfoo/igfoo/dc
KE2: Remove some dead code
2024-11-22 15:33:20 +00:00
Tamas Vajk
3abd9a755e Code quality improvements 2024-11-22 16:22:39 +01:00
Ian Lynagh
b3dbd73741 KE2: Remove some dead code 2024-11-22 14:10:47 +00:00
Ian Lynagh
19986f0307 KE2: Reenable more code for ExprParent.stmt 2024-11-22 14:04:02 +00:00
Ian Lynagh
cb8237fe67 KE2: Add warnings-as-error to build system, but commented out for now
Once we get closer to completion, it will be useful to have this on.
2024-11-22 13:42:31 +00:00
Ian Lynagh
d280a41062 KE2: Small refactoring
Avoids shadowing `trapWriterWriteExpr`, and removes the need to check
for an impossible case.
2024-11-22 13:39:55 +00:00
Ian Lynagh
05fa3328f0 Merge pull request #18064 from igfoo/igfoo/ke2_lang_ver
KE2: Use the right language version
2024-11-22 11:41:32 +00:00
Ian Lynagh
40006fc566 Merge pull request #18031 from igfoo/igfoo/kttypes
KE2: Start working on KtTypes
2024-11-22 11:41:01 +00:00
Tamas Vajk
6c8cb103fc Fix KE1 2024-11-22 11:37:09 +01:00
Tamas Vajk
052a243db6 Fix KE1 to extract the new when condition constructs 2024-11-22 10:16:41 +01:00
Ian Lynagh
6d990d47db KE2: Use the right language version
With this, if I make the testsuite driver use 1.7, then the test code

sealed interface ReadResult
data class Number(val number: Int) : ReadResult
data class Text(val text: String) : ReadResult
data object EndOfFile : ReadResult

makes the extractor print

=== Diagnostics
--- Diagnostic:
WRONG_MODIFIER_TARGET
ERROR
Modifier 'data' is not applicable to 'standalone object'.
Location(startLine=5, startColumn=1, endLine=5, endColumn=4)
--- End diagnostics
2024-11-21 16:36:16 +00:00
Ian Lynagh
82c41316c6 KE2: Populate Kotlin type nullability and alias information 2024-11-21 16:00:01 +00:00
Ian Lynagh
7baeea6365 KE2: Use a more consistent TRAP label 2024-11-21 15:21:35 +00:00
Ian Lynagh
d17e3d521c KE2: Start working on KtTypes 2024-11-21 15:21:34 +00:00
Ian Lynagh
eae40dbc03 KE2: Keep KE1 building with the kt-type changes
It won't work, but it'll still compile
2024-11-21 15:21:33 +00:00
Tamas Vajk
a2d90ed0c6 KE2: Extract when expressions 2024-11-21 16:02:20 +01:00
Ian Lynagh
74ee483fa1 KE2: Add rules_jvm_external back to build system 2024-11-20 18:23:01 +00:00
Ian Lynagh
8fe48d6dce Merge commit 'e3990b7d04db2ca3ac99c029a0afc131e695db0b' into ke2
That is the repo ql as at the internal repo's
    git merge-base origin/rc/3.16 origin/main
2024-11-20 17:40:00 +00:00
Chris Smowton
e89e0f5c4a Merge pull request #18027 from igfoo/igfoo/fixbuild
KE2: Fix build
2024-11-20 16:48:36 +00:00
Tamás Vajk
1dbf54e9e7 Merge pull request #18028 from tamasvajk/ke2-if
KE2: Extract `if` expressions/statements
2024-11-19 18:40:45 +01:00
Tamas Vajk
39aefb8d17 Fix code review finding 2024-11-19 18:06:35 +01:00
Tamas Vajk
28a5634615 KE2: Extract if expressions/statements 2024-11-19 13:57:18 +01:00
Ian Lynagh
e4a82888c0 KE2: Fix build 2024-11-19 11:56:55 +00:00
Ian Lynagh
147f6a10e7 Merge pull request #18016 from igfoo/igfoo/file_numbers
KE2: Use the right file numbers
2024-11-19 11:03:55 +00:00
Tamás Vajk
750b8239e7 Merge pull request #18006 from tamasvajk/ke2-parens
KE2: Extract parenthesized expressions
2024-11-19 11:23:39 +01:00
Tamas Vajk
ea54eab376 Add todo comment 2024-11-19 08:37:38 +01:00
Ian Lynagh
7bda00cb5b KE2: Use the right file numbers
The thread that did the extraction could see the file number counter
after it had been incremented (possibly multiple times) by the main
thread. This fixes some consistency query failures in tests.
2024-11-18 18:37:56 +00:00
Paolo Tranquilli
5c1f413d44 Java: fix embedded kotlin extractor build 2024-11-18 17:47:24 +01:00
Tamas Vajk
9f3a0ca432 KE2: Extract parenthesized expressions 2024-11-18 13:41:05 +01:00
Ian Lynagh
c2dfe0ef4a Merge pull request #17978 from igfoo/igfoo/issafeaccess
KE2: Rename safeAccess to isSafeAccess
2024-11-14 11:28:23 +00:00
Tamás Vajk
c3324ee2f4 Merge pull request #17974 from tamasvajk/ke2-code-quality-01
KE2: Improve code quality in expression extraction
2024-11-14 08:36:11 +01:00
Chris Smowton
efe20b2452 Merge pull request #17884 from smowton/ke2/properties-and-variables
KE2: implement basic usage of properties, variables and flexible types
2024-11-13 15:32:44 +00:00
Chris Smowton
f12818a96d Apply review comments 2024-11-13 15:15:09 +00:00
Chris Smowton
fdaa6c5b4b KE2: implement basic usage of properties, variables and flexible types 2024-11-13 15:06:59 +00:00
Ian Lynagh
22096b1984 KE2: Rename safeAccess to isSafeAccess
To follow our standard naming convention.
2024-11-13 12:32:36 +00:00
Tamas Vajk
3ae58d072c KE2: Improve code quality in expression extraction 2024-11-13 09:38:48 +01:00
Tamás Vajk
fcde605569 Merge pull request #17939 from tamasvajk/ke2-binary-op-compareTo
KE2: Extract `compareTo` calls for binary comparisons
2024-11-13 09:09:59 +01:00
Tamas Vajk
70658bcd52 Fix review findings 2024-11-12 15:58:42 +01:00
Tamas Vajk
14150ea78d KE2: Extract compareTo calls for binary comparisons 2024-11-12 15:49:44 +01:00
Tamás Vajk
15468bcd11 Merge pull request #17874 from tamasvajk/ke2-unary-ops
KE2: Extract unary operators
2024-11-12 15:48:47 +01:00
Tamas Vajk
320905925b KE2: Extract unary operators 2024-11-12 12:32:51 +01:00
Tamás Vajk
a9e45d8609 Merge pull request #17761 from tamasvajk/ke2-binary-ops
KE2: extract binary operators
2024-11-12 12:30:39 +01:00
Ian Lynagh
83b3e8c7e5 Merge pull request #17961 from igfoo/igfoo/ke2_erasure
KE2: Remove erasure
2024-11-12 10:18:39 +00:00
Tamas Vajk
53460d7ca0 Add comment 2024-11-12 09:19:04 +01:00
Ian Lynagh
cfb269eba9 KE2: Remove erasure 2024-11-11 17:49:23 +00:00
Ian Lynagh
0249c49ce5 Java: Add up/downgrade scripts 2024-11-11 17:48:35 +00:00
Ian Lynagh
66be970b2e Java/Kotlin: Remove the erasure relation
It's no longer used
2024-11-11 17:48:30 +00:00
Ian Lynagh
b8b0fcad67 Kotlin: Don't write the erasure relation
It's no longer used
2024-11-11 17:48:24 +00:00
Ian Lynagh
4aed952c7d Java: Remove redundant getErasure overrides
The root definition covers these cases already
2024-11-11 17:48:17 +00:00
Tamas Vajk
db13b32285 Extract comparison operators 2024-11-08 13:53:59 +01:00
Tamas Vajk
a5fcfaf289 Add todo comment with missing binary operators 2024-11-08 13:53:58 +01:00
Tamas Vajk
227d30243c Extract reference equals 2024-11-08 13:53:58 +01:00
Tamas Vajk
bc35c509f0 Extract more numeric binary operators 2024-11-08 13:53:57 +01:00
Tamas Vajk
255d5c9942 KE2: Extract binary operators on numeric types 2024-11-08 13:53:57 +01:00
Tamás Vajk
212143ff45 Merge pull request #17881 from tamasvajk/ke2-safe-qualified-expr
KE2: Extract safe qualified expressions
2024-11-08 13:53:21 +01:00
Tamás Vajk
71931c38f2 Merge pull request #17885 from smowton/smowton/ke2-jar-sources
KE2: add source jars to intellij project
2024-11-07 15:04:39 +01:00
Chris Smowton
33a0e99347 KE2: add source jars to intellij project 2024-10-31 17:58:23 +00:00
Tamas Vajk
84166e8731 KE2: Extract safe qualified expressions 2024-10-31 13:14:07 +01:00
Chris Smowton
26d40a7e42 Merge pull request #17878 from smowton/smowton/ke2/debugger-support
KE2: Enable attaching debugger to extractor
2024-10-31 10:22:52 +00:00
Tamás Vajk
f57fe719c1 Merge pull request #17802 from tamasvajk/ke2-method-call
KE2: Extract simple method calls
2024-10-31 08:53:38 +01:00
Tamas Vajk
11975a1b25 Remove todo comment 2024-10-31 08:28:42 +01:00
Chris Smowton
3e4345e0aa Enable attaching debugger to ke2 extractor 2024-10-29 22:14:26 +00:00
Tamas Vajk
9dd37b0ede Fix typo 2024-10-29 13:26:37 +01:00
Tamas Vajk
c10a0e549a Handle named arguments in method call extraction 2024-10-29 12:12:16 +01:00
Tamas Vajk
4bf6280435 KE2: Extract simple method calls 2024-10-18 14:06:08 +02:00
Ian Lynagh
a922f97200 Merge pull request #17777 from igfoo/igfoo/log-sev
KE2: Log our verbosity level
2024-10-16 12:46:58 +01:00
Tamás Vajk
9a4cd2152a Merge pull request #17752 from tamasvajk/ke2-string-plus
KE2: Extract `String.plus` and `String?.plus` calls
2024-10-16 13:35:08 +02:00
Ian Lynagh
9b13368e23 KE2: Log our verbosity level
This happens at `info` level, which is logged by default.
2024-10-15 16:23:25 +01:00
Tamas Vajk
7b198da95f Improve code quality 2024-10-15 10:29:14 +02:00
Tamas Vajk
125797cd4f Improve code quality 2024-10-14 20:31:52 +02:00
Tamas Vajk
a3a93d826e KE2: Extract String.plus and String?.plus calls 2024-10-14 14:39:01 +02:00
Tamás Vajk
bc15f40f8f Merge pull request #17729 from tamasvajk/ke2-numeric-plus
KE2: Extract binary plus on numeric types
2024-10-11 13:26:41 +02:00
Tamas Vajk
ea688372bd Apply review findings 2024-10-11 10:17:16 +02:00
Ian Lynagh
4b73fed267 KE2: Add more dbscheme comments 2024-10-10 17:45:29 +01:00
Tamas Vajk
7e8b20d200 KE2: Extract binary plus on numeric types 2024-10-10 14:30:24 +02:00
Tamás Vajk
643419a32f Merge pull request #17707 from tamasvajk/ke2-vari
KE2: Extract local variable declarations
2024-10-10 12:32:11 +02:00
Tamas Vajk
e82b1762c0 Apply code review findings 2024-10-09 16:02:54 +02:00
Tamas Vajk
a471fa004a KE2: Extract local variable declarations 2024-10-09 15:19:42 +02:00
Tamás Vajk
01c71ba8d6 Merge pull request #17706 from tamasvajk/ke2-is-as
KE2: Extract `is` and `as` expression kinds
2024-10-09 15:17:50 +02:00
Ian Lynagh
e0596905f9 Merge pull request #17685 from igfoo/igfoo/types
KE2: Don't call buildClassType; once we get into symbol land, stay there
2024-10-09 13:27:28 +01:00
Tamas Vajk
7ff60f8081 Fix extracted child expression 2024-10-09 13:39:07 +02:00
Ian Lynagh
cdf96276c8 KE2: Add a TODO comment 2024-10-09 12:28:51 +01:00
Ian Lynagh
171f68f6d9 Merge pull request #17702 from igfoo/igfoo/dbscheme
KE2: Add more dbscheme comments
2024-10-09 12:13:36 +01:00
Tamas Vajk
a232fcab36 KE2: Extract is and as expression kinds 2024-10-09 09:40:24 +02:00
Ian Lynagh
2cb2aabceb Merge pull request #17698 from igfoo/igfoo/labels
KE2: Update github labeler config
2024-10-08 18:23:58 +01:00
Ian Lynagh
135ea99b65 KE2: Add more dbscheme comments 2024-10-08 17:32:23 +01:00
Ian Lynagh
5edf520439 Merge pull request #17695 from igfoo/igfoo/nulltype
KE2: Handle null types (emit errortypes)
2024-10-08 15:54:20 +01:00
Ian Lynagh
174e7f625d Merge pull request #17692 from igfoo/igfoo/unused
KE2: Remove some dead code
2024-10-08 15:54:02 +01:00
Ian Lynagh
141377a038 Merge pull request #17697 from igfoo/igfoo/callDescription
KE2: Fix use of the wrong variable in log output
2024-10-08 15:53:30 +01:00
Ian Lynagh
862293ae3e KE2: Update github labeler config 2024-10-08 15:37:07 +01:00
Ian Lynagh
780fc699fd KE2: Fix use of the wrong variable in log output 2024-10-08 15:33:28 +01:00
Ian Lynagh
565e780285 KE2: Handle null types (emit errortypes) 2024-10-08 15:18:15 +01:00
Ian Lynagh
b61799fc1d KE2: Remove some dead code 2024-10-08 14:26:55 +01:00
Ian Lynagh
5c76b43fa8 KE2: Don't call buildClassType; once we get into symbol land, stay there 2024-10-08 13:14:11 +01:00
Ian Lynagh
135e909d5e KE2: Remove some 'types' code from the 'class' file 2024-10-08 12:56:00 +01:00
Ian Lynagh
15348dc15b Merge pull request #17675 from igfoo/igfoo/comments
KE2: Add some Java dbscheme and library comments
2024-10-08 11:32:33 +01:00
Ian Lynagh
34557203a0 Merge pull request #17677 from igfoo/igfoo/types
KE2: Pull type extraction out as separate from class extraction
2024-10-08 11:32:22 +01:00
Tamás Vajk
7c3fb3262d Merge pull request #17664 from tamasvajk/ke2-extract-some-expr
KE2: Extract some expr/stmt kinds
2024-10-08 10:17:21 +02:00
Ian Lynagh
9ef185ad6f KE2: Fix build 2024-10-07 18:42:41 +01:00
Ian Lynagh
56fc16c9f5 KE2: Pull more type extraction out into Types.kt 2024-10-07 18:40:58 +01:00
Ian Lynagh
cc09d6da5f KE2: Pull type extraction out as separate from class extraction 2024-10-07 18:29:50 +01:00
Ian Lynagh
b003eb16cc KE2: Add some Java dbscheme and library comments 2024-10-07 16:35:46 +01:00
Ian Lynagh
b46be1b71a Merge pull request #17667 from igfoo/igfoo/conc
KE2: Be concurrency-safe (hopefully!) and enable concurrency
2024-10-07 12:04:19 +01:00
Ian Lynagh
3aaeefad92 KE2: Enable 8 threads 2024-10-04 16:20:21 +01:00
Ian Lynagh
fd3ac0b838 KE2: Use a semaphore to avoid more than maxThreads open TRAP files at once 2024-10-04 16:19:51 +01:00
Ian Lynagh
f5033d1e88 KE2: Make the shared stuff threadsafe 2024-10-04 16:11:26 +01:00
Tamas Vajk
aa5fa12b4f Add TODO comment 2024-10-04 16:38:09 +02:00
Tamas Vajk
cc1f1dd473 KE2: Extract some expr/stmt kinds 2024-10-04 13:35:30 +02:00
Tamás Vajk
8711099de2 Merge pull request #17662 from tamasvajk/ke2-expressions-separate
KE2: Move expr/stmt extraction to separate file
2024-10-04 12:48:58 +02:00
Tamas Vajk
bb32ebb304 KE2: Move expr/stmt extraction to separate file 2024-10-04 11:42:42 +02:00
Ian Lynagh
d6189073d6 Merge pull request #17645 from igfoo/igfoo/top
KE2: Refactor the top level a bit
2024-10-03 12:50:42 +01:00
Ian Lynagh
a1c4413563 KE2: Clarify a 2-stage TODO comment 2024-10-03 11:54:39 +01:00
Ian Lynagh
4701bc7aef KE2: Make concurrent extraction possible 2024-10-02 16:42:24 +01:00
Ian Lynagh
5be65ffead KE2: Only call analyze once, on the sourceModule 2024-10-02 16:29:56 +01:00
Ian Lynagh
f63273a531 Merge pull request #17622 from igfoo/igfoo/ke2-comments
Java/Kotlin: Add some dbscheme comments
2024-10-02 16:14:51 +01:00
Ian Lynagh
e0d157277c Java: Improve files/folder qldoc 2024-10-02 14:03:31 +01:00
Ian Lynagh
32be2296e6 Java/Kotlin: Add some dbscheme comments 2024-09-30 13:02:36 +01:00
Ian Lynagh
8196460da3 Merge pull request #17600 from igfoo/igfoo/ke2-constrs
KE2: Add bugfix from KE1's #17599
2024-09-27 12:18:09 +01:00
Ian Lynagh
97b56dbeb9 Merge pull request #17601 from igfoo/igfoo/ke2-owners
KE2: Add CODEOWNERS
2024-09-27 12:17:42 +01:00
Ian Lynagh
980dd04daa KE2: Add CODEOWNERS 2024-09-27 11:27:55 +01:00
Ian Lynagh
e52d3ba68f KE2: Add bugfix from KE1's #17599 2024-09-27 11:26:02 +01:00
Ian Lynagh
93cd6bb2cf Merge pull request #17594 from igfoo/igfoo/nodeclstack
KE2: Remove the declaration stack for now
2024-09-26 15:32:15 +01:00
Ian Lynagh
0c2aedbb55 KE2: Remove the declaration stack for now
Lets see if we still need it in KE2, or if there's a simpler way.
2024-09-26 14:38:35 +01:00
Tamas Vajk
52934ee5db Code quality improvements 2024-09-26 13:13:20 +01:00
Tamas Vajk
154e841de8 Use extension functions to group extractor functionality 2024-09-26 13:13:19 +01:00
Tamas Vajk
40c28f76f2 KE2 WIP: reintroduce source class extraction 2024-09-26 13:13:17 +01:00
Tamas Vajk
5766580037 KE2: WIP: Move function extraction to symbols 2024-09-26 13:13:16 +01:00
Tamas Vajk
c7f8596643 KE2: Format code in IDEA 2024-09-26 13:13:15 +01:00
Tamas Vajk
a794913b9e KE2: Change Kotlin compiler version in IDEA settings 2024-09-26 13:13:14 +01:00
Tamas Vajk
2bc1b46f9e KE2: Add IntelliJ IDEA settings 2024-09-26 13:13:13 +01:00
Tamas Vajk
1ecf685dfd KE2: Tolerate existing KotlinExtractorDbScheme.kt file in build script 2024-09-26 13:13:12 +01:00
Tamas Vajk
6e3e05dc67 KE2: Modify bazel script to include all java files 2024-09-26 13:13:11 +01:00
Ian Lynagh
1dc8f2594d bazel: Add rules_jvm_external dependency 2024-09-26 13:13:10 +01:00
Ian Lynagh
d85a39b781 KE2: Add classpath to analysis context 2024-09-26 13:13:09 +01:00
Ian Lynagh
8df542b2ce KE2: Print diagnostics reported by analysis API
Ultimately they ought to be in the database and/or logs.
2024-09-26 13:13:08 +01:00
Ian Lynagh
a09ed81b00 KE2: Reenable extractExprContext 2024-09-26 13:13:07 +01:00
Ian Lynagh
6ae4d225b1 KE2: Remove some old code 2024-09-26 13:13:06 +01:00
Ian Lynagh
186022e89c KE2: Emit truncated diagnostic info 2024-09-26 13:13:05 +01:00
Ian Lynagh
092290c066 KE2: Add diagnostic counts to the logger state 2024-09-26 13:13:04 +01:00
Ian Lynagh
e2c127b85f KE2: Pull out a LoggerState 2024-09-26 13:13:03 +01:00
Ian Lynagh
3c0ef3de51 KE2: Reenable extractorContextStack, but now it's in the file logger
This allows multiple threads to run on different files with their own stack.
2024-09-26 13:13:02 +01:00
Ian Lynagh
24c545c00b KE2: Use the FileLogger when making a FileTrapWriter 2024-09-26 13:13:01 +01:00
Ian Lynagh
ce45b0e1d7 KE2: TrapWriter: Use the BasicLogger interface
This will allow FileTrapWriters to log via their FileLogger, which means
it will have access to file-specific state
2024-09-26 13:13:00 +01:00
Ian Lynagh
9ce31cc2b9 KE2: Add a BasicLogger interface 2024-09-26 13:12:59 +01:00
Ian Lynagh
2e3addaf98 KE2: Remove redundant value 2024-09-26 13:12:58 +01:00
Ian Lynagh
b53c29152c KE2: Start handling literals 2024-09-26 13:12:56 +01:00
Ian Lynagh
4ac1c83fcf KE2: More return statement extraction 2024-09-26 13:12:55 +01:00
Ian Lynagh
482cf2f0ff KE2: Start extracting return statements 2024-09-26 13:12:54 +01:00
Ian Lynagh
9601b10734 KE2: Towards extracting expressions 2024-09-26 13:12:53 +01:00
Ian Lynagh
d105258363 KE2: Start extracting blocks 2024-09-26 13:12:52 +01:00
Ian Lynagh
35400d80e8 KE2: Start looking at function bodies 2024-09-26 13:12:51 +01:00
Ian Lynagh
16e182f7a8 KE2: Start extracting locations 2024-09-26 13:12:50 +01:00
Ian Lynagh
572b83cb90 KE2: Output something for classes to satisfy the db checks 2024-09-26 13:12:49 +01:00
Ian Lynagh
310f4e3491 KE2: Emit methods 2024-09-26 13:12:48 +01:00
Ian Lynagh
81f879f453 KE2: Start extracting methods 2024-09-26 13:12:47 +01:00
Ian Lynagh
d85f05be0c KE2: Start extracting method return types 2024-09-26 13:12:46 +01:00
Ian Lynagh
581fed8ae9 KE2: More type extraction 2024-09-26 13:12:45 +01:00
Ian Lynagh
dbf82d5225 KE2: Start looking at extracting types 2024-09-26 13:12:44 +01:00
Ian Lynagh
74d2b43bfb KE2: Make analysis info available to the extrator modules 2024-09-26 13:12:43 +01:00
Ian Lynagh
50e139f29c KE2: Implement CODEQL_EXTRACTOR_JAVA_KOTLIN_DUMP 2024-09-26 13:12:42 +01:00
Ian Lynagh
834f2c0dfb KE2: Tweak functino labels slightly 2024-09-26 13:12:41 +01:00
Ian Lynagh
770f2d6949 KE2: Get some kind of function ID written 2024-09-26 13:12:40 +01:00
Ian Lynagh
4e9a1ef925 KE2: Start extracting functions 2024-09-26 13:12:39 +01:00
Ian Lynagh
c98415631f KE2: Start extracting declaration parents 2024-09-26 13:12:38 +01:00
Ian Lynagh
75e78965f0 KE2: Towards parent decls 2024-09-26 13:12:37 +01:00
Ian Lynagh
429daa3f7c KE2: Start extracting declarations 2024-09-26 13:12:35 +01:00
Ian Lynagh
c47660ae70 KE2: Enable the internal-test-exception code 2024-09-26 13:12:34 +01:00
Ian Lynagh
90a73582ee KE2: Extract package info 2024-09-26 13:12:33 +01:00
Ian Lynagh
f9f766c508 KE2: Start turning KotlinUsesExtractor back on 2024-09-26 13:12:32 +01:00
Ian Lynagh
f3d41ba597 KE2: Actually make location labels 2024-09-26 13:12:31 +01:00
Ian Lynagh
0f1f53cc87 KE2: Ensure all log messages at least get written to the log file 2024-09-26 13:12:30 +01:00
Ian Lynagh
92a2b51be0 KE2: Pass the trap writer in to the file extractor 2024-09-26 13:12:29 +01:00
Ian Lynagh
30626ca7e4 KE2: Start getting deeper into KotlinFileExtractor 2024-09-26 13:12:28 +01:00
Ian Lynagh
e46e5e4cd8 KE2: Start on KotlinFileExtractor 2024-09-26 13:12:27 +01:00
Ian Lynagh
0e32446daa KE2: Remove the LighterAST LoC support 2024-09-26 13:12:26 +01:00
Ian Lynagh
f34b140e2f KE2: Extract file meta info 2024-09-26 13:12:25 +01:00
Ian Lynagh
99161bcb1e KE2: Start writing the actual TRAP files 2024-09-26 13:12:24 +01:00
Ian Lynagh
2c20072e88 KE1: Add some exception handling 2024-09-26 13:12:23 +01:00
Ian Lynagh
70926097df KE2: Remove unnecessary imports 2024-09-26 13:12:22 +01:00
Ian Lynagh
8ebd07e655 KE2: Get TrapFileWriter working 2024-09-26 13:12:20 +01:00
Ian Lynagh
9c4aa931d5 KE2: Move the context stack from LoggerBase to Logger
This will let us have different threads with their own contexts that
share a LoggerBase.
2024-09-26 13:12:19 +01:00
Ian Lynagh
6391ed9865 KE2: Towards TrapFileWriter 2024-09-26 13:12:18 +01:00
Ian Lynagh
4886602426 KE2: Pull a TrapFileWriter.kt out of KotlinExtractor.kt 2024-09-26 13:12:17 +01:00
Ian Lynagh
f54ff1176d KE2: Pass the trap directory through 2024-09-26 13:12:16 +01:00
Ian Lynagh
b903f05883 KE2: Populate source directory 2024-09-26 13:12:15 +01:00
Ian Lynagh
155da0b243 KE2: test-kotlin2/library-tests/files now has no consistency failures 2024-09-26 13:12:14 +01:00
Ian Lynagh
6073180e02 KE2: Emit compilation_finished 2024-09-26 13:12:13 +01:00
Ian Lynagh
f2e47fc09e KE2: More logging 2024-09-26 13:12:12 +01:00
Ian Lynagh
f3afedd510 KE2: We now create a Logger 2024-09-26 13:12:11 +01:00
Ian Lynagh
8b11b65292 KE2: Add the compilation properly 2024-09-26 13:12:10 +01:00
Ian Lynagh
0f12ec3a72 KE2: Start actually emitting some TRAP 2024-09-26 13:12:09 +01:00
Ian Lynagh
50c04b44ca KE2: Tweak LogCounter; now renamed to DiagnosticCounter 2024-09-26 13:12:08 +01:00
Ian Lynagh
88c40d52c8 KE2: Build all Kotlin source files 2024-09-26 13:12:07 +01:00
Ian Lynagh
57da1df4bb KE2: Get the test driver working 2024-09-26 13:12:06 +01:00
Ian Lynagh
d442a532ad KE2: Merge KotlinExtractorExtension into KotlinExtractor 2024-09-26 13:12:05 +01:00
Ian Lynagh
ca0ed61147 KE2: Add the top-level eror handling 2024-09-26 13:12:04 +01:00
Ian Lynagh
9a1b3dd2de KE2: Comment out KE1 code 2024-09-26 13:12:03 +01:00
Ian Lynagh
888c9bce44 KE2: Put the main source file into our package 2024-09-26 13:12:02 +01:00
Ian Lynagh
6ce74be717 KE2: Remove the KE1 resources 2024-09-26 13:12:01 +01:00
Ian Lynagh
1cfbc8e86d KE2: Handle multiple files 2024-09-26 13:12:00 +01:00
Ian Lynagh
1bd1789861 KE2: Get source file list from arguments 2024-09-26 13:11:59 +01:00
Paolo Tranquilli
b0a1475c10 KE2: package ke2 executable with wrapper scripts 2024-09-26 13:11:57 +01:00
Ian Lynagh
602ffb0516 KE2: More steps towards something working 2024-09-26 13:11:56 +01:00
Ian Lynagh
1fc01606ec KE2: More steps towards something working 2024-09-26 13:11:55 +01:00
Ian Lynagh
cd7b0e3757 KE2: Uncomment more imports 2024-09-26 13:11:54 +01:00
Paolo Tranquilli
7447474207 KE2: add some third party dependencies as maven artifacts 2024-09-26 13:11:53 +01:00
Paolo Tranquilli
dc51c5fc5b KE2: add bazel BUILD file 2024-09-26 13:11:52 +01:00
Ian Lynagh
5189f17e6f KE2: Remove old build system from the KE2 copy 2024-09-26 13:11:51 +01:00
Ian Lynagh
3c347317e5 KE2: Add trivial build 2024-09-26 13:11:50 +01:00
Ian Lynagh
8322e31148 KE2: Copy Kotlin extractor 1 to start Kotlin extractor 2
Sans deps.
2024-09-26 13:11:49 +01:00
21606 changed files with 555447 additions and 1884997 deletions

View File

@@ -2,21 +2,13 @@ common --enable_platform_specific_config
# because we use --override_module with `%workspace%`, the lock file is not stable
common --lockfile_mode=off
# Build release binaries by default, can be overwritten to in local.bazelrc and set to `fastbuild` or `dbg`
build --compilation_mode opt
# when building from this repository in isolation, the internal repository will not be found at ..
# where `MODULE.bazel` looks for it. The following will get us past the module loading phase, so
# that we can build things that do not rely on that
common --override_module=semmle_code=%workspace%/misc/bazel/semmle_code_stub
build --repo_env=CC=clang --repo_env=CXX=clang++
# Disable Android SDK auto-detection (we don't use it, and rules_android has Bazel 9 compatibility issues)
build --repo_env=ANDROID_HOME=
# print test output, like sembuild does.
# Set to `errors` if this is too verbose.
test --test_output all
# we use transitions that break builds of `...`, so for `test` to work with that we need the following
test --build_tests_only
@@ -32,16 +24,4 @@ common --registry=https://bcr.bazel.build
common --@rules_dotnet//dotnet/settings:strict_deps=false
# we only configure a nightly toolchain
common --@rules_rust//rust/toolchain/channel=nightly
# Reduce this eventually to empty, once we've fixed all our usages of java, and https://github.com/bazel-contrib/rules_go/issues/4193 is fixed
common --incompatible_autoload_externally="+@rules_cc,+@rules_java,+@rules_shell"
build --java_language_version=17
build --tool_java_language_version=17
build --tool_java_runtime_version=remotejdk_17
build --java_runtime_version=remotejdk_17
build --@rules_python//python/config_settings:python_version=3.12
try-import %workspace%/local.bazelrc

View File

@@ -8,5 +8,3 @@ common --registry=https://bcr.bazel.build
# its implementation packages without providing any code itself.
# We either can depend on internal implementation details, or turn of strict deps.
common --@rules_dotnet//dotnet/settings:strict_deps=false
build --@rules_python//python/config_settings:python_version=3.12

View File

@@ -1 +1 @@
9.0.0
8.0.0rc1

View File

@@ -1,7 +0,0 @@
FROM mcr.microsoft.com/devcontainers/base:ubuntu-24.04
USER root
# Install needed packages according to https://codeql.github.com/docs/codeql-overview/system-requirements/
# most come from the base image, but we need to install some additional ones
RUN DEBIAN_FRONTEND=noninteractive apt update && apt install -y sudo man-db python3.12 npm unminimize
RUN yes | unminimize

View File

@@ -7,10 +7,6 @@
"ms-vscode.test-adapter-converter",
"slevesque.vscode-zipexplorer"
],
"build": {
// Path is relative to the devcontainer.json file.
"dockerfile": "Dockerfile.codespaces"
},
"settings": {
"files.watcherExclude": {
"**/target/**": true

View File

@@ -0,0 +1,9 @@
# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.236.0/containers/cpp/.devcontainer/base.Dockerfile
# [Choice] Debian / Ubuntu version (use Debian 11, Ubuntu 18.04/22.04 on local arm64/Apple Silicon): debian-11, debian-10, ubuntu-22.04, ubuntu-20.04, ubuntu-18.04
FROM mcr.microsoft.com/vscode/devcontainers/cpp:0-ubuntu-22.04
USER root
ADD root.sh /tmp/root.sh
ADD update-codeql.sh /usr/local/bin/update-codeql
RUN bash /tmp/root.sh && rm /tmp/root.sh

View File

@@ -0,0 +1,25 @@
{
"extensions": [
"github.vscode-codeql",
"hbenl.vscode-test-explorer",
"ms-vscode.test-adapter-converter",
"slevesque.vscode-zipexplorer",
"ms-vscode.cpptools"
],
"settings": {
"files.watcherExclude": {
"**/target/**": true
},
"codeQL.runningQueries.memory": 2048
},
"build": {
"dockerfile": "Dockerfile",
},
"runArgs": [
"--cap-add=SYS_PTRACE",
"--security-opt",
"seccomp=unconfined"
],
"remoteUser": "vscode",
"onCreateCommand": ".devcontainer/swift/user.sh"
}

34
.devcontainer/swift/root.sh Executable file
View File

@@ -0,0 +1,34 @@
set -xe
BAZELISK_VERSION=v1.12.0
BAZELISK_DOWNLOAD_SHA=6b0bcb2ea15bca16fffabe6fda75803440375354c085480fe361d2cbf32501db
# install git lfs apt source
curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash
# install gh apt source
(type -p wget >/dev/null || (sudo apt update && sudo apt-get install wget -y)) \
&& sudo mkdir -p -m 755 /etc/apt/keyrings \
&& wget -qO- https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo tee /etc/apt/keyrings/githubcli-archive-keyring.gpg > /dev/null \
&& sudo chmod go+r /etc/apt/keyrings/githubcli-archive-keyring.gpg \
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null \
apt-get update
export DEBIAN_FRONTEND=noninteractive
apt-get -y install --no-install-recommends \
zlib1g-dev \
uuid-dev \
python3-distutils \
python3-pip \
bash-completion \
git-lfs \
gh
# Install Bazel
curl -fSsL -o /usr/local/bin/bazelisk https://github.com/bazelbuild/bazelisk/releases/download/${BAZELISK_VERSION}/bazelisk-linux-amd64
echo "${BAZELISK_DOWNLOAD_SHA} */usr/local/bin/bazelisk" | sha256sum --check -
chmod 0755 /usr/local/bin/bazelisk
ln -s bazelisk /usr/local/bin/bazel
# install latest codeql
update-codeql

View File

@@ -0,0 +1,20 @@
#!/bin/bash -e
URL=https://github.com/github/codeql-cli-binaries/releases
LATEST_VERSION=$(curl -L -s -H 'Accept: application/json' $URL/latest | sed -e 's/.*"tag_name":"\([^"]*\)".*/\1/')
CURRENT_VERSION=v$(codeql version 2>/dev/null | sed -ne 's/.*release \([0-9.]*\)\./\1/p')
if [[ $CURRENT_VERSION != $LATEST_VERSION ]]; then
if [[ $UID != 0 ]]; then
echo "update required, please run this script with sudo:"
echo " sudo $0"
exit 1
fi
ZIP=$(mktemp codeql.XXXX.zip)
curl -fSqL -o $ZIP $URL/download/$LATEST_VERSION/codeql-linux64.zip
unzip -q $ZIP -d /opt
rm $ZIP
ln -sf /opt/codeql/codeql /usr/local/bin/codeql
echo installed version $LATEST_VERSION
else
echo current version $CURRENT_VERSION is up-to-date
fi

15
.devcontainer/swift/user.sh Executable file
View File

@@ -0,0 +1,15 @@
set -xe
git lfs install
# add the workspace to the codeql search path
mkdir -p /home/vscode/.config/codeql
echo "--search-path /workspaces/codeql" > /home/vscode/.config/codeql/config
# create a swift extractor pack with the current state
cd /workspaces/codeql
bazel run swift/create-extractor-pack
#install and set up pre-commit
python3 -m pip install pre-commit --no-warn-script-location
$HOME/.local/bin/pre-commit install

7
.gitattributes vendored
View File

@@ -50,6 +50,7 @@
*.dll -text
*.pdb -text
/maven_install.json linguist-generated=true
/java/ql/test/stubs/**/*.java linguist-generated=true
/java/ql/test/experimental/stubs/**/*.java linguist-generated=true
/java/kotlin-extractor/deps/*.jar filter=lfs diff=lfs merge=lfs -text
@@ -82,6 +83,8 @@
/csharp/paket.main.bzl linguist-generated=true
/csharp/paket.main_extension.bzl linguist-generated=true
# ripunzip tool
/misc/ripunzip/ripunzip-* filter=lfs diff=lfs merge=lfs -text
# swift prebuilt resources
/swift/third_party/resources/*.zip filter=lfs diff=lfs merge=lfs -text
/swift/third_party/resources/*.tar.zst filter=lfs diff=lfs merge=lfs -text
/swift/third_party/resource-dir/*.zip filter=lfs diff=lfs merge=lfs -text

View File

@@ -4,13 +4,10 @@ queries:
- uses: security-and-quality
paths-ignore:
- '/actions/ql/test'
- '/cpp/'
- '/java/'
- '/python/'
- '/javascript/ql/test'
- '/javascript/ql/integration-tests'
- '/javascript/extractor/tests'
- '/javascript/extractor/parser-tests'
- '/javascript/ql/src/'
- '/rust/ql'
- '/rust/ql/test'
- '/rust/ql/integration-tests'

View File

@@ -40,10 +40,3 @@ updates:
- dependency-name: "*"
reviewers:
- "github/codeql-go"
- package-ecosystem: bazel
directory: "/"
schedule:
interval: weekly
exclude-paths:
- "misc/bazel/registry/**"

View File

@@ -1,4 +0,0 @@
---
applyTo: "**/*.expected"
---
Ignore these files. These are generated to be correct by running the tests, and should not be edited manually.

View File

@@ -1,6 +0,0 @@
---
applyTo: "**/*.ql,**/*.qll"
---
When reviewing these QL files, do not make any comment on the code itself. You don't understand the QL programming language well enough yet. You can only make comments about the following aspects:
* comments (lines starting with `//` or block comments enclosed in `/* ... */`): you can suggest improvements to the clarity of comments, or point out spelling mistakes
* typos in identifiers

3
.github/labeler.yml vendored
View File

@@ -11,7 +11,7 @@ Go:
- change-notes/**/*go.*
Java:
- any: [ 'java/**/*', '!java/kotlin-extractor/**/*', '!java/ql/test/kotlin/**/*' ]
- any: [ 'java/**/*', '!java/kotlin-extractor/**/*', '!java/kotlin-extractor2/**/*', '!java/ql/test-kotlin*/**/*' ]
- change-notes/**/*java.*
JS:
@@ -20,6 +20,7 @@ JS:
Kotlin:
- java/kotlin-extractor/**/*
- java/kotlin-extractor2/**/*
- java/ql/test-kotlin*/**/*
Python:

14
.github/pull_request_template.md vendored Normal file
View File

@@ -0,0 +1,14 @@
### Pull Request checklist
#### All query authors
- [ ] A change note is added if necessary. See [the documentation](https://github.com/github/codeql/blob/main/docs/change-notes.md) in this repository.
- [ ] All new queries have appropriate `.qhelp`. See [the documentation](https://github.com/github/codeql/blob/main/docs/query-help-style-guide.md) in this repository.
- [ ] QL tests are added if necessary. See [Testing custom queries](https://docs.github.com/en/code-security/codeql-cli/using-the-advanced-functionality-of-the-codeql-cli/testing-custom-queries) in the GitHub documentation.
- [ ] New and changed queries have correct query metadata. See [the documentation](https://github.com/github/codeql/blob/main/docs/query-metadata-style-guide.md) in this repository.
#### Internal query authors only
- [ ] Autofixes generated based on these changes are valid, only needed if this PR makes significant changes to `.ql`, `.qll`, or `.qhelp` files. See [the documentation](https://github.com/github/codeql-team/blob/main/docs/best-practices/validating-autofix-for-query-changes.md) (internal access required).
- [ ] Changes are validated [at scale](https://github.com/github/codeql-dca/) (internal access required).
- [ ] Adding a new query? Consider also [adding the query to autofix](https://github.com/github/codeml-autofix/blob/main/docs/updating-query-support.md#adding-a-new-query-to-the-query-suite).

74
.github/workflows/build-ripunzip.yml vendored Normal file
View File

@@ -0,0 +1,74 @@
name: Build runzip
on:
workflow_dispatch:
inputs:
ripunzip-version:
description: "what reference to checktout from google/runzip"
required: false
default: v1.2.1
openssl-version:
description: "what reference to checkout from openssl/openssl for Linux"
required: false
default: openssl-3.3.0
jobs:
build:
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04, macos-13, windows-2019]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
repository: google/ripunzip
ref: ${{ inputs.ripunzip-version }}
# we need to avoid ripunzip dynamically linking into libssl
# see https://github.com/sfackler/rust-openssl/issues/183
- if: runner.os == 'Linux'
name: checkout openssl
uses: actions/checkout@v4
with:
repository: openssl/openssl
path: openssl
ref: ${{ inputs.openssl-version }}
- if: runner.os == 'Linux'
name: build and install openssl with fPIC
shell: bash
working-directory: openssl
run: |
./config -fPIC --prefix=$HOME/.local --openssldir=$HOME/.local/ssl
make -j $(nproc)
make install_sw -j $(nproc)
- if: runner.os == 'Linux'
name: build (linux)
shell: bash
run: |
env OPENSSL_LIB_DIR=$HOME/.local/lib64 OPENSSL_INCLUDE_DIR=$HOME/.local/include OPENSSL_STATIC=yes cargo build --release
mv target/release/ripunzip ripunzip-linux
- if: runner.os == 'Windows'
name: build (windows)
shell: bash
run: |
cargo build --release
mv target/release/ripunzip ripunzip-windows
- name: build (macOS)
if: runner.os == 'macOS'
shell: bash
run: |
rustup target install x86_64-apple-darwin
rustup target install aarch64-apple-darwin
cargo build --target x86_64-apple-darwin --release
cargo build --target aarch64-apple-darwin --release
lipo -create -output ripunzip-macos \
-arch x86_64 target/x86_64-apple-darwin/release/ripunzip \
-arch arm64 target/aarch64-apple-darwin/release/ripunzip
- uses: actions/upload-artifact@v4
with:
name: ripunzip-${{ runner.os }}
path: ripunzip-*
- name: Check built binary
shell: bash
run: |
./ripunzip-* --version

View File

@@ -17,7 +17,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v5
uses: actions/checkout@v4
- name: Check bazel formatting
uses: pre-commit/action@646c83fcd040023954eafda54b4db0192ce70507
with:

View File

@@ -16,6 +16,7 @@ on:
- "shared/**/*.qll"
- "!**/experimental/**"
- "!ql/**"
- "!rust/**"
- ".github/workflows/check-change-note.yml"
jobs:

View File

@@ -16,7 +16,7 @@ jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/checkout@v4
- name: Check that implicit this warnings is enabled for all packs
shell: bash
run: |

View File

@@ -1,23 +0,0 @@
name: Check overlay annotations
on:
push:
branches:
- main
- 'rc/*'
pull_request:
branches:
- main
- 'rc/*'
permissions:
contents: read
jobs:
sync:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Check overlay annotations
run: python config/add-overlay-annotations.py --check java

View File

@@ -18,7 +18,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/checkout@v4
with:
fetch-depth: 2
@@ -30,8 +30,7 @@ jobs:
run: |
EXIT_CODE=0
# TODO: remove the shared exception from the regex when coverage of qlpacks without dbschemes is supported
# TODO: remove the actions exception once https://github.com/github/codeql-team/issues/3656 is fixed
changed_lib_packs="$(git diff --name-only --diff-filter=ACMRT HEAD^ HEAD | { grep -Po '^(?!(shared|actions))[a-z]*/ql/lib' || true; } | sort -u)"
changed_lib_packs="$(git diff --name-only --diff-filter=ACMRT HEAD^ HEAD | { grep -Po '^(?!(shared))[a-z]*/ql/lib' || true; } | sort -u)"
for pack_dir in ${changed_lib_packs}; do
lang="${pack_dir%/ql/lib}"
codeql generate library-doc-coverage --output="${RUNNER_TEMP}/${lang}-current.txt" --dir="${pack_dir}"

View File

@@ -19,6 +19,6 @@ jobs:
name: Check query IDs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/checkout@v4
- name: Check for duplicate query IDs
run: python3 misc/scripts/check-query-ids.py

View File

@@ -18,10 +18,6 @@ on:
jobs:
CodeQL-Build:
strategy:
fail-fast: false
matrix:
language: ['actions', 'csharp']
runs-on: ubuntu-latest
@@ -34,16 +30,17 @@ jobs:
- name: Setup dotnet
uses: actions/setup-dotnet@v4
with:
dotnet-version: 10.0.100
dotnet-version: 9.0.100
- name: Checkout repository
uses: actions/checkout@v5
uses: actions/checkout@v4
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@main
# Override language selection by uncommenting this and choosing your languages
with:
languages: ${{ matrix.language }}
languages: csharp
config-file: ./.github/codeql/codeql-config.yml
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).

41
.github/workflows/compile-queries.yml vendored Normal file
View File

@@ -0,0 +1,41 @@
name: "Compile all queries using the latest stable CodeQL CLI"
on:
push:
branches: # makes sure the cache gets populated - running on the branches people tend to merge into.
- main
- "rc/*"
- "codeql-cli-*"
pull_request:
permissions:
contents: read
jobs:
compile-queries:
if: github.repository_owner == 'github'
runs-on: ubuntu-latest-xl
steps:
- uses: actions/checkout@v4
- name: Setup CodeQL
uses: ./.github/actions/fetch-codeql
with:
channel: 'release'
- name: Cache compilation cache
id: query-cache
uses: ./.github/actions/cache-query-compilation
with:
key: all-queries
- name: check formatting
run: find shared */ql -type f \( -name "*.qll" -o -name "*.ql" \) -print0 | xargs -0 -n 3000 -P 10 codeql query format -q --check-only
- name: compile queries - check-only
# run with --check-only if running in a PR (github.sha != main)
if : ${{ github.event_name == 'pull_request' }}
shell: bash
run: codeql query compile -q -j0 */ql/{src,examples} --keep-going --warnings=error --check-only --compilation-cache "${{ steps.query-cache.outputs.cache-dir }}" --compilation-cache-size=500
- name: compile queries - full
# do full compile if running on main - this populates the cache
if : ${{ github.event_name != 'pull_request' }}
shell: bash
run: codeql query compile -q -j0 */ql/{src,examples} --keep-going --warnings=error --compilation-cache "${{ steps.query-cache.outputs.cache-dir }}" --compilation-cache-size=500

View File

@@ -19,7 +19,7 @@ on:
jobs:
CodeQL-Build:
runs-on: ubuntu-24.04
runs-on: ubuntu-latest
permissions:
contents: read
@@ -28,7 +28,7 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v5
uses: actions/checkout@v4
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
@@ -38,15 +38,17 @@ jobs:
languages: cpp
config-file: ./.github/codeql/codeql-config.yml
- name: Install dependencies
- name: "[Ubuntu] Remove GCC 13 from runner image"
shell: bash
run: |
sudo rm -f /etc/apt/sources.list.d/ubuntu-toolchain-r-ubuntu-test-jammy.list
sudo apt-get update
sudo apt-get install -y uuid-dev
sudo apt-get install -y --allow-downgrades libc6=2.35-* libc6-dev=2.35-* libstdc++6=12.3.0-* libgcc-s1=12.3.0-*
- name: "Build Swift extractor using Bazel"
run: |
bazel clean --expunge
bazel run //swift:install --nouse_action_cache --noremote_accept_cached --noremote_upload_local_results --spawn_strategy=local
bazel run //swift:create-extractor-pack --nouse_action_cache --noremote_accept_cached --noremote_upload_local_results --spawn_strategy=local
bazel shutdown
- name: Perform CodeQL Analysis

View File

@@ -5,10 +5,8 @@ on:
paths:
- "csharp/**"
- "shared/**"
- "misc/bazel/**"
- .github/actions/fetch-codeql/action.yml
- codeql-workspace.yml
- "MODULE.bazel"
branches:
- main
- "rc/*"
@@ -16,11 +14,9 @@ on:
paths:
- "csharp/**"
- "shared/**"
- "misc/bazel/**"
- .github/workflows/csharp-qltest.yml
- .github/actions/fetch-codeql/action.yml
- codeql-workspace.yml
- "MODULE.bazel"
branches:
- main
- "rc/*"
@@ -36,26 +32,26 @@ jobs:
unit-tests:
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
os: [ubuntu-latest, windows-2019]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v5
- uses: actions/checkout@v4
- name: Setup dotnet
uses: actions/setup-dotnet@v4
with:
dotnet-version: 10.0.100
dotnet-version: 9.0.100
- name: Extractor unit tests
run: |
dotnet tool restore
dotnet test -p:RuntimeFrameworkVersion=10.0.0 extractor/Semmle.Util.Tests
dotnet test -p:RuntimeFrameworkVersion=10.0.0 extractor/Semmle.Extraction.Tests
dotnet test -p:RuntimeFrameworkVersion=10.0.0 autobuilder/Semmle.Autobuild.CSharp.Tests
dotnet test -p:RuntimeFrameworkVersion=10.0.0 autobuilder/Semmle.Autobuild.Cpp.Tests
dotnet test -p:RuntimeFrameworkVersion=9.0.0 extractor/Semmle.Util.Tests
dotnet test -p:RuntimeFrameworkVersion=9.0.0 extractor/Semmle.Extraction.Tests
dotnet test -p:RuntimeFrameworkVersion=9.0.0 autobuilder/Semmle.Autobuild.CSharp.Tests
dotnet test -p:RuntimeFrameworkVersion=9.0.0 autobuilder/Semmle.Autobuild.Cpp.Tests
shell: bash
stubgentest:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/checkout@v4
- uses: ./csharp/actions/create-extractor-pack
- name: Run stub generator tests
run: |
@@ -66,6 +62,6 @@ jobs:
# Update existing stubs in the repo with the freshly generated ones
mv "$STUBS_PATH/output/stubs/_frameworks" ql/test/resources/stubs/
git status
codeql test run --threads=0 --search-path "${{ github.workspace }}" --check-databases --check-diff-informed --check-undefined-labels --check-repeated-labels --check-redefined-labels --consistency-queries ql/consistency-queries -- ql/test/library-tests/dataflow/flowsources/aspremote
codeql test run --threads=0 --search-path "${{ github.workspace }}" --check-databases --check-undefined-labels --check-repeated-labels --check-redefined-labels --consistency-queries ql/consistency-queries -- ql/test/library-tests/dataflow/flowsources/aspremote
env:
GITHUB_TOKEN: ${{ github.token }}

View File

@@ -23,7 +23,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v5
uses: actions/checkout@v4
- name: Setup CodeQL
uses: ./.github/actions/fetch-codeql
- name: Create empty database
@@ -51,7 +51,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v5
uses: actions/checkout@v4
- name: Setup CodeQL
uses: ./.github/actions/fetch-codeql
- name: Create empty database

View File

@@ -35,11 +35,11 @@ jobs:
GITHUB_CONTEXT: ${{ toJSON(github.event) }}
run: echo "$GITHUB_CONTEXT"
- name: Clone self (github/codeql) - MERGE
uses: actions/checkout@v5
uses: actions/checkout@v4
with:
path: merge
- name: Clone self (github/codeql) - BASE
uses: actions/checkout@v5
uses: actions/checkout@v4
with:
fetch-depth: 2
path: base

View File

@@ -24,7 +24,7 @@ jobs:
GITHUB_CONTEXT: ${{ toJSON(github.event) }}
run: echo "$GITHUB_CONTEXT"
- name: Clone self (github/codeql)
uses: actions/checkout@v5
uses: actions/checkout@v4
- name: Set up Python 3.8
uses: actions/setup-python@v4
with:

View File

@@ -12,11 +12,11 @@ jobs:
steps:
- name: Clone self (github/codeql)
uses: actions/checkout@v5
uses: actions/checkout@v4
with:
path: script
- name: Clone self (github/codeql) for analysis
uses: actions/checkout@v5
uses: actions/checkout@v4
with:
path: codeqlModels
fetch-depth: 0

View File

@@ -21,7 +21,7 @@ jobs:
GITHUB_CONTEXT: ${{ toJSON(github.event) }}
run: echo "$GITHUB_CONTEXT"
- name: Clone self (github/codeql)
uses: actions/checkout@v5
uses: actions/checkout@v4
with:
path: ql
fetch-depth: 0

View File

@@ -16,11 +16,11 @@ jobs:
steps:
- name: Clone self (github/codeql)
uses: actions/checkout@v5
uses: actions/checkout@v4
with:
path: script
- name: Clone self (github/codeql) for analysis
uses: actions/checkout@v5
uses: actions/checkout@v4
with:
path: codeqlModels
ref: ${{ github.event.inputs.qlModelShaOverride || github.ref }}

View File

@@ -26,7 +26,7 @@ jobs:
exit 1
- name: Checkout
uses: actions/checkout@v5
uses: actions/checkout@v4
- name: Git config
shell: bash

35
.github/workflows/go-tests-other-os.yml vendored Normal file
View File

@@ -0,0 +1,35 @@
name: "Go: Run Tests - Other OS"
on:
pull_request:
paths:
- "go/**"
- "!go/ql/**" # don't run other-os if only ql/ files changed
- .github/workflows/go-tests-other-os.yml
- .github/actions/**
- codeql-workspace.yml
- MODULE.bazel
- .bazelrc
- misc/bazel/**
permissions:
contents: read
jobs:
test-mac:
name: Test MacOS
runs-on: macos-latest
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Run tests
uses: ./go/actions/test
test-win:
if: github.repository_owner == 'github'
name: Test Windows
runs-on: windows-latest-xl
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Run tests
uses: ./go/actions/test

View File

@@ -1,9 +1,18 @@
name: "Go: Run Tests"
on:
push:
paths:
- "go/**"
- "shared/**"
- .github/workflows/go-tests.yml
- .github/actions/**
- codeql-workspace.yml
branches:
- main
- "rc/*"
pull_request:
paths:
- "go/**"
- "!go/documentation/**"
- "shared/**"
- .github/workflows/go-tests.yml
- .github/actions/**
@@ -22,7 +31,7 @@ jobs:
runs-on: ubuntu-latest-xl
steps:
- name: Check out code
uses: actions/checkout@v5
uses: actions/checkout@v4
- name: Run tests
uses: ./go/actions/test
with:

View File

@@ -20,7 +20,7 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/checkout@v4
- run: |
bazel query //java/kotlin-extractor/...
# only build the default version as a quick check that we can build from `codeql`

View File

@@ -28,12 +28,12 @@ jobs:
slug: ${{fromJson(github.event.inputs.projects || '["apache/commons-codec", "apache/commons-io", "apache/commons-beanutils", "apache/commons-logging", "apache/commons-fileupload", "apache/commons-lang", "apache/commons-validator", "apache/commons-csv", "apache/dubbo"]' )}}
steps:
- name: Clone github/codeql from PR
uses: actions/checkout@v5
uses: actions/checkout@v4
if: github.event.pull_request
with:
path: codeql-pr
- name: Clone github/codeql from main
uses: actions/checkout@v5
uses: actions/checkout@v4
with:
path: codeql-main
ref: main
@@ -68,9 +68,9 @@ jobs:
DATABASE=$2
cd codeql-$QL_VARIANT
SHORTNAME=`basename $DATABASE`
python misc/scripts/models-as-data/generate_mad.py --language java --with-summaries --with-sinks $DATABASE $SHORTNAME/$QL_VARIANT
python java/ql/src/utils/modelgenerator/GenerateFlowModel.py --with-summaries --with-sinks $DATABASE $SHORTNAME/$QL_VARIANT
mkdir -p $MODELS/$SHORTNAME
mv java/ql/lib/ext/generated/modelgenerator/$SHORTNAME/$QL_VARIANT $MODELS/$SHORTNAME
mv java/ql/lib/ext/generated/$SHORTNAME/$QL_VARIANT $MODELS/$SHORTNAME
cd ..
}

View File

@@ -30,11 +30,11 @@ jobs:
ref: "placeholder"
steps:
- name: Clone self (github/codeql)
uses: actions/checkout@v5
uses: actions/checkout@v4
- name: Setup CodeQL binaries
uses: ./.github/actions/fetch-codeql
- name: Clone repositories
uses: actions/checkout@v5
uses: actions/checkout@v4
with:
path: repos/${{ matrix.ref }}
ref: ${{ matrix.ref }}

View File

@@ -1,35 +0,0 @@
name: Python tooling
on:
pull_request:
paths:
- "misc/bazel/**"
- "misc/codegen/**"
- "misc/scripts/models-as-data/*.py"
- "*.bazel*"
- .github/workflows/codegen.yml
- .pre-commit-config.yaml
branches:
- main
- rc/*
- codeql-cli-*
permissions:
contents: read
jobs:
check-python-tooling:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- uses: pre-commit/action@646c83fcd040023954eafda54b4db0192ce70507
name: Check that python code is properly formatted
with:
extra_args: black --all-files
- name: Run codegen tests
shell: bash
run: |
bazel test //misc/codegen/...

View File

@@ -43,7 +43,7 @@ jobs:
if-no-files-found: error
retention-days: 1
- uses: actions/checkout@v5
- uses: actions/checkout@v4
with:
fetch-depth: 2
persist-credentials: false

View File

@@ -19,7 +19,7 @@ jobs:
runs-on: ubuntu-latest-xl
steps:
### Build the queries ###
- uses: actions/checkout@v5
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Find codeql
@@ -27,7 +27,6 @@ jobs:
uses: github/codeql-action/init@main
with:
languages: javascript # does not matter
tools: nightly
- uses: ./.github/actions/os-version
id: os_version
### Build the extractor ###

View File

@@ -25,7 +25,7 @@ jobs:
- github/codeql
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/checkout@v4
- name: Find codeql
id: find-codeql
@@ -46,14 +46,14 @@ jobs:
env:
CODEQL: ${{ steps.find-codeql.outputs.codeql-path }}
- name: Checkout ${{ matrix.repo }}
uses: actions/checkout@v5
uses: actions/checkout@v4
with:
repository: ${{ matrix.repo }}
path: ${{ github.workspace }}/repo
- name: Create database
run: |
"${CODEQL}" database create \
--search-path "${{ github.workspace }}" \
--search-path "${{ github.workspace }}"
--threads 4 \
--language ql --source-root "${{ github.workspace }}/repo" \
"${{ runner.temp }}/database"
@@ -75,7 +75,7 @@ jobs:
runs-on: ubuntu-latest
needs: measure
steps:
- uses: actions/checkout@v5
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: measurements

View File

@@ -24,13 +24,12 @@ jobs:
qltest:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/checkout@v4
- name: Find codeql
id: find-codeql
uses: github/codeql-action/init@main
with:
languages: javascript # does not matter
tools: nightly
- uses: ./.github/actions/os-version
id: os_version
- uses: actions/cache@v3
@@ -41,7 +40,7 @@ jobs:
ql/target
key: ${{ runner.os }}-${{ steps.os_version.outputs.version }}-qltest-cargo-${{ hashFiles('ql/rust-toolchain.toml', 'ql/**/Cargo.lock') }}
- name: Check formatting
run: cd ql; cargo fmt -- --check
run: cd ql; cargo fmt --all -- --check
- name: Build extractor
run: |
cd ql;
@@ -65,7 +64,7 @@ jobs:
needs: [qltest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v5
- uses: actions/checkout@v4
- name: Install GNU tar
if: runner.os == 'macOS'
run: |
@@ -76,7 +75,6 @@ jobs:
uses: github/codeql-action/init@main
with:
languages: javascript # does not matter
tools: nightly
- uses: ./.github/actions/os-version
id: os_version
- uses: actions/cache@v3

View File

@@ -23,7 +23,7 @@ jobs:
steps:
- name: Clone self (github/codeql)
uses: actions/checkout@v5
uses: actions/checkout@v4
with:
path: codeql
- name: Set up Python 3.8
@@ -31,7 +31,7 @@ jobs:
with:
python-version: 3.8
- name: Download CodeQL CLI
# Look under the `codeql` directory, as this is where we checked out the `github/codeql` repo
# Look under the `codeql` directory, as this is where we checked out the `github/codeql` repo
uses: ./codeql/.github/actions/fetch-codeql
- name: Build code scanning query list
run: |

236
.github/workflows/ruby-build.yml vendored Normal file
View File

@@ -0,0 +1,236 @@
name: "Ruby: Build"
on:
push:
paths:
- "ruby/**"
- .github/workflows/ruby-build.yml
- .github/actions/fetch-codeql/action.yml
- codeql-workspace.yml
- "shared/tree-sitter-extractor/**"
branches:
- main
- "rc/*"
pull_request:
paths:
- "ruby/**"
- .github/workflows/ruby-build.yml
- .github/actions/fetch-codeql/action.yml
- codeql-workspace.yml
- "shared/tree-sitter-extractor/**"
branches:
- main
- "rc/*"
workflow_dispatch:
inputs:
tag:
description: "Version tag to create"
required: false
env:
CARGO_TERM_COLOR: always
defaults:
run:
working-directory: ruby
permissions:
contents: read
jobs:
build:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Install GNU tar
if: runner.os == 'macOS'
run: |
brew install gnu-tar
echo "/usr/local/opt/gnu-tar/libexec/gnubin" >> $GITHUB_PATH
- name: Prepare Windows
if: runner.os == 'Windows'
shell: powershell
run: |
git config --global core.longpaths true
- uses: ./.github/actions/os-version
id: os_version
- name: Cache entire extractor
uses: actions/cache@v3
id: cache-extractor
with:
path: |
target/release/codeql-extractor-ruby
target/release/codeql-extractor-ruby.exe
ruby/extractor/ql/lib/codeql/ruby/ast/internal/TreeSitter.qll
key: ${{ runner.os }}-${{ steps.os_version.outputs.version }}-ruby-extractor-${{ hashFiles('ruby/extractor/rust-toolchain.toml', 'ruby/extractor/Cargo.lock') }}-${{ hashFiles('shared/tree-sitter-extractor') }}-${{ hashFiles('ruby/extractor/**/*.rs') }}
- uses: actions/cache@v3
if: steps.cache-extractor.outputs.cache-hit != 'true'
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-${{ steps.os_version.outputs.version }}-ruby-rust-cargo-${{ hashFiles('ruby/extractor/rust-toolchain.toml', 'ruby/extractor/**/Cargo.lock') }}
- name: Check formatting
if: steps.cache-extractor.outputs.cache-hit != 'true'
run: cd extractor && cargo fmt --all -- --check
- name: Build
if: steps.cache-extractor.outputs.cache-hit != 'true'
run: cd extractor && cargo build --verbose
- name: Run tests
if: steps.cache-extractor.outputs.cache-hit != 'true'
run: cd extractor && cargo test --verbose
- name: Release build
if: steps.cache-extractor.outputs.cache-hit != 'true'
run: cd extractor && cargo build --release
- name: Generate dbscheme
if: ${{ matrix.os == 'ubuntu-latest' && steps.cache-extractor.outputs.cache-hit != 'true'}}
run: ../target/release/codeql-extractor-ruby generate --dbscheme ql/lib/ruby.dbscheme --library ql/lib/codeql/ruby/ast/internal/TreeSitter.qll
- uses: actions/upload-artifact@v4
if: ${{ matrix.os == 'ubuntu-latest' }}
with:
name: ruby.dbscheme
path: ruby/ql/lib/ruby.dbscheme
- uses: actions/upload-artifact@v4
if: ${{ matrix.os == 'ubuntu-latest' }}
with:
name: TreeSitter.qll
path: ruby/ql/lib/codeql/ruby/ast/internal/TreeSitter.qll
- uses: actions/upload-artifact@v4
with:
name: extractor-${{ matrix.os }}
path: |
target/release/codeql-extractor-ruby
target/release/codeql-extractor-ruby.exe
retention-days: 1
compile-queries:
if: github.repository_owner == 'github'
runs-on: ubuntu-latest-xl
steps:
- uses: actions/checkout@v4
- name: Fetch CodeQL
uses: ./.github/actions/fetch-codeql
- name: Cache compilation cache
id: query-cache
uses: ./.github/actions/cache-query-compilation
with:
key: ruby-build
- name: Build Query Pack
run: |
PACKS=${{ runner.temp }}/query-packs
rm -rf $PACKS
codeql pack create ../misc/suite-helpers --output "$PACKS"
codeql pack create ../shared/regex --output "$PACKS"
codeql pack create ../shared/ssa --output "$PACKS"
codeql pack create ../shared/tutorial --output "$PACKS"
codeql pack create ql/lib --output "$PACKS"
codeql pack create -j0 ql/src --output "$PACKS" --compilation-cache "${{ steps.query-cache.outputs.cache-dir }}"
PACK_FOLDER=$(readlink -f "$PACKS"/codeql/ruby-queries/*)
codeql generate query-help --format=sarifv2.1.0 --output="${PACK_FOLDER}/rules.sarif" ql/src
(cd ql/src; find queries \( -name '*.qhelp' -o -name '*.rb' -o -name '*.erb' \) -exec bash -c 'mkdir -p "'"${PACK_FOLDER}"'/$(dirname "{}")"' \; -exec cp "{}" "${PACK_FOLDER}/{}" \;)
- uses: actions/upload-artifact@v4
with:
name: codeql-ruby-queries
path: |
${{ runner.temp }}/query-packs/*
retention-days: 1
include-hidden-files: true
package:
runs-on: ubuntu-latest
needs: [build, compile-queries]
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: ruby.dbscheme
path: ruby/ruby
- uses: actions/download-artifact@v4
with:
name: extractor-ubuntu-latest
path: ruby/linux64
- uses: actions/download-artifact@v4
with:
name: extractor-windows-latest
path: ruby/win64
- uses: actions/download-artifact@v4
with:
name: extractor-macos-latest
path: ruby/osx64
- run: |
mkdir -p ruby
cp -r codeql-extractor.yml tools ql/lib/ruby.dbscheme.stats ruby/
mkdir -p ruby/tools/{linux64,osx64,win64}
cp linux64/codeql-extractor-ruby ruby/tools/linux64/extractor
cp osx64/codeql-extractor-ruby ruby/tools/osx64/extractor
cp win64/codeql-extractor-ruby.exe ruby/tools/win64/extractor.exe
chmod +x ruby/tools/{linux64,osx64}/extractor
zip -rq codeql-ruby.zip ruby
- uses: actions/upload-artifact@v4
with:
name: codeql-ruby-pack
path: ruby/codeql-ruby.zip
retention-days: 1
include-hidden-files: true
- uses: actions/download-artifact@v4
with:
name: codeql-ruby-queries
path: ruby/qlpacks
- run: |
echo '{
"provide": [
"ruby/codeql-extractor.yml",
"qlpacks/*/*/*/qlpack.yml"
]
}' > .codeqlmanifest.json
zip -rq codeql-ruby-bundle.zip .codeqlmanifest.json ruby qlpacks
- uses: actions/upload-artifact@v4
with:
name: codeql-ruby-bundle
path: ruby/codeql-ruby-bundle.zip
retention-days: 1
include-hidden-files: true
test:
defaults:
run:
working-directory: ${{ github.workspace }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
needs: [package]
steps:
- uses: actions/checkout@v4
- name: Fetch CodeQL
uses: ./.github/actions/fetch-codeql
- name: Download Ruby bundle
uses: actions/download-artifact@v4
with:
name: codeql-ruby-bundle
path: ${{ runner.temp }}
- name: Unzip Ruby bundle
shell: bash
run: unzip -q -d "${{ runner.temp }}/ruby-bundle" "${{ runner.temp }}/codeql-ruby-bundle.zip"
- name: Run QL test
shell: bash
run: |
codeql test run --search-path "${{ runner.temp }}/ruby-bundle" --additional-packs "${{ runner.temp }}/ruby-bundle" ruby/ql/test/library-tests/ast/constants/
- name: Create database
shell: bash
run: |
codeql database create --search-path "${{ runner.temp }}/ruby-bundle" --language ruby --source-root ruby/ql/test/library-tests/ast/constants/ ../database
- name: Analyze database
shell: bash
run: |
codeql database analyze --search-path "${{ runner.temp }}/ruby-bundle" --format=sarifv2.1.0 --output=out.sarif ../database ruby-code-scanning.qls

View File

@@ -0,0 +1,75 @@
name: "Ruby: Collect database stats"
on:
push:
branches:
- main
- "rc/*"
paths:
- ruby/ql/lib/ruby.dbscheme
- .github/workflows/ruby-dataset-measure.yml
pull_request:
branches:
- main
- "rc/*"
paths:
- ruby/ql/lib/ruby.dbscheme
- .github/workflows/ruby-dataset-measure.yml
workflow_dispatch:
permissions:
contents: read
jobs:
measure:
env:
CODEQL_THREADS: 4 # TODO: remove this once it's set by the CLI
strategy:
fail-fast: false
matrix:
repo: [rails/rails, discourse/discourse, spree/spree, ruby/ruby]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/fetch-codeql
- uses: ./ruby/actions/create-extractor-pack
- name: Checkout ${{ matrix.repo }}
uses: actions/checkout@v4
with:
repository: ${{ matrix.repo }}
path: ${{ github.workspace }}/repo
- name: Create database
run: |
codeql database create \
--search-path "${{ github.workspace }}" \
--threads 4 \
--language ruby --source-root "${{ github.workspace }}/repo" \
"${{ runner.temp }}/database"
- name: Measure database
run: |
mkdir -p "stats/${{ matrix.repo }}"
codeql dataset measure --threads 4 --output "stats/${{ matrix.repo }}/stats.xml" "${{ runner.temp }}/database/db-ruby"
- uses: actions/upload-artifact@v4
with:
name: measurements-${{ hashFiles('stats/**') }}
path: stats
retention-days: 1
merge:
runs-on: ubuntu-latest
needs: measure
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
path: stats
- run: |
python -m pip install --user lxml
find stats -name 'stats.xml' | sort | xargs python ruby/scripts/merge_stats.py --output ruby/ql/lib/ruby.dbscheme.stats --normalise ruby_tokeninfo
- uses: actions/upload-artifact@v4
with:
name: ruby.dbscheme.stats
path: ruby/ql/lib/ruby.dbscheme.stats

73
.github/workflows/ruby-qltest.yml vendored Normal file
View File

@@ -0,0 +1,73 @@
name: "Ruby: Run QL Tests"
on:
push:
paths:
- "ruby/**"
- "shared/**"
- .github/workflows/ruby-build.yml
- .github/actions/fetch-codeql/action.yml
- codeql-workspace.yml
branches:
- main
- "rc/*"
pull_request:
paths:
- "ruby/**"
- "shared/**"
- .github/workflows/ruby-qltest.yml
- .github/actions/fetch-codeql/action.yml
- codeql-workspace.yml
branches:
- main
- "rc/*"
env:
CARGO_TERM_COLOR: always
defaults:
run:
working-directory: ruby
permissions:
contents: read
jobs:
qlupgrade:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/fetch-codeql
- name: Check DB upgrade scripts
run: |
echo >empty.trap
codeql dataset import -S ql/lib/upgrades/initial/ruby.dbscheme testdb empty.trap
codeql dataset upgrade testdb --additional-packs ql/lib
diff -q testdb/ruby.dbscheme ql/lib/ruby.dbscheme
- name: Check DB downgrade scripts
run: |
echo >empty.trap
rm -rf testdb; codeql dataset import -S ql/lib/ruby.dbscheme testdb empty.trap
codeql resolve upgrades --format=lines --allow-downgrades --additional-packs downgrades \
--dbscheme=ql/lib/ruby.dbscheme --target-dbscheme=downgrades/initial/ruby.dbscheme |
xargs codeql execute upgrades testdb
diff -q testdb/ruby.dbscheme downgrades/initial/ruby.dbscheme
qltest:
if: github.repository_owner == 'github'
runs-on: ubuntu-latest-xl
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/fetch-codeql
- uses: ./ruby/actions/create-extractor-pack
- name: Cache compilation cache
id: query-cache
uses: ./.github/actions/cache-query-compilation
with:
key: ruby-qltest
- name: Run QL tests
run: |
codeql test run --threads=0 --ram 50000 --search-path "${{ github.workspace }}" --check-databases --check-undefined-labels --check-unused-labels --check-repeated-labels --check-redefined-labels --check-use-before-definition --consistency-queries ql/consistency-queries ql/test --compilation-cache "${{ steps.query-cache.outputs.cache-dir }}"
env:
GITHUB_TOKEN: ${{ github.token }}

View File

@@ -35,7 +35,7 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v5
uses: actions/checkout@v4
- name: Query latest nightly CodeQL bundle
shell: bash

View File

@@ -23,53 +23,31 @@ permissions:
contents: read
jobs:
rust-ast-generator:
runs-on: ubuntu-latest
defaults:
run:
working-directory: rust/ast-generator
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Inject sources
shell: bash
run: |
bazel run //rust/ast-generator:inject-sources
- name: Format
shell: bash
run: |
cargo fmt --check
- name: Compilation
shell: bash
run: cargo check
- name: Clippy
shell: bash
run: |
cargo clippy --no-deps -- -D warnings
rust-code:
runs-on: ubuntu-latest
defaults:
run:
working-directory: rust/extractor
steps:
- name: Checkout
uses: actions/checkout@v5
uses: actions/checkout@v4
- name: Format
working-directory: rust/extractor
shell: bash
run: |
cargo fmt --check
- name: Compilation
working-directory: rust/extractor
shell: bash
run: cargo check
- name: Clippy
working-directory: rust/extractor
shell: bash
run: |
cargo clippy --no-deps -- -D warnings
cargo clippy --fix
git diff --exit-code
rust-codegen:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v5
uses: actions/checkout@v4
- name: Install CodeQL
uses: ./.github/actions/fetch-codeql
- name: Code generation

View File

@@ -18,50 +18,78 @@ on:
- main
- rc/*
- codeql-cli-*
push:
paths:
- "swift/**"
- "misc/bazel/**"
- "misc/codegen/**"
- "shared/**"
- "*.bazel*"
- .github/workflows/swift.yml
- .github/actions/**
- codeql-workspace.yml
- .pre-commit-config.yaml
- "!**/*.md"
- "!**/*.qhelp"
branches:
- main
- rc/*
- codeql-cli-*
permissions:
contents: read
defaults:
run:
shell: bash
working-directory: swift
jobs:
build-and-test:
# not using a matrix as you cannot depend on a specific job in a matrix, and we want to start linux checks
# without waiting for the macOS build
build-and-test-macos:
if: github.repository_owner == 'github'
strategy:
matrix:
runner: [ubuntu-latest, macos-15-xlarge]
fail-fast: false
runs-on: ${{ matrix.runner }}
runs-on: macos-13-xlarge
steps:
- uses: actions/checkout@v5
- name: Setup (Linux)
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y uuid-dev zlib1g-dev
- name: Build Swift extractor
shell: bash
run: |
bazel run :install
- name: Run Swift tests
shell: bash
run: |
bazel test ... --test_tag_filters=-override --test_output=errors
- uses: actions/checkout@v4
- uses: ./swift/actions/build-and-test
build-and-test-linux:
if: github.repository_owner == 'github'
runs-on: ubuntu-latest-xl
steps:
- uses: actions/checkout@v4
- uses: ./swift/actions/build-and-test
qltests-linux:
if: github.repository_owner == 'github'
needs: build-and-test-linux
runs-on: ubuntu-latest-xl
steps:
- uses: actions/checkout@v4
- uses: ./swift/actions/run-ql-tests
qltests-macos:
if: ${{ github.repository_owner == 'github' && github.event_name == 'pull_request' }}
needs: build-and-test-macos
runs-on: macos-13-xlarge
steps:
- uses: actions/checkout@v4
- uses: ./swift/actions/run-ql-tests
clang-format:
if : ${{ github.event_name == 'pull_request' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/checkout@v4
- uses: pre-commit/action@646c83fcd040023954eafda54b4db0192ce70507
name: Check that python code is properly formatted
with:
extra_args: clang-format --all-files
codegen:
if : ${{ github.event_name == 'pull_request' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/checkout@v4
- uses: bazelbuild/setup-bazelisk@v2
- uses: actions/setup-python@v4
with:
python-version-file: 'swift/.python-version'
- uses: pre-commit/action@646c83fcd040023954eafda54b4db0192ce70507
name: Check that python code is properly formatted
with:
extra_args: autopep8 --all-files
- uses: ./.github/actions/fetch-codeql
- uses: pre-commit/action@646c83fcd040023954eafda54b4db0192ce70507
name: Check that QL generated code was checked in
@@ -69,14 +97,15 @@ jobs:
extra_args: swift-codegen --all-files
- name: Generate C++ files
run: |
bazel run codegen -- --generate=trap,cpp --cpp-output=$PWD/generated-cpp-files
bazel run //swift/codegen:codegen -- --generate=trap,cpp --cpp-output=$PWD/generated-cpp-files
- uses: actions/upload-artifact@v4
with:
name: swift-generated-cpp-files
path: generated-cpp-files/**
check-no-override:
database-upgrade-scripts:
if : ${{ github.event_name == 'pull_request' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Check that no override is present in load.bzl
run: bazel test ... --test_tag_filters=override --test_output=errors
- uses: actions/checkout@v4
- uses: ./.github/actions/fetch-codeql
- uses: ./swift/actions/database-upgrade-scripts

View File

@@ -17,7 +17,7 @@ jobs:
sync:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/checkout@v4
- name: Check synchronized files
run: python config/sync-files.py
- name: Check dbscheme fragments

View File

@@ -30,20 +30,20 @@ jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/checkout@v4
- name: Check formatting
run: cargo fmt -- --check
run: cargo fmt --all -- --check
- name: Run tests
run: cargo test --verbose
fmt:
runs-on: ubuntu-latest
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/checkout@v4
- name: Check formatting
run: cargo fmt --check
clippy:
runs-on: ubuntu-latest
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/checkout@v4
- name: Run clippy
run: cargo clippy -- --no-deps -D warnings -A clippy::new_without_default -A clippy::too_many_arguments

View File

@@ -23,7 +23,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v5
uses: actions/checkout@v4
- name: Setup CodeQL
uses: ./.github/actions/fetch-codeql
@@ -31,4 +31,4 @@ jobs:
- name: Fail if there are any errors with existing change notes
run: |
codeql pack release --groups actions,cpp,csharp,go,java,javascript,python,ruby,shared,swift -examples,-test,-experimental
codeql pack release --groups cpp,csharp,java,javascript,python,ruby,-examples,-test,-experimental

View File

@@ -18,6 +18,6 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/checkout@v4
- run: |
bazel test //misc/bazel/internal/zipmerge:test --test_output=all

10
.gitignore vendored
View File

@@ -8,7 +8,7 @@
# qltest projects and artifacts
*.actual
*/ql/test*/**/*.testproj
*/ql/test/**/*.testproj
*/ql/test/**/go.sum
# Visual studio temporaries, except a file used by QL4VS
@@ -62,7 +62,6 @@ node_modules/
# Temporary folders for working with generated models
.model-temp
/mad-generation-build
# bazel-built in-tree extractor packs
/*/extractor-pack
@@ -72,10 +71,3 @@ node_modules/
# cargo build directory
/target
# some upgrade/downgrade checks create these files
**/upgrades/*/*.dbscheme.stats
**/downgrades/*/*.dbscheme.stats
# Mergetool files
*.orig

View File

@@ -1,26 +1,24 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
default_language_version:
python: python3.12
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.2.0
hooks:
- id: trailing-whitespace
exclude: /test([^/]*)/.*$(?<!\.qlref)|.*\.patch$|.*\.qll?$
exclude: /test/.*$(?<!\.qlref)|.*\.patch$|.*\.qll?$
- id: end-of-file-fixer
exclude: Cargo.lock$|/test([^/]*)/.*$(?<!\.qlref)|.*\.patch$|.*\.qll?$
exclude: /test/.*$(?<!\.qlref)|.*\.patch$|.*\.qll?$
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v17.0.6
hooks:
- id: clang-format
- repo: https://github.com/psf/black
rev: 25.1.0
- repo: https://github.com/pre-commit/mirrors-autopep8
rev: v2.0.4
hooks:
- id: black
files: ^(misc/codegen/.*|misc/scripts/models-as-data/.*)\.py$
- id: autopep8
files: ^misc/codegen/.*\.py
- repo: local
hooks:
@@ -74,7 +72,7 @@ repos:
- id: rust-codegen
name: Run Rust checked in code generation
files: ^misc/codegen/|^rust/(prefix\.dbscheme|schema/|codegen/|.*/generated/|ql/lib/(rust\.dbscheme$|codeql/rust/elements)|\.generated.list|ast-generator/)
files: ^misc/codegen/|^rust/(schema.py$|codegen/|.*/generated/|ql/lib/(rust\.dbscheme$|codeql/rust/elements)|\.generated.list)
language: system
entry: bazel run //rust/codegen -- --quiet
pass_filenames: false

98
.vscode/tasks.json vendored
View File

@@ -38,104 +38,6 @@
"command": "${config:python.pythonPath}",
},
"problemMatcher": []
},
{
"label": "Create query change note",
"type": "process",
"command": "python3",
"args": [
"misc/scripts/create-change-note.py",
"${input:language}",
"src",
"${input:name}",
"${input:categoryQuery}"
],
"options": {
"env": {
"EDITOR": "code -r",
}
},
"presentation": {
"reveal": "never",
"close": true
},
"problemMatcher": []
},
{
"label": "Create library change note",
"type": "process",
"command": "python3",
"args": [
"misc/scripts/create-change-note.py",
"${input:language}",
"lib",
"${input:name}",
"${input:categoryLibrary}"
],
"options": {
"env": {
"EDITOR": "code -r"
}
},
"presentation": {
"reveal": "never",
"close": true
},
"problemMatcher": []
}
],
"inputs": [
{
"type": "pickString",
"id": "language",
"description": "Language",
"options":
[
"actions",
"go",
"java",
"javascript",
"cpp",
"csharp",
"python",
"ruby",
"rust",
"swift",
]
},
{
"type": "promptString",
"id": "name",
"description": "Short name (kebab-case)"
},
{
"type": "pickString",
"id": "categoryQuery",
"description": "Category (query change)",
"options":
[
"breaking",
"deprecated",
"newQuery",
"queryMetadata",
"majorAnalysis",
"minorAnalysis",
"fix",
]
},
{
"type": "pickString",
"id": "categoryLibrary",
"description": "Category (library change)",
"options":
[
"breaking",
"deprecated",
"feature",
"majorAnalysis",
"minorAnalysis",
"fix",
]
}
]
}

View File

@@ -1,46 +1,28 @@
# Catch-all for anything which isn't matched by a line lower down
* @github/code-scanning-alert-coverage
# CodeQL language libraries
/actions/ @github/codeql-dynamic
/cpp/ @github/codeql-c-analysis
/csharp/ @github/codeql-csharp
/csharp/autobuilder/Semmle.Autobuild.Cpp @github/codeql-c-extractor @github/code-scanning-language-coverage
/csharp/autobuilder/Semmle.Autobuild.Cpp.Tests @github/codeql-c-extractor @github/code-scanning-language-coverage
/csharp/autobuilder/Semmle.Autobuild.Cpp @github/codeql-c-extractor
/csharp/autobuilder/Semmle.Autobuild.Cpp.Tests @github/codeql-c-extractor
/go/ @github/codeql-go
/go/codeql-tools/ @github/codeql-go @github/code-scanning-language-coverage
/go/downgrades/ @github/codeql-go @github/code-scanning-language-coverage
/go/extractor/ @github/codeql-go @github/code-scanning-language-coverage
/go/extractor-smoke-test/ @github/codeql-go @github/code-scanning-language-coverage
/go/ql/test/extractor-tests/ @github/codeql-go @github/code-scanning-language-coverage
/java/ @github/codeql-java
/javascript/ @github/codeql-javascript
/javascript/extractor/ @github/codeql-javascript @github/code-scanning-language-coverage
/python/ @github/codeql-python
/python/extractor/ @github/codeql-python @github/code-scanning-language-coverage
/ql/ @github/codeql-ql-for-ql-reviewers
/ruby/ @github/codeql-ruby
/ruby/extractor/ @github/codeql-ruby @github/code-scanning-language-coverage
/rust/ @github/codeql-rust
/rust/extractor/ @github/codeql-rust @github/code-scanning-language-coverage
/shared/ @github/codeql-shared-libraries-reviewers
/swift/ @github/codeql-swift
/swift/extractor/ @github/codeql-swift @github/code-scanning-language-coverage
/misc/codegen/ @github/codeql-swift
/java/kotlin-extractor/ @github/codeql-kotlin @github/code-scanning-language-coverage
/java/kotlin-extractor/ @github/codeql-kotlin
/java/kotlin-extractor2/ @github/codeql-kotlin
/java/ql/test-kotlin1/ @github/codeql-kotlin
/java/ql/test-kotlin2/ @github/codeql-kotlin
# Experimental CodeQL cryptography
**/experimental/**/quantum/ @github/ps-codeql
/shared/quantum/ @github/ps-codeql
# CodeQL tools and associated docs
/docs/codeql/codeql-cli/ @github/codeql-cli-reviewers
/docs/codeql/codeql-for-visual-studio-code/ @github/codeql-vscode-reviewers
/docs/codeql/ql-language-reference/ @github/codeql-frontend-reviewers
/docs/query-*-style-guide.md @github/codeql-analysis-reviewers
# QL for QL reviewers
/ql/ @github/codeql-ql-for-ql-reviewers
# Bazel (excluding BUILD.bazel files)
MODULE.bazel @github/codeql-ci-reviewers
.bazelversion @github/codeql-ci-reviewers
@@ -56,12 +38,8 @@ MODULE.bazel @github/codeql-ci-reviewers
/.github/workflows/go-* @github/codeql-go
/.github/workflows/ql-for-ql-* @github/codeql-ql-for-ql-reviewers
/.github/workflows/ruby-* @github/codeql-ruby
/.github/workflows/rust.yml @github/codeql-rust
/.github/workflows/swift.yml @github/codeql-swift
# Misc
/misc/scripts/accept-expected-changes-from-ci.py @RasmusWL
/misc/scripts/generate-code-scanning-query-list.py @RasmusWL
# .devcontainer
/.devcontainer/ @github/codeql-ci-reviewers

2382
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -4,13 +4,13 @@
resolver = "2"
members = [
"shared/tree-sitter-extractor",
"shared/yeast",
"shared/yeast-macros",
"ruby/extractor",
"unified/extractor",
"unified/extractor/tree-sitter-swift",
"rust/extractor",
"rust/extractor/macros",
"rust/ast-generator",
"rust/autobuild",
]
[patch.crates-io]
# patch for build script bug preventing bazel build
# see https://github.com/rust-lang/rustc_apfloat/pull/17
rustc_apfloat = { git = "https://github.com/redsun82/rustc_apfloat.git", rev = "096d585100636bc2e9f09d7eefec38c5b334d47b" }

View File

@@ -1,6 +1,6 @@
MIT License
Copyright (c) 2006-2025 GitHub, Inc.
Copyright (c) 2006-2020 GitHub, Inc.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

View File

@@ -14,36 +14,29 @@ local_path_override(
# see https://registry.bazel.build/ for a list of available packages
bazel_dep(name = "platforms", version = "1.0.0")
bazel_dep(name = "rules_cc", version = "0.2.17")
bazel_dep(name = "rules_go", version = "0.60.0")
bazel_dep(name = "rules_java", version = "9.6.1")
bazel_dep(name = "rules_pkg", version = "1.2.0")
bazel_dep(name = "rules_nodejs", version = "6.7.3")
bazel_dep(name = "rules_python", version = "1.9.0")
bazel_dep(name = "rules_shell", version = "0.7.1")
bazel_dep(name = "bazel_skylib", version = "1.9.0")
bazel_dep(name = "abseil-cpp", version = "20260107.1", repo_name = "absl")
bazel_dep(name = "platforms", version = "0.0.10")
bazel_dep(name = "rules_go", version = "0.50.0")
bazel_dep(name = "rules_pkg", version = "1.0.1")
bazel_dep(name = "rules_nodejs", version = "6.2.0-codeql.1")
bazel_dep(name = "rules_python", version = "0.36.0")
bazel_dep(name = "bazel_skylib", version = "1.7.1")
bazel_dep(name = "abseil-cpp", version = "20240116.0", repo_name = "absl")
bazel_dep(name = "nlohmann_json", version = "3.11.3", repo_name = "json")
bazel_dep(name = "fmt", version = "12.1.0-codeql.1")
bazel_dep(name = "rules_kotlin", version = "2.2.2-codeql.1")
bazel_dep(name = "gazelle", version = "0.50.0")
bazel_dep(name = "rules_dotnet", version = "0.21.5-codeql.1")
bazel_dep(name = "googletest", version = "1.17.0.bcr.2")
bazel_dep(name = "rules_rust", version = "0.69.0")
bazel_dep(name = "zstd", version = "1.5.7.bcr.1")
bazel_dep(name = "fmt", version = "10.0.0")
bazel_dep(name = "rules_kotlin", version = "2.0.0-codeql.1")
bazel_dep(name = "gazelle", version = "0.38.0")
bazel_dep(name = "rules_dotnet", version = "0.17.4")
bazel_dep(name = "googletest", version = "1.14.0.bcr.1")
bazel_dep(name = "rules_rust", version = "0.52.2")
bazel_dep(name = "rules_jvm_external", version = "6.2")
bazel_dep(name = "buildifier_prebuilt", version = "6.4.0", dev_dependency = True)
# Keep edition and version approximately in sync with internal repo.
# the versions there are canonical, the versions here are used for CI in github/codeql, as well as for the vendoring of dependencies.
RUST_EDITION = "2024"
RUST_EDITION = "2021"
# run buildutils-internal/scripts/fill-rust-sha256s.py when updating (internal repo)
# a nightly toolchain is required to enable experimental_use_cc_common_link, which we require internally
# we prefer to run the same version as internally, even if experimental_use_cc_common_link is not really
# required in this repo
RUST_VERSION = "nightly/2026-01-22"
RUST_VERSION = "1.81.0"
rust = use_extension("@rules_rust//rust:extensions.bzl", "rust")
rust.toolchain(
@@ -53,133 +46,33 @@ rust.toolchain(
"x86_64-apple-darwin",
"aarch64-apple-darwin",
],
# generated by buildutils-internal/scripts/fill-rust-sha256s.py (internal repo)
sha256s = {
"2026-01-22/rustc-nightly-x86_64-unknown-linux-gnu.tar.xz": "88db619323cc1321630d124efa51ed02fabc5e020f08cfa0eda2c0ac1afbe69a",
"2026-01-22/rustc-nightly-x86_64-apple-darwin.tar.xz": "08484da3fa38db56f93629aeabdc0ae9ff8ed9704c0792d35259cbc849b3f54c",
"2026-01-22/rustc-nightly-aarch64-apple-darwin.tar.xz": "a39c0b21b7058e364ea1bd43144e42e4bf1efade036b2e82455f2afce194ee81",
"2026-01-22/rustc-nightly-x86_64-pc-windows-msvc.tar.xz": "d00248ee9850dbb6932b2578e32ff74fc7c429854c1aa071066ca31b65385a3b",
"2026-01-22/clippy-nightly-x86_64-unknown-linux-gnu.tar.xz": "70656a0ce994ffff16d5a35a7b170a0acd41e9bb54a589c96ed45bf97b094a4d",
"2026-01-22/clippy-nightly-x86_64-apple-darwin.tar.xz": "fe242519fa961522734733009705aec3c2d9a20cc57291f2aa614e5e6262c88f",
"2026-01-22/clippy-nightly-aarch64-apple-darwin.tar.xz": "38bb226363ec97c9722edf966cd58774a683e19fd2ff2a6030094445d51e06f9",
"2026-01-22/clippy-nightly-x86_64-pc-windows-msvc.tar.xz": "6da9b4470beea67abfebf046f141eee0d2a8db7c7a9e4e2294478734fd477228",
"2026-01-22/cargo-nightly-x86_64-unknown-linux-gnu.tar.xz": "99004e9d10c43a01499642f53bb3184d41137a95d65bfb217098840a9e79e892",
"2026-01-22/cargo-nightly-x86_64-apple-darwin.tar.xz": "6e021394cf8d8400ac6cfdfcef24e4d74f988e91eb8028b36de3a64ce3502990",
"2026-01-22/cargo-nightly-aarch64-apple-darwin.tar.xz": "4b2494cb69ab64132cddbc411a38ea9f1105e54d6f986e43168d54f79510c673",
"2026-01-22/cargo-nightly-x86_64-pc-windows-msvc.tar.xz": "c36613cf57407212d10d37b76e49a60ff42336e953cdff9e177283f530a83fc1",
"2026-01-22/llvm-tools-nightly-x86_64-unknown-linux-gnu.tar.xz": "0b123c5027dbd833aae6845ffe9bd07d309bf798746a7176aadaea68fbcbd05d",
"2026-01-22/llvm-tools-nightly-x86_64-apple-darwin.tar.xz": "a47864491ad5619158c950ab7570fb6e487d5117338585c27334d45824b406d8",
"2026-01-22/llvm-tools-nightly-aarch64-apple-darwin.tar.xz": "db9bc826d6e2e7e914505d50157682e516ceb90357e83d77abddc32c2d962f41",
"2026-01-22/llvm-tools-nightly-x86_64-pc-windows-msvc.tar.xz": "ffaa406932b2fe62e01dad61cf4ed34860a5d2a6f9306ca340d79e630d930039",
"2026-01-22/rust-std-nightly-x86_64-unknown-linux-gnu.tar.xz": "e9c0d5e06e18a4b509391b3088f29293e310cdc8ccc865be8fa3f09733326925",
"2026-01-22/rust-std-nightly-x86_64-apple-darwin.tar.xz": "25d75995cee679a4828ca9fe48c5a31a67c3b0846018440ef912e5a6208f53f6",
"2026-01-22/rust-std-nightly-aarch64-apple-darwin.tar.xz": "e4132bf3f2eed4684c86756a02315bcf481c23e675e3e25630fc604c9cb4594c",
"2026-01-22/rust-std-nightly-x86_64-pc-windows-msvc.tar.xz": "961bb535ef95ae8a5fa4e224cb94aff190f155c45a9bcf7a53e184b024aa41b1",
},
versions = [RUST_VERSION],
)
use_repo(rust, "rust_toolchains")
register_toolchains("@rust_toolchains//:all")
rust_host_tools = use_extension("@rules_rust//rust:extensions.bzl", "rust_host_tools")
# Don't download a second toolchain as host toolchain, make sure this is the same version as above
# The host toolchain is used for vendoring dependencies.
rust_host_tools.host_tools(
edition = RUST_EDITION,
version = RUST_VERSION,
)
# deps for python extractor
# keep in sync by running `misc/bazel/3rdparty/update_cargo_deps.sh`
py_deps = use_extension("//misc/bazel/3rdparty:py_deps_extension.bzl", "p")
use_repo(
py_deps,
"vendor_py__anyhow-1.0.95",
"vendor_py__cc-1.2.14",
"vendor_py__clap-4.5.30",
"vendor_py__regex-1.11.1",
"vendor_py__tree-sitter-0.24.7",
"vendor_py__tree-sitter-graph-0.12.0",
)
use_repo(py_deps, "vendor__anyhow-1.0.44", "vendor__cc-1.0.70", "vendor__clap-2.33.3", "vendor__regex-1.5.5", "vendor__smallvec-1.6.1", "vendor__string-interner-0.12.2", "vendor__thiserror-1.0.29", "vendor__tree-sitter-0.20.4", "vendor__tree-sitter-graph-0.7.0")
# deps for ruby+rust
# keep in sync by running `misc/bazel/3rdparty/update_cargo_deps.sh`
tree_sitter_extractors_deps = use_extension("//misc/bazel/3rdparty:tree_sitter_extractors_extension.bzl", "r")
use_repo(
tree_sitter_extractors_deps,
"vendor_ts__anyhow-1.0.100",
"vendor_ts__argfile-0.2.1",
"vendor_ts__cc-1.2.61",
"vendor_ts__chalk-ir-0.104.0",
"vendor_ts__chrono-0.4.42",
"vendor_ts__clap-4.5.48",
"vendor_ts__dunce-1.0.5",
"vendor_ts__either-1.15.0",
"vendor_ts__encoding-0.2.33",
"vendor_ts__figment-0.10.19",
"vendor_ts__flate2-1.1.2",
"vendor_ts__glob-0.3.3",
"vendor_ts__globset-0.4.16",
"vendor_ts__itertools-0.14.0",
"vendor_ts__lazy_static-1.5.0",
"vendor_ts__mustache-0.9.0",
"vendor_ts__num-traits-0.2.19",
"vendor_ts__num_cpus-1.17.0",
"vendor_ts__proc-macro2-1.0.101",
"vendor_ts__quote-1.0.41",
"vendor_ts__ra_ap_base_db-0.0.301",
"vendor_ts__ra_ap_cfg-0.0.301",
"vendor_ts__ra_ap_hir-0.0.301",
"vendor_ts__ra_ap_hir_def-0.0.301",
"vendor_ts__ra_ap_hir_expand-0.0.301",
"vendor_ts__ra_ap_hir_ty-0.0.301",
"vendor_ts__ra_ap_ide_db-0.0.301",
"vendor_ts__ra_ap_intern-0.0.301",
"vendor_ts__ra_ap_load-cargo-0.0.301",
"vendor_ts__ra_ap_parser-0.0.301",
"vendor_ts__ra_ap_paths-0.0.301",
"vendor_ts__ra_ap_project_model-0.0.301",
"vendor_ts__ra_ap_span-0.0.301",
"vendor_ts__ra_ap_stdx-0.0.301",
"vendor_ts__ra_ap_syntax-0.0.301",
"vendor_ts__ra_ap_vfs-0.0.301",
"vendor_ts__rand-0.9.2",
"vendor_ts__rayon-1.11.0",
"vendor_ts__regex-1.11.3",
"vendor_ts__serde-1.0.228",
"vendor_ts__serde_json-1.0.145",
"vendor_ts__serde_with-3.14.1",
"vendor_ts__serde_yaml-0.9.34-deprecated",
"vendor_ts__syn-2.0.106",
"vendor_ts__toml-0.9.7",
"vendor_ts__tracing-0.1.41",
"vendor_ts__tracing-flame-0.2.0",
"vendor_ts__tracing-subscriber-0.3.20",
"vendor_ts__tree-sitter-0.26.8",
"vendor_ts__tree-sitter-embedded-template-0.25.0",
"vendor_ts__tree-sitter-generate-0.26.8",
"vendor_ts__tree-sitter-json-0.24.8",
"vendor_ts__tree-sitter-language-0.1.5",
"vendor_ts__tree-sitter-python-0.23.6",
"vendor_ts__tree-sitter-ql-0.23.1",
"vendor_ts__tree-sitter-ruby-0.23.1",
"vendor_ts__triomphe-0.1.14",
"vendor_ts__ungrammar-1.16.1",
"vendor_ts__zstd-0.13.3",
)
http_archive = use_repo_rule("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
# rust-analyzer sources needed by the rust ast-generator (see `rust/ast-generator/README.md`)
RUST_ANALYZER_SRC_TAG = "2025-01-07"
http_archive(
name = "rust-analyzer-src",
build_file = "//rust/ast-generator:BUILD.rust-analyzer-src.bazel",
integrity = "sha256-eo8mIaUafZL8LOM65bDIIIXw1rNQ/P/x5RK/XUtgo5g=",
patch_args = ["-p1"],
patches = [
"//rust/ast-generator:patches/rust-analyzer.patch",
],
strip_prefix = "rust-analyzer-%s" % RUST_ANALYZER_SRC_TAG,
url = "https://github.com/rust-lang/rust-analyzer/archive/refs/tags/%s.tar.gz" % RUST_ANALYZER_SRC_TAG,
)
use_repo(tree_sitter_extractors_deps, "vendor__anyhow-1.0.93", "vendor__argfile-0.2.1", "vendor__chrono-0.4.38", "vendor__clap-4.5.20", "vendor__encoding-0.2.33", "vendor__figment-0.10.19", "vendor__flate2-1.0.34", "vendor__glob-0.3.1", "vendor__globset-0.4.15", "vendor__itertools-0.10.5", "vendor__itertools-0.13.0", "vendor__lazy_static-1.5.0", "vendor__log-0.4.22", "vendor__num-traits-0.2.19", "vendor__num_cpus-1.16.0", "vendor__proc-macro2-1.0.89", "vendor__quote-1.0.37", "vendor__ra_ap_base_db-0.0.232", "vendor__ra_ap_cfg-0.0.232", "vendor__ra_ap_hir-0.0.232", "vendor__ra_ap_hir_def-0.0.232", "vendor__ra_ap_hir_expand-0.0.232", "vendor__ra_ap_ide_db-0.0.232", "vendor__ra_ap_intern-0.0.232", "vendor__ra_ap_load-cargo-0.0.232", "vendor__ra_ap_parser-0.0.232", "vendor__ra_ap_paths-0.0.232", "vendor__ra_ap_project_model-0.0.232", "vendor__ra_ap_span-0.0.232", "vendor__ra_ap_syntax-0.0.232", "vendor__ra_ap_vfs-0.0.232", "vendor__rand-0.8.5", "vendor__rayon-1.10.0", "vendor__regex-1.11.1", "vendor__serde-1.0.214", "vendor__serde_json-1.0.132", "vendor__serde_with-3.11.0", "vendor__stderrlog-0.6.0", "vendor__syn-2.0.87", "vendor__tracing-0.1.40", "vendor__tracing-subscriber-0.3.18", "vendor__tree-sitter-0.24.4", "vendor__tree-sitter-embedded-template-0.23.2", "vendor__tree-sitter-json-0.24.8", "vendor__tree-sitter-ql-0.23.1", "vendor__tree-sitter-ruby-0.23.1", "vendor__triomphe-0.1.14", "vendor__ungrammar-1.16.1")
dotnet = use_extension("@rules_dotnet//dotnet:extensions.bzl", "dotnet")
dotnet.toolchain(dotnet_version = "10.0.100")
dotnet.toolchain(dotnet_version = "9.0.100")
use_repo(dotnet, "dotnet_toolchains")
register_toolchains("@dotnet_toolchains//:all")
@@ -190,20 +83,11 @@ use_repo(csharp_main_extension, "paket.main")
pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip")
pip.parse(
hub_name = "codegen_deps",
python_version = "3.12",
python_version = "3.11",
requirements_lock = "//misc/codegen:requirements_lock.txt",
)
use_repo(pip, "codegen_deps")
python = use_extension("@rules_python//python/extensions:python.bzl", "python")
python.toolchain(
is_default = True,
python_version = "3.12",
)
use_repo(python, "python_3_12", "python_versions")
register_toolchains("@python_versions//3.12:all")
swift_deps = use_extension("//swift/third_party:load.bzl", "swift_deps")
# following list can be kept in sync with `bazel mod tidy`
@@ -211,12 +95,10 @@ use_repo(
swift_deps,
"binlog",
"picosha2",
"swift-prebuilt-linux",
"swift-prebuilt-linux-download-only",
"swift-prebuilt-macos",
"swift-prebuilt-macos-download-only",
"swift-resource-dir-linux",
"swift-resource-dir-macos",
"swift_prebuilt_darwin_x86_64",
"swift_prebuilt_linux",
"swift_toolchain_linux",
"swift_toolchain_macos",
)
node = use_extension("@rules_nodejs//nodejs:extensions.bzl", "node")
@@ -237,58 +119,114 @@ use_repo(
kotlin_extractor_deps,
"codeql_kotlin_defaults",
"codeql_kotlin_embeddable",
"kotlin-compiler-1.5.0",
"kotlin-compiler-1.5.10",
"kotlin-compiler-1.5.20",
"kotlin-compiler-1.5.30",
"kotlin-compiler-1.6.0",
"kotlin-compiler-1.6.20",
"kotlin-compiler-1.7.0",
"kotlin-compiler-1.7.20",
"kotlin-compiler-1.8.0",
"kotlin-compiler-1.9.0-Beta",
"kotlin-compiler-1.9.20-Beta",
"kotlin-compiler-2.0.0-RC1",
"kotlin-compiler-2.0.20-Beta2",
"kotlin-compiler-2.1.0-Beta1",
"kotlin-compiler-2.1.20-Beta1",
"kotlin-compiler-2.2.0-Beta1",
"kotlin-compiler-2.2.20-Beta2",
"kotlin-compiler-2.3.0",
"kotlin-compiler-2.3.20",
"kotlin-compiler-embeddable-1.5.0",
"kotlin-compiler-embeddable-1.5.10",
"kotlin-compiler-embeddable-1.5.20",
"kotlin-compiler-embeddable-1.5.30",
"kotlin-compiler-embeddable-1.6.0",
"kotlin-compiler-embeddable-1.6.20",
"kotlin-compiler-embeddable-1.7.0",
"kotlin-compiler-embeddable-1.7.20",
"kotlin-compiler-embeddable-1.8.0",
"kotlin-compiler-embeddable-1.9.0-Beta",
"kotlin-compiler-embeddable-1.9.20-Beta",
"kotlin-compiler-embeddable-2.0.0-RC1",
"kotlin-compiler-embeddable-2.0.20-Beta2",
"kotlin-compiler-embeddable-2.1.0-Beta1",
"kotlin-compiler-embeddable-2.1.20-Beta1",
"kotlin-compiler-embeddable-2.2.0-Beta1",
"kotlin-compiler-embeddable-2.2.20-Beta2",
"kotlin-compiler-embeddable-2.3.0",
"kotlin-compiler-embeddable-2.3.20",
"kotlin-stdlib-1.5.0",
"kotlin-stdlib-1.5.10",
"kotlin-stdlib-1.5.20",
"kotlin-stdlib-1.5.30",
"kotlin-stdlib-1.6.0",
"kotlin-stdlib-1.6.20",
"kotlin-stdlib-1.7.0",
"kotlin-stdlib-1.7.20",
"kotlin-stdlib-1.8.0",
"kotlin-stdlib-1.9.0-Beta",
"kotlin-stdlib-1.9.20-Beta",
"kotlin-stdlib-2.0.0-RC1",
"kotlin-stdlib-2.0.20-Beta2",
"kotlin-stdlib-2.1.0-Beta1",
"kotlin-stdlib-2.1.20-Beta1",
"kotlin-stdlib-2.2.0-Beta1",
"kotlin-stdlib-2.2.20-Beta2",
"kotlin-stdlib-2.3.0",
"kotlin-stdlib-2.3.20",
)
maven = use_extension("@rules_jvm_external//:extensions.bzl", "maven")
# run
# REPIN=1 bazel run @maven_deps//:pin
# from this directory after modifying the following to update maven_install.json
maven.install(
name = "maven_deps",
# The Caffeine version needs to match https://github.com/JetBrains/kotlin/blob/master/gradle/libs.versions.toml
# See also https://youtrack.jetbrains.com/issue/KT-73751/Analysis-API-Caffeine-dependency which seeks a better
# way of including the needed dependency.
artifacts = [
"org.jetbrains.kotlin:%s:2.1.0" % kotlin_lib
for kotlin_lib in ("kotlin-annotation-processing", "kotlin-compiler")
] + [ "com.github.ben-manes.caffeine:caffeine:2.9.3" ] ,
lock_file = "//:maven_install.json",
repositories = [
"https://repo1.maven.org/maven2",
# some of these URLs might be needed at some point
# "https://maven.pkg.jetbrains.space/kotlin/p/kotlin/bootstrap",
# "https://maven.pkg.jetbrains.space/kotlin/p/kotlin/kotlin-ide-plugin-dependencies",
# "https://www.jetbrains.com/intellij-repository/releases",
# "https://cache-redirector.jetbrains.com/intellij-third-party-dependencies",
],
)
use_repo(
maven,
"maven_deps",
)
go_sdk = use_extension("@rules_go//go:extensions.bzl", "go_sdk")
go_sdk.download(version = "1.26.0")
go_sdk.download(version = "1.23.1")
go_deps = use_extension("@gazelle//:extensions.bzl", "go_deps")
go_deps.from_file(go_mod = "//go/extractor:go.mod")
use_repo(go_deps, "com_github_stretchr_testify", "org_golang_x_mod", "org_golang_x_tools")
use_repo(go_deps, "org_golang_x_mod", "org_golang_x_tools")
ripunzip_archive = use_repo_rule("//misc/ripunzip:ripunzip.bzl", "ripunzip_archive")
lfs_files = use_repo_rule("//misc/bazel:lfs.bzl", "lfs_files")
# go to https://github.com/GoogleChrome/ripunzip/releases to find latest version and corresponding sha256s
ripunzip_archive(
name = "ripunzip",
sha256_linux = "71482d7a7e4ea9176d5596161c49250c34b136b157c45f632b1111323fbfc0de",
sha256_macos_arm = "604194ab13f0aba3972995d995f11002b8fc285c8170401fcd46655065df20c9",
sha256_macos_intel = "65367b94fd579d93d46f2d2595cc4c9a60cfcf497e3c824f9d1a7b80fa8bd38a",
sha256_windows = "ac3874075def2b9e5074a3b5945005ab082cc6e689e1de658da8965bc23e643e",
version = "2.0.4",
lfs_files(
name = "ripunzip-linux",
srcs = ["//misc/ripunzip:ripunzip-linux"],
executable = True,
)
lfs_files(
name = "ripunzip-windows",
srcs = ["//misc/ripunzip:ripunzip-windows.exe"],
executable = True,
)
lfs_files(
name = "ripunzip-macos",
srcs = ["//misc/ripunzip:ripunzip-macos"],
executable = True,
)
lfs_files(
name = "swift-resource-dir-linux",
srcs = ["//swift/third_party/resource-dir:resource-dir-linux.zip"],
)
lfs_files(
name = "swift-resource-dir-macos",
srcs = ["//swift/third_party/resource-dir:resource-dir-macos.zip"],
)
register_toolchains(

View File

@@ -2,8 +2,19 @@ load("//misc/bazel:pkg.bzl", "codeql_pack")
package(default_visibility = ["//visibility:public"])
codeql_pack(
name = "actions",
srcs = ["//actions/extractor"],
experimental = True,
)
[
codeql_pack(
name = "-".join(parts),
srcs = [
"//actions/extractor",
],
pack_prefix = "/".join(parts),
)
for parts in (
[
"experimental",
"actions",
],
["actions"],
)
]

View File

@@ -4,9 +4,7 @@ codeql_pkg_files(
name = "extractor",
srcs = [
"codeql-extractor.yml",
"//:LICENSE",
],
exes = glob(["tools/**"]),
] + glob(["tools/**"]),
strip_prefix = strip_prefix.from_pkg(),
visibility = ["//actions:__pkg__"],
)

View File

@@ -1,17 +1,14 @@
name: "actions"
aliases: []
display_name: "GitHub Actions"
version: 0.0.1
column_kind: "utf16"
unicode_newlines: true
build_modes:
- none
default_queries:
- codeql/actions-queries
# Actions workflows are not reported separately by the GitHub API, so we can't
# associate them with a specific language.
file_coverage_languages: []
github_api_languages: []
scc_languages:
- YAML
scc_languages: []
file_types:
- name: workflow
display_name: GitHub Actions workflow files

View File

@@ -1,34 +1,21 @@
# Note: We're adding the `reusable_workflows` subdirectories to proactively
# record workflows that were called cross-repo, check them out locally,
# and enable an interprocedural analysis across the workflow files.
# These workflows follow the convention `.github/reusable_workflows/<nwo>/*.ya?ml`
$DefaultPathFilters = @(
'exclude:**/*',
'include:.github/workflows/*.yml',
'include:.github/workflows/*.yaml',
'include:.github/reusable_workflows/**/*.yml',
'include:.github/reusable_workflows/**/*.yaml',
'include:**/action.yml',
'include:**/action.yaml'
)
if ($null -ne $env:LGTM_INDEX_FILTERS) {
Write-Output 'LGTM_INDEX_FILTERS set. Using the default filters together with the user-provided filters, and passing through to the JavaScript extractor.'
# Begin with the default path inclusions only,
# followed by the user-provided filters.
# If the user provided `paths`, those patterns override the default inclusions
# (because `LGTM_INDEX_FILTERS` will begin with `exclude:**/*`).
# If the user provided `paths-ignore`, those patterns are excluded.
$PathFilters = ($DefaultPathFilters -join "`n") + "`n" + $env:LGTM_INDEX_FILTERS
$env:LGTM_INDEX_FILTERS = $PathFilters
if (($null -ne $env:LGTM_INDEX_INCLUDE) -or ($null -ne $env:LGTM_INDEX_EXCLUDE) -or ($null -ne $env:LGTM_INDEX_FILTERS)) {
Write-Output 'Path filters set. Passing them through to the JavaScript extractor.'
} else {
Write-Output 'LGTM_INDEX_FILTERS not set. Using the default filters, and passing through to the JavaScript extractor.'
Write-Output 'No path filters set. Using the default filters.'
$DefaultPathFilters = @(
'exclude:**/*',
'include:.github/workflows/**/*.yml',
'include:.github/workflows/**/*.yaml',
'include:**/action.yml',
'include:**/action.yaml'
)
$env:LGTM_INDEX_FILTERS = $DefaultPathFilters -join "`n"
}
# Find the JavaScript extractor directory via `codeql resolve extractor`.
$CodeQL = Join-Path $env:CODEQL_DIST 'codeql.exe'
$env:CODEQL_EXTRACTOR_JAVASCRIPT_ROOT = &"$CodeQL" resolve extractor --language javascript
$env:CODEQL_EXTRACTOR_JAVASCRIPT_ROOT = &$CodeQL resolve extractor --language javascript
if ($LASTEXITCODE -ne 0) {
throw 'Failed to resolve JavaScript extractor.'
}
@@ -47,7 +34,7 @@ $env:CODEQL_EXTRACTOR_JAVASCRIPT_SOURCE_ARCHIVE_DIR = $env:CODEQL_EXTRACTOR_ACTI
$env:CODEQL_EXTRACTOR_JAVASCRIPT_TRAP_DIR = $env:CODEQL_EXTRACTOR_ACTIONS_TRAP_DIR
$env:CODEQL_EXTRACTOR_JAVASCRIPT_WIP_DATABASE = $env:CODEQL_EXTRACTOR_ACTIONS_WIP_DATABASE
&"$JavaScriptAutoBuild"
&$JavaScriptAutoBuild
if ($LASTEXITCODE -ne 0) {
throw "JavaScript autobuilder failed."
}

View File

@@ -1,4 +1,3 @@
@echo off
rem All of the work is done in the PowerShell script
echo "Running PowerShell script at '%~dp0autobuild-impl.ps1'"
powershell.exe -File "%~dp0autobuild-impl.ps1"
powershell.exe %~dp0autobuild-impl.ps1

View File

@@ -2,43 +2,25 @@
set -eu
# Note: We're adding the `reusable_workflows` subdirectories to proactively
# record workflows that were called cross-repo, check them out locally,
# and enable an interprocedural analysis across the workflow files.
# These workflows follow the convention `.github/reusable_workflows/<nwo>/*.ya?ml`
DEFAULT_PATH_FILTERS=$(cat << END
exclude:**/*
include:.github/workflows/*.yml
include:.github/workflows/*.yaml
include:.github/reusable_workflows/**/*.yml
include:.github/reusable_workflows/**/*.yaml
include:.github/workflows/**/*.yml
include:.github/workflows/**/*.yaml
include:**/action.yml
include:**/action.yaml
END
)
if [ -n "${LGTM_INDEX_FILTERS:-}" ]; then
echo "LGTM_INDEX_FILTERS set. Using the default filters together with the user-provided filters, and passing through to the JavaScript extractor."
# Begin with the default path inclusions only,
# followed by the user-provided filters.
# If the user provided `paths`, those patterns override the default inclusions
# (because `LGTM_INDEX_FILTERS` will begin with `exclude:**/*`).
# If the user provided `paths-ignore`, those patterns are excluded.
PATH_FILTERS="$(cat << END
${DEFAULT_PATH_FILTERS}
${LGTM_INDEX_FILTERS}
END
)"
LGTM_INDEX_FILTERS="${PATH_FILTERS}"
export LGTM_INDEX_FILTERS
if [ -n "${LGTM_INDEX_INCLUDE:-}" ] || [ -n "${LGTM_INDEX_EXCLUDE:-}" ] || [ -n "${LGTM_INDEX_FILTERS:-}" ] ; then
echo "Path filters set. Passing them through to the JavaScript extractor."
else
echo "LGTM_INDEX_FILTERS not set. Using the default filters, and passing through to the JavaScript extractor."
echo "No path filters set. Using the default filters."
LGTM_INDEX_FILTERS="${DEFAULT_PATH_FILTERS}"
export LGTM_INDEX_FILTERS
fi
# Find the JavaScript extractor directory via `codeql resolve extractor`.
CODEQL_EXTRACTOR_JAVASCRIPT_ROOT="$("${CODEQL_DIST}/codeql" resolve extractor --language javascript)"
CODEQL_EXTRACTOR_JAVASCRIPT_ROOT="$($CODEQL_DIST/codeql resolve extractor --language javascript)"
export CODEQL_EXTRACTOR_JAVASCRIPT_ROOT
echo "Found JavaScript extractor at '${CODEQL_EXTRACTOR_JAVASCRIPT_ROOT}'."
@@ -54,4 +36,4 @@ env CODEQL_EXTRACTOR_JAVASCRIPT_DIAGNOSTIC_DIR="${CODEQL_EXTRACTOR_ACTIONS_DIAGN
CODEQL_EXTRACTOR_JAVASCRIPT_SOURCE_ARCHIVE_DIR="${CODEQL_EXTRACTOR_ACTIONS_SOURCE_ARCHIVE_DIR}" \
CODEQL_EXTRACTOR_JAVASCRIPT_TRAP_DIR="${CODEQL_EXTRACTOR_ACTIONS_TRAP_DIR}" \
CODEQL_EXTRACTOR_JAVASCRIPT_WIP_DATABASE="${CODEQL_EXTRACTOR_ACTIONS_WIP_DATABASE}" \
"${JAVASCRIPT_AUTO_BUILD}"
${JAVASCRIPT_AUTO_BUILD}

View File

@@ -1,10 +0,0 @@
{
"paths": [
".github/workflows/*.yml",
".github/workflows/*.yaml",
".github/reusable_workflows/**/*.yml",
".github/reusable_workflows/**/*.yaml",
"**/action.yml",
"**/action.yaml"
]
}

View File

@@ -1,2 +0,0 @@
@echo off
type "%CODEQL_EXTRACTOR_ACTIONS_ROOT%\tools\baseline-config.json"

View File

@@ -1,3 +0,0 @@
#!/bin/sh
cat "$CODEQL_EXTRACTOR_ACTIONS_ROOT/tools/baseline-config.json"

View File

@@ -1,4 +0,0 @@
---
lockVersion: 1.0.0
dependencies: {}
compiled: false

View File

@@ -1,7 +0,0 @@
name: codeql/actions-examples
groups:
- actions
- examples
dependencies:
codeql/actions-all: ${workspace}
warnOnImplicitThis: true

View File

@@ -1,12 +0,0 @@
/**
* @name Uses step with pinned SHA
* @description Finds 'uses' steps where the version is a pinned SHA.
* @id actions/examples/uses-pinned-sha
* @tags example
*/
import actions
from UsesStep uses
where uses.getVersion().regexpMatch("^[A-Fa-f0-9]{40}$")
select uses, "This 'uses' step has a pinned SHA version."

View File

@@ -1,28 +0,0 @@
extensions:
- addsTo:
pack: codeql/actions-all
extensible: immutableActionsDataModel
data:
- ["actions/checkout"]
- ["actions/cache"]
- ["actions/setup-node"]
- ["actions/upload-artifact"]
- ["actions/setup-python"]
- ["actions/download-artifact"]
- ["actions/github-script"]
- ["actions/setup-java"]
- ["actions/setup-go"]
- ["actions/upload-pages-artifact"]
- ["actions/deploy-pages"]
- ["actions/setup-dotnet"]
- ["actions/stale"]
- ["actions/labeler"]
- ["actions/create-github-app-token"]
- ["actions/configure-pages"]
- ["github/codeql-action/analyze"]
- ["github/codeql-action/autobuild"]
- ["github/codeql-action/init"]
- ["github/codeql-action/resolve-environment"]
- ["github/codeql-action/start-proxy"]
- ["github/codeql-action/upload-sarif"]
- ["octokit/request-action"]

View File

@@ -1,14 +0,0 @@
# Model pack containing the list of known immutable actions. The Immutable Actions feature is not
# yet released, so this pack will only be used within GitHub. Once the feature is available to
# customers, we will move the contents of this pack back into the standard library pack.
name: codeql/immutable-actions-list
version: 0.0.1-dev
library: true
warnOnImplicitThis: true
extensionTargets:
# We expect to need this model pack even after GA of Actions analysis, so make it compatible with
# all future prereleases plus 1.x.x. We should be able to remove this back before we need to
# bump the major version to 2.
codeql/actions-all: ">=0.4.3 <2.0.0"
dataExtensions:
- ext/**/*.yml

View File

@@ -1,5 +0,0 @@
import actions
from AstNode n
where n instanceof Workflow or n instanceof CompositeAction
select n

View File

@@ -1,6 +0,0 @@
| src/.github/action.yaml:1:1:11:32 | name: ' ... action' |
| src/.github/actions/action-name/action.yml:1:1:11:32 | name: ' ... action' |
| src/.github/workflows/workflow.yml:1:1:12:33 | name: A workflow |
| src/action.yml:1:1:11:32 | name: ' ... action' |
| src/excluded/action.yml:1:1:11:32 | name: ' ... action' |
| src/included/action.yml:1:1:11:32 | name: ' ... action' |

View File

@@ -1,2 +0,0 @@
| src/included/action.yml:1:1:11:32 | name: ' ... action' |
| src/included/unreachable-workflow.yml:1:1:12:33 | name: A ... orkflow |

View File

@@ -1,5 +0,0 @@
| src/.github/action.yaml:1:1:11:32 | name: ' ... action' |
| src/.github/actions/action-name/action.yml:1:1:11:32 | name: ' ... action' |
| src/.github/workflows/workflow.yml:1:1:12:33 | name: A workflow |
| src/action.yml:1:1:11:32 | name: ' ... action' |
| src/included/action.yml:1:1:11:32 | name: ' ... action' |

View File

@@ -1,2 +0,0 @@
| src/included/action.yml:1:1:11:32 | name: ' ... action' |
| src/included/unreachable-workflow.yml:1:1:12:33 | name: A ... orkflow |

View File

@@ -1,5 +0,0 @@
import actions
from AstNode n
where n instanceof Workflow or n instanceof CompositeAction
select n

View File

@@ -1,4 +0,0 @@
paths:
- 'included'
paths-ignore:
- 'excluded'

View File

@@ -1,2 +0,0 @@
paths-ignore:
- 'excluded'

View File

@@ -1,2 +0,0 @@
paths:
- 'included'

View File

@@ -1,6 +0,0 @@
src/.github/action.yaml
src/.github/actions/action-name/action.yml
src/.github/workflows/workflow.yml
src/action.yml
src/excluded/action.yml
src/included/action.yml

View File

@@ -1,3 +0,0 @@
src/included/action.yml
src/included/not-an-action.yml
src/included/unreachable-workflow.yml

View File

@@ -1,5 +0,0 @@
src/.github/action.yaml
src/.github/actions/action-name/action.yml
src/.github/workflows/workflow.yml
src/action.yml
src/included/action.yml

View File

@@ -1,3 +0,0 @@
src/included/action.yml
src/included/not-an-action.yml
src/included/unreachable-workflow.yml

View File

@@ -1,11 +0,0 @@
name: 'A composite action'
description: 'Do something'
runs:
using: "composite"
steps:
- name: Print
run: echo "Hello world"
shell: bash
- name: Checkout
uses: actions/checkout@v4

View File

@@ -1,11 +0,0 @@
name: 'A composite action'
description: 'Do something'
runs:
using: "composite"
steps:
- name: Print
run: echo "Hello world"
shell: bash
- name: Checkout
uses: actions/checkout@v4

View File

@@ -1,12 +0,0 @@
name: An unreachable workflow
on:
push:
branches:
- main
jobs:
job:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

View File

@@ -1,12 +0,0 @@
name: A workflow
on:
push:
branches:
- main
jobs:
job:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

View File

@@ -1,11 +0,0 @@
name: 'A composite action'
description: 'Do something'
runs:
using: "composite"
steps:
- name: Print
run: echo "Hello world"
shell: bash
- name: Checkout
uses: actions/checkout@v4

View File

@@ -1,11 +0,0 @@
name: 'A composite action'
description: 'Do something'
runs:
using: "composite"
steps:
- name: Print
run: echo "Hello world"
shell: bash
- name: Checkout
uses: actions/checkout@v4

View File

@@ -1,12 +0,0 @@
name: An unreachable workflow
on:
push:
branches:
- main
jobs:
job:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

View File

@@ -1,11 +0,0 @@
name: 'A composite action'
description: 'Do something'
runs:
using: "composite"
steps:
- name: Print
run: echo "Hello world"
shell: bash
- name: Checkout
uses: actions/checkout@v4

View File

@@ -1 +0,0 @@
name: 'Not an action, just a YAML file'

Some files were not shown because too many files have changed in this diff Show More