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
Trying to appease Rubocop #4301
Conversation
Do you plan on doing more @pathawks because as far as I'm concerned as it stands right now this is ready to be merged and perfect! |
Well... asked too late since as I was asking you did more lol. |
lol |
Failing tests seem unrelated. Drops have no method |
What is the best way to do a big PR like this? Should I just keep committing and then squash+merge when I finish / get bored? |
Squash likes but keep others as their own commits so there is a clear history. So for example you have two commits that have "key?" changes, those two should be squashed but everything else that isn't the same of another commit is easier to verify over multiple commits in this case. |
@@ -130,7 +130,7 @@ def valid?(set) | |||
# new_scope - the new scope hash | |||
# | |||
# Returns true if the new scope has precedence over the older | |||
def has_precedence?(old_scope, new_scope) | |||
def precedence?(old_scope, new_scope) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
precedence?
is private
, so renaming is not a breaking change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm gonna caution on the side of it not being entirely clear to the user, things like Rubocop tell you to only use private
once but that's an ignorant approach considering I didn't even know it was private until I scrolled up quite a ways. They also tell you to indent on that private, which just muddies the code view.
I'm not against the change though, just saying it might not be clear to a user.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you have a suggestion for making it more clear?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For all my source, I disable Rubocops "worthless private" warning and add private above every private def no matter how many there are, so it's clear that method is private, the same way other languages enforce that kind of explicitness.
private
def method1
#
end
private
def method2
#
end
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, I think I already disabled that in Jekyll too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I see that this convention is already implemented in most other parts of Jekyll.
Before:
After:
|
master after b7d5a26:
I will weed some of these commits out when I get the chance. |
It's gone down slightly more after further refinement, now it sits at 533 offenses as it stands. |
- Use array literal [] instead of Array.new - Use hash literal {} instead of Hash.new
- Do not use semicolons to terminate expressions
- Use \ instead of + or << to concatenate those strings
- Prefer $LOAD_PATH over $:
- Use && instead of and - Use || instead of or
- %w-literals should be delimited by ( and ) Rubocop: Style/WordArray - Use %w or %W for array of words
- Hash#has_key? is deprecated in favor of Hash#key? Add method `key?` to Drop
- Use delete! instead of gsub! - Use tr instead of gsub
- Use hash rockets syntax
- Extra empty line detected at class body end
- Space missing after comma
Rubocop: Style/SpaceInsideBlockBraces
- Favor unless over if for negative conditions
- Pass &:to_sym as an argument to map instead of a block - Pass &:capitalize as an argument to select instead of a block - Pass &:to_s as an argument to map instead of a block
Down to 321, and I'm not sure why the test failed (only on 2.2)
|
It randomly fails on 2.2 because of bugs in 2.2 that were addressed in the latest 2.2 but Travis+RVM is absolutely totally broken so 2.2 points to the first release of 2.2. To fix it we have to point it to the full version of 2.2.* which is annoying to maintain. |
- Use proc instead of Proc.new ...and use lambda instead of proc
- Unused block argument
Keep everything as individual commits, I think. I have encountered too many general "fix the style" commits for my liking. |
- Use next to skip iteration
- Indent when as deep as case
- Align else with if Rubocop: Lint/EndAlignment - Align end with if
- Use `attr_writer` to define trivial writer methods
- Ternary operators must not be nested. Prefer if/else constructs instead.
- Rewrite these with the positive case first
- Avoid the use of Perl-style backrefs
- Avoid using {...} for multi-line blocks
- Space inside range literal
- Don't use parentheses around the condition of an if
- Trailing whitespace detected Rubocop: Style/EmptyLines - Extra blank line detected Rubocop: Style/EmptyLinesAroundBlockBody - Extra empty line detected at block body beginning
@@ -67,13 +65,11 @@ def build(site, options) | |||
# options - A Hash of options passed to the command | |||
# | |||
# Returns nothing. | |||
def watch(site, options) | |||
def watch(_site, options) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can make this just _
, I think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can if you wish but he probably left it _site so the API is clear.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
he probably left it _site so the API is clear.
Yup
Thanks, @pathawks! |
Down to 204 offenses. Thanks so much, @pathawks! |
Thank you both for helping me through this. I learned a lot along the way 👍 |
Am going through this list of style issues and tackling the low hanging fruit. If this is productive, I may continue.
This is mostly for my own learning.