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

Use Rubocop for coding style checks #177

Merged
merged 80 commits into from Dec 11, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
80 commits
Select commit Hold shift + click to select a range
76590c0
added auto generated .rubocop.yml file
lslezak Nov 19, 2014
4582699
rubocop: fixed "Prefer double-quoted strings"
lslezak Nov 19, 2014
21b3c3f
rubocop: fixed "Prefer $LOAD_PATH over $:"
lslezak Nov 19, 2014
fbb9245
rubocop: fixed "Surrounding space missing in default value assignment"
lslezak Nov 19, 2014
2a4a14f
rubocop: fixed "Use def with parentheses when there are parameters"
lslezak Nov 19, 2014
d218b6f
rubocop: fixed "Missing space after #"
lslezak Nov 19, 2014
aa81160
rubocop: fixed "Separate every 3 digits"
lslezak Nov 19, 2014
44356bb
rubocop: fixed "Don't use parentheses around the condition"
lslezak Nov 19, 2014
ca24d6c
rubocop: fixed "Use proc instead of Proc.new"
lslezak Nov 19, 2014
19bb8b4
rubocop: fixed "Redundant begin block"
lslezak Nov 19, 2014
009b26d
rubocop: fixed "Space missing after comma"
lslezak Nov 19, 2014
c49c1ab
rubocop: fixed "File.exists? is deprecated in favor of File.exist?"
lslezak Nov 19, 2014
a7318b6
rubocop: fixed "Unused block argument"
lslezak Nov 19, 2014
b57fa7a
rubocop: fixed "Hash#has_key? is deprecated in favor of Hash#key?"
lslezak Nov 19, 2014
9284fc7
rubocop: fixed "Extra blank line"
lslezak Nov 19, 2014
8071e09
rubocop: fixed "Do not use parentheses for method calls with no argum…
lslezak Nov 19, 2014
d9f836f
rubocop: fixed "Avoid the use of Perl-style backrefs"
lslezak Nov 19, 2014
6e4e464
rubocop: fixed "trailing blank lines"
lslezak Nov 19, 2014
bf95ab8
rubocop: fixed "trailing comma"
lslezak Nov 19, 2014
89613a6
rubocop: fixed "Pass &:unregistered as an argument to each instead of…
lslezak Nov 19, 2014
93df345
rubocop: fixed "Redundant return"
lslezak Nov 19, 2014
140f116
rubocop: fixed "Surrounding space missing for operators"
lslezak Nov 19, 2014
2376182
rubocop: fixed "Incorrect indentation"
lslezak Nov 19, 2014
7643f75
rubocop: set max. line length to 140
lslezak Nov 20, 2014
1e8fe1a
rubocop: fixed "Keep a blank line before and after private"
lslezak Nov 20, 2014
295dc92
rubocop: fixed "Extra empty lines"
lslezak Nov 20, 2014
f0882e0
rubocop: fixed "Nil comparison"
lslezak Nov 20, 2014
f1380e4
rubocop: fixed "Comparison of something with itself"
lslezak Nov 20, 2014
6f51960
rubocop: fixed "Style/TrivialAccessors" - allow predicates
lslezak Nov 20, 2014
cb728e6
rubocop: set Style/StringLiteralsInInterpolation to double_quotes
lslezak Nov 20, 2014
7832b2e
rubocop: fixed "(...) interpreted as grouped expression"
lslezak Nov 20, 2014
b538889
rubocop: fixed "Shadowing outer local variable"
lslezak Nov 20, 2014
d14dc19
rubocop: fixed "Unused method argument"
lslezak Nov 20, 2014
6c9ae76
rubocop: fixed "Useless private access modifier"
lslezak Nov 20, 2014
774a339
rubocop: fixed "Useless assignment to variable"
lslezak Nov 20, 2014
17c4b7c
rubocop: fixed "Do not use :: for method calls"
lslezak Nov 20, 2014
bf7d703
rubocop: fixed "Avoid rescuing the Exception class"
lslezak Nov 20, 2014
a765df7
rubocop: fixed "Use a guard clause"
lslezak Nov 20, 2014
942697a
rubocop: fixed "Use the new Ruby 1.9 hash syntax"
lslezak Nov 20, 2014
c4a5ef9
rubocop: fixed "Use \ instead of + to concatenate"
lslezak Nov 20, 2014
9b35987
rubocop: use "raise" instead of "fail"
lslezak Nov 20, 2014
b56cb23
rubocop: fixed "Inconsistent indentation"
lslezak Nov 20, 2014
7df6e1d
rubocop: fixed "Avoid multi-line ternary operator"
lslezak Nov 20, 2014
69bfce7
rubocop: fixed "Use nested module/class definitions"
lslezak Nov 20, 2014
0faa8f1
rubocop: disable Style/AlignArray and Style/AlignHash checks
lslezak Nov 20, 2014
983de2c
rubocop: disabled Style/AlignParameters check
lslezak Nov 20, 2014
1cca12b
rubocop: fixed "Redundant curly braces around a hash parameter"
lslezak Nov 20, 2014
577f9ff
rubocop: fixed "Space missing to the left of {"
lslezak Nov 20, 2014
fc712b4
rubocop: fixed "Space missing inside block"
lslezak Nov 20, 2014
2f3275c
rubocop: fixed "Space inside Hash"
lslezak Nov 20, 2014
212fe4c
rubocop: fixed "Trailing whitespace"
lslezak Nov 20, 2014
d54a4bc
rubocop: fixed "Use leading dot"
lslezak Nov 20, 2014
c28dd0e
rubocop: fixed "Use the new lambda syntax"
lslezak Nov 20, 2014
58417ac
rubocop: no extra indentation for case
lslezak Nov 20, 2014
1a164cf
rubocop: fixed "Favor modifier while"
lslezak Nov 20, 2014
56ef162
rubocop: fixed "Do not use do with multi-line while"
lslezak Nov 20, 2014
61a9c57
rubocop: fixed "Space inside square brackets"
lslezak Nov 21, 2014
cc0cfc8
rubocop: disable Style/NegatedIf check
lslezak Nov 21, 2014
b5629d8
rubocop: fixed "Favor modifier if usage when having a single-line body"
lslezak Nov 21, 2014
a196659
rubocop: fixed "Favor until over while for negative conditions"
lslezak Nov 21, 2014
f30ed1d
rubocop: fixed "Annotation keywords"
lslezak Nov 21, 2014
0c59678
rubocop: disable Style/MultilineOperationIndentation check
lslezak Nov 21, 2014
dbe92c4
rubocop: fixed "Use next to skip iteration"
lslezak Nov 21, 2014
0298d2c
rubocop: disable code metrics checks
lslezak Nov 21, 2014
938d586
rubocop: fixed "Use Kernel#loop with break"
lslezak Nov 21, 2014
8d8da56
rubocop: remove generated header
lslezak Nov 21, 2014
f730c2a
run rubocop at Travis
lslezak Nov 21, 2014
194f20a
rubocop: better nil comparison fix
lslezak Nov 25, 2014
159021d
rubocop: better "Comparison of something with itself" fix
lslezak Nov 25, 2014
c6903ac
rubocop: enable and fix "Style/AlignHash"
lslezak Nov 25, 2014
3cbfa31
rubocop: enable and fix "Style/MultilineOperationIndentation"
lslezak Nov 25, 2014
6615cab
rubocop: enable and fix "Style/AlignArray"
lslezak Nov 25, 2014
4d002c3
rubocop: enable "Style/AlignParameters"
lslezak Nov 25, 2014
61316d5
rubocop: set max. line lenght to 100, fix the long lines
lslezak Nov 25, 2014
d6bf450
rubocop: use the default for Style/NumericLiterals
lslezak Nov 27, 2014
6f123eb
rubocop: separated a common YaST style
mvidner Dec 11, 2014
2d8612a
rubocop: remove "Style/MultilineOperationIndentation" from the common…
mvidner Dec 11, 2014
7ac5d64
rubocop pinned to version ~> 0.27.0
mvidner Dec 11, 2014
5e87590
Do use the &block parameter explicitly.
mvidner Dec 11, 2014
338e5cf
more informative parameter names
mvidner Dec 11, 2014
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
49 changes: 49 additions & 0 deletions .rubocop.yml
@@ -0,0 +1,49 @@
inherit_from:
.rubocop_yast_style.yml

# TODO: this need some non-trivial refactoring...
Metrics/AbcSize:
Max: 111

# TODO: this need some non-trivial refactoring...
Metrics/BlockNesting:
Max: 5

# TODO: this need some non-trivial refactoring...
Metrics/ClassLength:
Max: 450

# TODO: this need some non-trivial refactoring...
Metrics/CyclomaticComplexity:
Max: 25

Metrics/LineLength:
Max: 100

# TODO: this need some non-trivial refactoring...
Metrics/MethodLength:
Max: 96

# TODO: this need some non-trivial refactoring...
Metrics/PerceivedComplexity:
Max: 25

# Offense count: 5
Style/AccessorMethodName:
Enabled: false

# Offense count: 29
Style/Documentation:
Enabled: false

# Offense count: 1
# Configuration parameters: NamePrefix, NamePrefixBlacklist.
Style/PredicateName:
Enabled: false

# def foo?
# @foo
# end
Style/TrivialAccessors:
AllowPredicates: true

37 changes: 37 additions & 0 deletions .rubocop_yast_style.yml
@@ -0,0 +1,37 @@
# Rubocop style configuration
#
# Following
# https://github.com/SUSE/style-guides/blob/master/Ruby.md

# https://github.com/SUSE/style-guides/blob/master/Ruby.md#strings
Style/StringLiterals:
EnforcedStyle: double_quotes

Style/StringLiteralsInInterpolation:
EnforcedStyle: double_quotes

# https://github.com/SUSE/style-guides/blob/master/Ruby.md#arrays
Style/WordArray:
Enabled: false

# align arrows:
# "foo" => true
# "foo_bar" => false
Style/AlignHash:
EnforcedHashRocketStyle: table

# no extra indentation for multiline function calls
Style/AlignParameters:
EnforcedStyle: with_fixed_indentation

# no extra indentation for case
Style/CaseIndentation:
IndentWhenRelativeTo: end

# "unless" has a different connotation than "if not"
Style/NegatedIf:
Enabled: false

# use "raise" instead of "fail"
Style/SignalException:
EnforcedStyle: only_raise
4 changes: 3 additions & 1 deletion .travis.yml
Expand Up @@ -3,8 +3,10 @@ before_install:
# disable rvm, use system Ruby
- rvm reset
- wget https://raw.githubusercontent.com/yast/yast-devtools/SLE-12-GA/travis-tools/travis_setup.sh
- sh ./travis_setup.sh -p "yast2 yast2-slp yast2-add-on" -g bundler
- sh ./travis_setup.sh -p "yast2-devtools yast2 yast2-slp yast2-add-on" -g bundler
script:
- rake check:pot
- rubocop
- yardoc
- COVERAGE=1 bundle exec rake test:unit
- sudo rake install
Expand Down
10 changes: 6 additions & 4 deletions Gemfile
@@ -1,13 +1,15 @@
source "https://rubygems.org"

# TODO FIXME: use a correct branch here...
gem "suse-connect", :github => "SUSE/connect", :branch => "v0.2.14"
# FIXME: use a correct branch here...
gem "suse-connect", github: "SUSE/connect", branch: "v0.2.14"

group :test do
gem "rake"
gem "yard"
gem "yast-rake", ">= 0.1.9"
gem "rspec", "~> 2.14.0"
gem "simplecov", :require => false
gem "coveralls", :require => false if ENV["TRAVIS"]
gem "gettext", require: false
gem "rubocop", "~> 0.27.0", require: false
gem "simplecov", require: false
gem "coveralls", require: false if ENV["TRAVIS"]
end
1 change: 0 additions & 1 deletion Rakefile
Expand Up @@ -8,4 +8,3 @@ Yast::Tasks.configuration do |conf|
# lets ignore license check for now
conf.skip_license_check << /.*/
end

19 changes: 9 additions & 10 deletions src/clients/discover_registration_services.rb
Expand Up @@ -3,9 +3,9 @@
require "registration/url_helpers"

module Yast
import 'UI'
import 'Label'
import 'Report'
import "UI"
import "Label"
import "Report"

class DiscoverRegistrationServicesClient < Client
include Yast::Logger
Expand Down Expand Up @@ -37,9 +37,9 @@ def dialog_content
MarginBox(2, 0.5,
VBox(
# popup heading (in bold)
Heading(_('Local Registration Servers')),
Heading(_("Local Registration Servers")),
VSpacing(0.5),
Label(_("Select a detected registration server from the list\n" +
Label(_("Select a detected registration server from the list\n" \
"or the default SUSE registration server.")),
VSpacing(0.5),
RadioButtonGroup(
Expand Down Expand Up @@ -83,7 +83,7 @@ def service_url(selected)
url = ::Registration::UrlHelpers.service_url(selected_service.slp_url)
log.info "Selected service URL: #{url}"

return url
url
end

def select_registration_service
Expand All @@ -108,11 +108,10 @@ def services_radio_buttons
end

widgets.unshift(Left(RadioButton(Id("scc"),
# %s is the default SCC URL
_("SUSE Customer Center (%s)") % SUSE::Connect::Client::DEFAULT_URL,
true)))
# %s is the default SCC URL
_("SUSE Customer Center (%s)") % SUSE::Connect::Client::DEFAULT_URL,
true)))
end

end unless defined?(DiscoverRegistrationServicesClient)
DiscoverRegistrationServicesClient.new.main
end