Skip to content

Linter Rule 2: File Path Boogaloo #1588

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 224 commits into
base: linter-staging
Choose a base branch
from
Draft

Conversation

Ellpeck
Copy link
Member

@Ellpeck Ellpeck commented Apr 22, 2025

No description provided.

EagleoutIce and others added 30 commits March 2, 2025 16:49
* refactor: configuration option for solver counts

* perf(slice): cache fingerprints

* perf(slice): minor improvement to continuation

* perf(sgtatic-slice): improve env fingerprints

* refactor: add cache
* feat: location map query with file ids

fix: order of sourced project files

* feat-fix: file names in project query
* docs: this is what you get when you don't use a formatter :(

* feat-fix: allow benchmark helper output path to be only file

* feat(benchmark): add 'storedIndices' statistic

* feat(benchmark): add 'enable-pointer-tracking' cli option

* feat(benchmark): add 'storedEnvIndices' statistic

Renamed 'storedIndices' to 'storedVertexIndices'.

* test: add test for benchmarking with pointer tracking enabled

* feat(benchmark): add detection for JSON paths file

* feat-fix(benchmark): fix windows path problems

* feat(benchmark): add 'overwrittenIndices' statistic

* feat(benchmark): add 'max-file-slices' cli option

* feat(benchmark): add 'threshold' cli option
feat(benchmark): add 'per-file-time-limit' cli option
* feat(vector-def): add processVector

* refactor: invert pointerTracking config check

This reduces the indentation of the whole pointer analysis block
and the argument filtering before can be excluded too.

* feat: add index identifer with index instead of lexeme

While lexemes are great to destinguish indices from named arguments in lists, for vectors we need to also store the index.
Furthermore, this is important for index based access on lists or vectors.
Index information for named arguments will be added separately.

* feat(list-def): store index of list arguments

These will be required later for the index based access on lists.

* feat(vector-def): add flattened indices for nested vectors

For an expression `c(1, 2, c(3, 4))` the nested vector would be flattened so that it equals `c(1, 2, 3, 4)`.
For this to work, we need to fetch the indices for the nested vector and add them to the existing indices.
In a case where there are values after a nested index we need to rewrite the indices so that they are in correct order.
E.g. for `c(1, c(2, 3), 4)` the argument with value '4' has initially the index 3, after it has been flattened,
it has to be 4. This is done by merging both lists with new indices similar to the merging part of MergeSort.

* test(vector-def): add tests for vector definitions

With this test suite we can test whether the indices of a vector are defined correctly.
Previously we only could check this by accessing the indices and testing the reads edges.
This eliminates this step and lets us test this unit separately.

* refactor(vector-def): extract flatten indices logic to separate method

* feat-fix(vector-def): also support logical and string values

Previously only numbers were recognized as values for a vector definition.

* refactor(built-in-access): extract method to resolve indices

Now we can use the same method for the index based access, which works in the same way.

* refactor: rename pointer analysis test files

- removed 'dataflow' prefix, because the tests are in the `test/functionality/dataflow` directory, which makes the prefix obsolete
- added the type of access to the test files: list-access -> list-name-based-access to differentiate other types of access

* feat: add support for single index-access

* refactor: extract access operand extraction

* refactor: extract construct accessed indices logic for replacement func

* test: add tests for list definitions

* feat: process indices on the way up the fold

On the way down, we don't have all information e.g. about nested containers, which makes it inevitable to resolve them on the way up.
Previously, for a vector definition nested containers were handled on the way up, while primitves were handled on the way down.
This lead to a rather complex merging logic. Handling now everything on the way up let's us iterate the arguments once and define the
indices for the container at the same time. While adding the resolving of unnamed list arguments, I changed this too for list definitions.

* refactor: rename list-access.ts utils to containers.ts

These functions are now used for all container logic.

* refactor: extract resolve indices by argument name logic

* test(container-def): add tests for passing nested container as variable

* test(vector-access): make tests also for single bracket access

* feat: add support for numerical index based assignment

This enabled the pointer analysis for assignments like the following:
```r
a <- c(1, 2)
a[[1]] <- 3
a[2] <- 4
```

This does not include access with a variable or a range or anything that accessed more than one index.

* test: add dataflow tests for access and assignment

* test: make single index based access tests parameterized

This way, we can test the same behavior for vectors and lists (with named and unnamed arguments).

* test: add ability to create graph edges with queries

This enables it e.g. to query the second access operation in the same line, which was previously
only possible using the line:column format.

* test-fix: make tests work again after rebase

* feat: add support for container assignment

This enables passing the indices of one container to another.
Example:
```r
a <- c(1, 2)
b <- a # indices [1, 2] are passed to b
print(b) # definition of a is also in slice
```

* test: add query helper for all edge types

Now all edge types can be created using queries.

* test: move simple name based list access to parameterized tests

This way, we can extend the test suite and test more scenarios in less code/time.

* test: parameterize pointer analysis dataflow tests

* test: enable pointer tracking in dataflow definition tests

* feat-fix: disable indices merging when pointer tracking is disabled

* test: add tests for unknown container definition

* feat-fix: add definitions if indices couldn't be resolved (as fallback)

* refactor: move test for nested lists to parameterized tests

* test: add tests for access of non-existing index

* test: assure that pointer analysis is enabled in each describe block

* feat: overapproximate when access cannot be resolved

* feat: add existing indices if they don't contain pointer information
…taflow Graph,wiki/Interface,wiki/Linting and Testing,wiki/Core)
* feat-fix: normalized ast should show index-access of `$` and `@`

* feat(wip): work on resolve nested args

* wip: backpatch approach

* feat(pointer-analysis): fix nested access

* refactor: remove empty lines
actions-user and others added 23 commits May 2, 2025 10:10
* feat: provide replacement options

* refactor: rename apply replacements for clarity
* feat-fix: drop all now returns the basename as well

* test-fix: update tests
* refactor: prune slipped todos

* refactor: main lint guard

* refactor: fix gihub typo
@Ellpeck Ellpeck changed the base branch from linter-staging to main May 3, 2025 18:46
@Ellpeck Ellpeck changed the base branch from main to linter-staging May 3, 2025 18:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Linter R2: File Path Validity
7 participants