Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
278db14
C++: move consistency queries into the open-source repo
redsun82 Sep 15, 2026
def1184
Rust: allow formatting without linting, fix codegen runfiles path
redsun82 Sep 15, 2026
c870c14
Just: add the shared machinery behind the common verbs
redsun82 Sep 15, 2026
9f4249a
Just: implement the common verbs for each language
redsun82 Sep 15, 2026
930f9b7
Just: let verbs find recipes below the directory they are given
redsun82 Sep 15, 2026
8d14da0
Just: make QL test suites opt out of implicit discovery
redsun82 Sep 15, 2026
b289a1b
Just: run every recipe a verb finds, not just the nearest one
redsun82 Sep 15, 2026
ea0e04a
Just: stop formatting from breaking on paths containing spaces
redsun82 Sep 15, 2026
3e5d4ce
Just: say which directories a verb passed over
redsun82 Sep 15, 2026
3b958f6
Go: restore the 32-bit language test recipe
redsun82 Sep 15, 2026
957bb89
Just: do not let a skipped directory fail a successful run
redsun82 Sep 15, 2026
e66b1c9
Just: let the file walker select by name and skip generated trees
redsun82 Sep 15, 2026
f87fe10
Just: give a forwarding justfile a way to answer a verb itself
redsun82 Sep 15, 2026
1d93d84
Just: format bazel files
redsun82 Sep 15, 2026
ff32ac1
Just: let formatting report what it rewrote, and nothing else
redsun82 Sep 15, 2026
4f1cb30
Just: only show the distribution install log when the install fails
redsun82 Sep 15, 2026
9483dd3
Just: format bazel files in the internal checkout too, and say which
redsun82 Sep 15, 2026
2d54b94
Just: drop the CLI from the reason a suite must be named
redsun82 Sep 15, 2026
8033c66
Just: let each repository format its own bazel files
redsun82 Sep 15, 2026
c5a18ad
Just: let a repository name several sets of generated files
redsun82 Sep 15, 2026
e2dd875
Just: stop the overview from reformatting itself
redsun82 Sep 15, 2026
e61caff
Just: keep a repository's bazel formatting to its own files
redsun82 Sep 15, 2026
b7d9351
Merge branch 'main' into redsun82-just
redsun82 Sep 15, 2026
aa61bde
Just: size batches for the argument a command hands on, not the line …
redsun82 Sep 15, 2026
ed1c68a
Just: look above a verb that was run from a nested directory
redsun82 Sep 15, 2026
8a77588
Rust: ask for codegen without saying where
redsun82 Sep 15, 2026
bbdad5b
Java: say the Kotlin diagnostic limit is empty, rather than a space
redsun82 Sep 15, 2026
bc84bc5
Just: keep this directory's formatter to the file it was given
redsun82 Sep 15, 2026
b1d5db8
Just: record what keeps a relative argument to the caller's directory
redsun82 Sep 15, 2026
92c5699
Just: say why a root recipe delegates rather than doing the work
redsun82 Sep 15, 2026
2dcc7f6
C++: opt the moved consistency queries into implicit this warnings
redsun82 Sep 15, 2026
33c6c4f
Just: keep this formatter's exclusions in step with the canonical target
redsun82 Sep 15, 2026
97ee088
Just: say that these variables are an interface, not an implementatio…
redsun82 Sep 15, 2026
17156b6
Just: say why a dead override is invisible, and how to ask directly
redsun82 Sep 15, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions actions/justfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import '../lib.just'

[group('build')]
build: (_build_dist "actions")

roots := [source_dir() / 'ql/test']

[group('test')]
language-tests *EXTRA_ARGS: (_language_tests (roots ++ EXTRA_ARGS))
8 changes: 8 additions & 0 deletions actions/ql/integration-tests/justfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import "../../../lib.just"

# Integration tests are slow and need an internal checkout, so they only run when
# asked for by name.
explicit_verbs := ['test']

[no-cd]
test *ARGS=".": (_integration_test ARGS)
6 changes: 6 additions & 0 deletions actions/ql/justfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import "../../lib.just"

[no-cd]
format *ARGS=".": (_format_ql ARGS)

consistency_queries := ""
11 changes: 11 additions & 0 deletions actions/ql/test/justfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import "../justfile"

# A whole language test suite is slow, so it only runs when asked for by name.
explicit_verbs := ['test']

base_flags := []

all_checks := default_db_checks

[no-cd]
test *ARGS=".": (_codeql_test "actions" (base_flags ++ prepend('--all-checks=', all_checks) ++ ARGS))
10 changes: 10 additions & 0 deletions cpp/justfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import '../lib.just'
import? '../../cpp-coding-standards.just'

[group('build')]
build: (_build_dist "cpp")

roots := [source_dir() / 'ql/test', SEMMLE_CODE / 'semmlecode-cpp-tests']

[group('test')]
language-tests *EXTRA_ARGS: (_language_tests (roots ++ EXTRA_ARGS))
9 changes: 9 additions & 0 deletions cpp/ql/consistency-queries/badLocations.ql
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import cpp

// Locations should either be :0:0:0:0 locations (UnknownLocation, or
// a whole file), or all 4 fields should be positive.
from Location l
where
[l.getStartLine(), l.getEndLine(), l.getStartColumn(), l.getEndColumn()] != 0 and
[l.getStartLine(), l.getEndLine(), l.getStartColumn(), l.getEndColumn()] < 1
select l
5 changes: 5 additions & 0 deletions cpp/ql/consistency-queries/nullInToString.ql
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import cpp

from Element e
where e.toString().matches("%(null)%")
select e
6 changes: 6 additions & 0 deletions cpp/ql/consistency-queries/qlpack.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
name: codeql/cpp-consistency-queries
groups: [cpp, test, consistency-queries]
dependencies:
codeql/cpp-all: ${workspace}
extractor: cpp
warnOnImplicitThis: true
10 changes: 10 additions & 0 deletions cpp/ql/consistency-queries/unusedLocations.ql
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import cpp

from Location l
where
not any(Element e).getLocation() = l and
not any(LambdaCapture lc).getLocation() = l and
not any(MacroAccess ma).getActualLocation() = l and
not any(NamespaceDeclarationEntry nde).getBodyLocation() = l and
not any(XmlLocatable xml).getLocation() = l
select l
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import cpp

from VariableDeclarationEntry i
where not exists(i.getType())
select i
5 changes: 5 additions & 0 deletions cpp/ql/consistency-queries/variablesWithoutTypes.ql
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import cpp

from Variable i
where not exists(i.getType())
select i
8 changes: 8 additions & 0 deletions cpp/ql/integration-tests/justfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import "../../../lib.just"

# Integration tests are slow and need an internal checkout, so they only run when
# asked for by name.
explicit_verbs := ['test']

[no-cd]
test *ARGS=".": (_integration_test ARGS)
6 changes: 6 additions & 0 deletions cpp/ql/justfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import "../../lib.just"

[no-cd]
format *ARGS=".": (_format_ql ARGS)

consistency_queries := source_dir() / "consistency-queries"
11 changes: 11 additions & 0 deletions cpp/ql/test/justfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import "../justfile"

# A whole language test suite is slow, so it only runs when asked for by name.
explicit_verbs := ['test']

base_flags := ['--include-location-in-star']

all_checks := default_db_checks ++ ['--check-undefined-labels', '--check-unused-labels', '--consistency-queries=' + consistency_queries]

[no-cd]
test *ARGS=".": (_codeql_test "cpp" (base_flags ++ prepend('--all-checks=', all_checks) ++ ARGS))
9 changes: 9 additions & 0 deletions csharp/justfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import '../lib.just'

[group('build')]
build: (_build_dist "csharp")

roots := [source_dir() / 'ql/test']

[group('test')]
language-tests *EXTRA_ARGS: (_language_tests (roots ++ EXTRA_ARGS))
8 changes: 8 additions & 0 deletions csharp/ql/integration-tests/justfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import "../../../lib.just"

# Integration tests are slow and need an internal checkout, so they only run when
# asked for by name.
explicit_verbs := ['test']

[no-cd]
test *ARGS=".": (_integration_test ARGS)
6 changes: 6 additions & 0 deletions csharp/ql/justfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import "../../lib.just"

[no-cd]
format *ARGS=".": (_format_ql ARGS)

consistency_queries := source_dir() / "consistency-queries"
11 changes: 11 additions & 0 deletions csharp/ql/test/justfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import "../justfile"

# A whole language test suite is slow, so it only runs when asked for by name.
explicit_verbs := ['test']

base_flags := []

all_checks := default_db_checks ++ ['--check-undefined-labels', '--check-repeated-labels', '--check-redefined-labels', '--additional-packs=ql', '--consistency-queries=' + consistency_queries]

[no-cd]
test *ARGS=".": (_codeql_test "csharp" (base_flags ++ prepend('--all-checks=', all_checks) ++ ARGS))
17 changes: 17 additions & 0 deletions go/justfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import '../lib.just'

[group('build')]
build: (_build_dist "go")

roots := [source_dir() / 'ql/test']

# The `IncorrectIntegerConversion` query treats `math.MaxInt`/`math.MaxUint` differently on 32- and
# 64-bit targets, so we run its test under `GOARCH=386` as well. `GOOS=linux` because
# `GOOS=darwin GOARCH=386` is no longer supported.
roots_386 := [source_dir() / 'ql/test/query-tests/Security/CWE-681/IncorrectIntegerConversion.qlref']

[group('test')]
language-tests *EXTRA_ARGS: (_language_tests (roots ++ EXTRA_ARGS))

[group('test')]
language-tests-386 *EXTRA_ARGS: (_language_tests (roots_386 ++ ['GOOS=linux', 'GOARCH=386'] ++ EXTRA_ARGS))
8 changes: 8 additions & 0 deletions go/ql/integration-tests/justfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import "../../../lib.just"

# Integration tests are slow and need an internal checkout, so they only run when
# asked for by name.
explicit_verbs := ['test']

[no-cd]
test *ARGS=".": (_integration_test ARGS)
6 changes: 6 additions & 0 deletions go/ql/justfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import "../../lib.just"

[no-cd]
format *ARGS=".": (_format_ql ARGS)

consistency_queries := source_dir() / "consistency-queries"
11 changes: 11 additions & 0 deletions go/ql/test/justfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import "../justfile"

# A whole language test suite is slow, so it only runs when asked for by name.
explicit_verbs := ['test']

base_flags := []

all_checks := default_db_checks ++ ['--check-undefined-labels', '--check-unused-labels', '--check-repeated-labels', '--check-redefined-labels', '--check-use-before-definition', '--consistency-queries=' + consistency_queries]

[no-cd]
test *ARGS=".": (_codeql_test "go" (base_flags ++ prepend('--all-checks=', all_checks) ++ ARGS))
4 changes: 4 additions & 0 deletions java/justfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import '../lib.just'

[group('build')]
build: (_build_dist "java")
8 changes: 8 additions & 0 deletions java/ql/integration-tests/justfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import "../../../lib.just"

# Integration tests are slow and need an internal checkout, so they only run when
# asked for by name.
explicit_verbs := ['test']

[no-cd]
test *ARGS=".": (_integration_test ARGS)
6 changes: 6 additions & 0 deletions java/ql/justfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import "../../lib.just"

[no-cd]
format *ARGS=".": (_format_ql ARGS)

consistency_queries := source_dir() / "consistency-queries"
13 changes: 13 additions & 0 deletions java/ql/test-kotlin1/justfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import "../justfile"

# These are CI shards of the Kotlin language tests, run as `just java
# kotlin-language-tests-1`, so they only run when asked for by name.
explicit_verbs := ['test']

# Kotlin tests may fail the diags.ql consistency test if the diagnostic limit is set.
base_flags := ['CODEQL_EXTRACTOR_KOTLIN_DIAGNOSTIC_LIMIT=']

all_checks := default_db_checks ++ ['--check-undefined-labels', '--check-repeated-labels', '--check-redefined-labels', '--check-use-before-definition', '--consistency-queries=' + consistency_queries]

[no-cd]
test *ARGS=".": (_codeql_test "java" (base_flags ++ prepend('--all-checks=', all_checks) ++ ARGS))
13 changes: 13 additions & 0 deletions java/ql/test-kotlin2/justfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import "../justfile"

# These are CI shards of the Kotlin language tests, run as `just java
# kotlin-language-tests-2`, so they only run when asked for by name.
explicit_verbs := ['test']

# Kotlin tests may fail the diags.ql consistency test if the diagnostic limit is set.
base_flags := ['CODEQL_EXTRACTOR_KOTLIN_DIAGNOSTIC_LIMIT=', 'CODEQL_KOTLIN_LEGACY_TEST_EXTRACTION_KOTLIN2=true']

all_checks := default_db_checks ++ ['--check-undefined-labels', '--check-repeated-labels', '--check-redefined-labels', '--check-use-before-definition', '--consistency-queries=' + consistency_queries]

[no-cd]
test *ARGS=".": (_codeql_test "java" (base_flags ++ prepend('--all-checks=', all_checks) ++ ARGS))
12 changes: 12 additions & 0 deletions java/ql/test/justfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import "../justfile"

# A whole language test suite is slow, so it only runs when asked for by name.
explicit_verbs := ['test']

# Kotlin tests may fail the diags.ql consistency test if the diagnostic limit is set.
base_flags := ['CODEQL_EXTRACTOR_KOTLIN_DIAGNOSTIC_LIMIT=']

all_checks := default_db_checks ++ ['--check-undefined-labels', '--check-repeated-labels', '--check-redefined-labels', '--check-use-before-definition', '--consistency-queries=' + consistency_queries]

[no-cd]
test *ARGS=".": (_codeql_test "java" (base_flags ++ prepend('--all-checks=', all_checks) ++ ARGS))
9 changes: 9 additions & 0 deletions javascript/justfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import '../lib.just'

[group('build')]
build: (_build_dist "javascript")

roots := [source_dir() / 'ql/test']

[group('test')]
language-tests *EXTRA_ARGS: (_language_tests (roots ++ EXTRA_ARGS))
8 changes: 8 additions & 0 deletions javascript/ql/integration-tests/justfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import "../../../lib.just"

# Integration tests are slow and need an internal checkout, so they only run when
# asked for by name.
explicit_verbs := ['test']

[no-cd]
test *ARGS=".": (_integration_test ARGS)
6 changes: 6 additions & 0 deletions javascript/ql/justfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import "../../lib.just"

[no-cd]
format *ARGS=".": (_format_ql ARGS)

consistency_queries := ""
11 changes: 11 additions & 0 deletions javascript/ql/test/justfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import "../justfile"

# A whole language test suite is slow, so it only runs when asked for by name.
explicit_verbs := ['test']

base_flags := []

all_checks := default_db_checks

[no-cd]
test *ARGS=".": (_codeql_test "javascript" (base_flags ++ prepend('--all-checks=', all_checks) ++ ARGS))
9 changes: 9 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# see misc/just/README.md for an overview

import 'lib.just'
import 'misc/just/forward.just'

# bazel files live all over the repository rather than under any one language, so they
# are formatted from here. `format` itself is the forwarder, hence `_root_`; see
# misc/just/README.md.
_root_format *ARGS=".": (_format_bazel ARGS)
1 change: 1 addition & 0 deletions lib.just
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import "misc/just/lib.just"
8 changes: 8 additions & 0 deletions misc/bazel/buildifier/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,11 @@ buildifier(
],
lint_mode = "fix",
)

# The binary behind the target above, which formats the paths it is given rather than
# always the whole workspace. `just format` goes through this so that formatting a
# directory formats that directory.
alias(
name = "binary",
actual = "@buildifier_prebuilt//:buildifier",
)
5 changes: 5 additions & 0 deletions misc/codegen/justfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import "../just/lib.just"

test *ARGS="": (_bazel ['test', '@codeql//misc/codegen/...'])

format *ARGS=".": (_format_py ARGS)
Loading
Loading