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

Error with capturing groups on regexes (object_name_linter) #2188

Closed
pit00 opened this issue Sep 19, 2023 · 2 comments · Fixed by #2287
Closed

Error with capturing groups on regexes (object_name_linter) #2188

pit00 opened this issue Sep 19, 2023 · 2 comments · Fixed by #2287
Labels
bug an unexpected problem or unintended behavior
Milestone

Comments

@pit00
Copy link

pit00 commented Sep 19, 2023

Using capturing groups "()" in any regex string, returns Error: Linter 'object_name_linter' failed in [...]: only defined on a data frame with all numeric-alike variables

@MichaelChirico
Copy link
Collaborator

could you provide a reprex to make it easier to support your request?

@MichaelChirico MichaelChirico added the bug an unexpected problem or unintended behavior label Sep 19, 2023
@pit00
Copy link
Author

pit00 commented Sep 19, 2023

could you provide a reprex to make it easier to support your request?

My last answer was a wrong code, here is the correct one:

lint(
    text = "camelCase <- 1; camelCasE__ <- 2",
    linters = object_name_linter(styles = "camelCase", regexes = c(my_style = "^[a-z0-9]+([A-Z][a-z0-9]+)*[A-Z]__"))
)

@MichaelChirico MichaelChirico added this to the 3.1.2 milestone Oct 12, 2023
averissimo added a commit to insightsengineering/teal.transform that referenced this issue Feb 14, 2024
# Pull Request

<!--- Replace `#nnn` with your issue link for reference. -->

Part of #172

#### Changes description

- Add new regex style to object_name_linter to account for ADaM
variables.
  - See `.lintr` file
- `regexes = c(ANL = "^ANL_?[0-9]*$", ADaM =
"^r?ADSL|ADTTE|ADLB|ADRS|ADAE$"))`
- Allows for variables named `ANL` with optional underscore and numbers
after.
- note: can't use groups (`(rule_within_parenthesis)`) due to
[r-lib/lintr/issues/2188](r-lib/lintr#2188)
not being released yet.
- Convert other `# nolint` to specific `# nolint: <rule name>.` for
specificity

---------

Signed-off-by: André Veríssimo <211358+averissimo@users.noreply.github.com>
Co-authored-by: m7pr <marcin.kosinski.mk1@roche.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug an unexpected problem or unintended behavior
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants