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

Allow GitHub issue TODOs to be automatically removed #1423

Merged
merged 2 commits into from
Jul 2, 2019
Merged

Conversation

nex3
Copy link
Contributor

@nex3 nex3 commented Jul 2, 2019

No description provided.

@nex3 nex3 requested a review from rambleraptor July 2, 2019 21:55
@@ -19,6 +19,12 @@ def self.merge_options(existing_opts, new_opts)
existing_opts[key] << v
end
existing_opts[key].uniq!
elsif key =~ /remove_((?:warning_)?todo)/
key = $1.to_sym
Copy link
Contributor

Choose a reason for hiding this comment

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

This is very much a personal preference thing, but I'm not a huge fan of the elsif doing logic + the $1 fetching that logic in the next line.

Could the regex be moved to a function that returns either the key or nil? That function could be used for both checking if it's a TODO + fetching the key without having to expose the $1 to the user.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

WDYT about removed_key = key[/remove_((?:warning_)?todo)/, 1]? That way it's clear what information we're extracting, without having to create a separate function for each condition.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, that'll work!

I just don't like $ notation because I have to backtrack through the code to understand what it's referring to.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

PTAL

Copy link
Contributor

@rambleraptor rambleraptor left a comment

Choose a reason for hiding this comment

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

Looks great!

@nex3 nex3 merged commit 8a96572 into master Jul 2, 2019
@nex3 nex3 deleted the remove-todo branch July 2, 2019 23:32
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