Skip to content

Linter R2: File Path Validity #1315

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

Open
3 of 4 tasks
Ellpeck opened this issue Feb 13, 2025 · 0 comments · May be fixed by #1588
Open
3 of 4 tasks

Linter R2: File Path Validity #1315

Ellpeck opened this issue Feb 13, 2025 · 0 comments · May be fixed by #1588
Assignees
Labels
flowr linter Related to the linter that we're implementing on top of the search api

Comments

@Ellpeck
Copy link
Member

Ellpeck commented Feb 13, 2025

Requirements:

  • Call-context query using Create search api queries from old query api queries #1314
  • Resolver (flowr search resolvers and mappers #1312) for params/args of a function (Info.Parameters) and function call (Info.Arguments)
  • Some type of collection of read and write functions similar to the dependencies query
    • -> we could also edit the dependencies query to not be specific to entire files to allow using that one directly in our rule through fromQuery? Then we'd need a Info.LastCall resolver to link these dependencies to the last call of an associated write/read in case the script creates files it later expects itself!
    • -> load these infos from a static file (like a csv/json) in the flowr sources rather than having them hard-coded in code?

We then check the file path's validity as part of the linting rule itself, rather than as part of the query API. ie we only use the query api to gather all of the paths we may need to inspect.

// using a modified dependencies query:
Q.fromQuery({ type: 'dependencies', filter: 'read' })
 .with(Info.LastCall, { callName: 'setwd', cascadeIf: CascadeAction.Continue })
 .with(Info.Arguments)

// then run the query and select the nth argument based on our list of functions

Things to consider:

  • Configurability? file read/write queries can be quite slow so maybe we allow users to make the linting rule "less specific
@Ellpeck Ellpeck added the flowr linter Related to the linter that we're implementing on top of the search api label Feb 13, 2025
@Ellpeck Ellpeck self-assigned this Feb 13, 2025
@Ellpeck Ellpeck linked a pull request Apr 22, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
flowr linter Related to the linter that we're implementing on top of the search api
Projects
None yet
1 participant