-
Notifications
You must be signed in to change notification settings - Fork 76
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
Rubocop-suggested code style improvements #54
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
* Adds top level comment for class * Removes trailing space * Disables cop for SpaceInsideParens
* Makes indentation consistent * Uses Ruby 1.9 hash syntax * Prefers single-quoted strings * Sets MethodLength limit to 15 * Disables RescueModifier and SpaceInsidePercentLiteralDelimiters cops
* Uses guard clauses instead of large if/unless constructs * Avoids assignments within conditional expressions * Uses attr_reader for trivial reader method * Allows inner slashes for RegexpLiteral cop * Spacing
* Freezes version string * Uses guard statements * Disables Style/Documentation bot
* Changes `Configure` method to `configure` to adhere to snake_case * Aliases `Configure` to maintain backward compatibility * Updates examples and test uses of `Configure` * Corrects syntax for `private` modifier on class method
* Uses $PROGRAM_NAME instead of $0
* Uses $LOAD_PATH instead of $: * Uses Ruby 1.9 hash syntax
* Uses $LOAD_PATH instead of $: * Removes unnecessary %q literal usage * Removes unnecessary assignment
* Change array comparison logic from direct comparisons to loops of include checks * Uses JSON.parse insted of JSON::load * Breaks overly long lines * Uses Ruby 1.9 hash syntax
765060d
to
578780c
Compare
a9ecd78
to
06581da
Compare
* Removes unnecessary tasks * Calls `rspec` via Core::RakeTask instead of `system`
Thank you very much for your contributions @harman28 ! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Ref: #51 - Rubocop throws up a lot of offenses
Details of all changes can be found in the commit messages.
Major changes:
Wikipedia.Configure
has been aliased toWikipedia.configure
(camelCase): The older function still works, but I would recommend deprecating it and removing in a later release.client
inwikipedia.rb
has been made privateeditorconfig
file has been addedrubocop
has been added as a development dependancy, andrake rubocop
is added. We could also add it to the build step and maybe make ittask default: [:spec, :rubocop]
I've mostly guessed at what the adopted style decisions of this repo are, based on the code I saw, and made rubocop configuration changes accordingly.
Metrics/LineLength
: 120 seems reasonableMetrics/MethodLength
: This is 10 by default, but it finds offence in methods that really shouldn’t be any shorter. Set to 15.Style/SpaceInsideParens
: Disabled, appears to be a style decisionStyle/SpaceInsidePercentLiteralDelimiters
: Disabled, appears to be a style decisionStyle/RescueModifier
: Disabled, appears to be a style decisionStyle/RegexpLiteral
: Allowed inner slashes, to avoid having to use the %r literalStyle/Documentation
: Can be enabled laterPlease review.