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

Refactor manipulateConfig #122

Merged
merged 2 commits into from
Oct 13, 2022
Merged

Conversation

mikapfl
Copy link
Contributor

@mikapfl mikapfl commented Oct 13, 2022

While I didn't manage to solve the real bug #121 , I refactored manipulateConfig in the process (lightly) and it is now linter warning free.

Copy link
Contributor

@pfuehrlich-pik pfuehrlich-pik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

for (key in names(arguments)) {
value <- arguments[[key]]
if (length(value) > 1) {
value <- capture.output(cat(paste0(value, ", "), fill = maxchar))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah the classic capture.output cat 😂 There has to be a cleaner way to get padding, but this does not seem important enough to fix.

# definitions in the form
# > $setglobal key value
manipulations[[paste0(key, "_pattern1")]][1] <- paste0(
"((\\n|^)[\\t ]*\\$[sS][eE][tT][gG][lL][oO][bB][aA][lL][\\t ]*", key, "[\\t ]).*?( *!!|\\n|$)")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this the longest regex in our codebase? I really hope so 😬

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

well, certainly not the worst, the one 4 lines down is much worse.

@mikapfl mikapfl merged commit cd4ac53 into pik-piam:master Oct 13, 2022
@mikapfl mikapfl deleted the refactor-manipulateConfig branch October 13, 2022 15:23
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.

2 participants