Skip to content
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

Check for missing ns() #294

Open
ColinFay opened this issue Nov 19, 2019 · 2 comments
Open

Check for missing ns() #294

ColinFay opened this issue Nov 19, 2019 · 2 comments

Comments

@ColinFay
Copy link
Member

When running document_and_reload(), we could check if any ns() is missing from the code base.

@ColinFay
Copy link
Member Author

Check for any ns :

"ns" %in% (getParseData(parse(text = readLines("R/mod_name.R"))) |> dplyr::filter(token == "SYMBOL_FUNCTION_CALL")  |> getElement("text") )

Next step

  • Detect that a function is input or output and that they are not update
  • check that the next function call is ns

Some raw code (not working but left here as a draft)

getParseData(
  parse(
    text = readLines("R/mod_selecteur_territoire.R")
  )
) |>
  dplyr::filter(token == "SYMBOL_FUNCTION_CALL") |>
  dplyr::mutate(is_input_output = grepl("Input|Output", text)) |>
  dplyr::mutate(
    is_input_output_next_to_input_output = dplyr::lag(is_input_output)
    ) |>
  dplyr::select(text, is_input_output_next_to_input_output) |>
  dplyr::mutate(is_correct = (text == "ns") & is_input_output_next_to_input_output) |>
  dplyr::filter(is_input_output_next_to_input_output)

@ColinFay
Copy link
Member Author

What we want to verify:

After each xyzInput or xyzOutput, there is a ns

Screenshot 2023-12-18 at 09 23 48

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants