-
Notifications
You must be signed in to change notification settings - Fork 12
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 #32
Use Rubocop #32
Changes from all commits
5a9e135
ce8b5b3
3fe2277
d677058
7f71f3b
d20263b
46063fb
fae8099
2793dc0
6d01188
b5820ed
dbe113c
2abfe37
097355d
342679e
b16c5e1
9f9f76a
30e0dc2
609425e
f74432a
ff2e9fc
4acbc75
eed1c5b
f326b9b
9023c7f
29a3e8d
18bed3e
6c98b4c
f380d9e
d4336bb
85fbad6
4183ff5
50596ad
0121473
8cec1eb
8c32bf3
7957ec1
183b843
5351b49
ee4a3c0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
inherit_from: | ||
.rubocop_yast_style.yml | ||
|
||
# Offense count: 34 | ||
Metrics/AbcSize: | ||
Max: 220 | ||
|
||
# Offense count: 5 | ||
# Configuration parameters: CountComments. | ||
Metrics/ClassLength: | ||
Max: 513 | ||
|
||
# Offense count: 13 | ||
Metrics/CyclomaticComplexity: | ||
Max: 31 | ||
|
||
# Offense count: 49 | ||
# Configuration parameters: AllowURI, URISchemes. | ||
Metrics/LineLength: | ||
Max: 116 | ||
|
||
# Offense count: 47 | ||
# Configuration parameters: CountComments. | ||
Metrics/MethodLength: | ||
Max: 223 | ||
|
||
# Offense count: 13 | ||
Metrics/PerceivedComplexity: | ||
Max: 35 | ||
|
||
Style/Documentation: | ||
Exclude: | ||
- testsuite/tests/*.rb | ||
|
||
Style/FileName: | ||
Exclude: | ||
- src/clients/nfs-client.rb | ||
- src/clients/nfs-client4part.rb | ||
- src/modules/Nfs.rb | ||
- src/modules/NfsOptions.rb | ||
|
||
# YCP Killer used rockets | ||
Style/HashSyntax: | ||
Exclude: | ||
- src/clients/nfs.rb | ||
- src/clients/nfs_auto.rb | ||
- src/include/nfs/ui.rb | ||
- src/include/nfs/wizards.rb | ||
- src/modules/Nfs.rb | ||
- src/modules/NfsOptions.rb | ||
|
||
Style/MethodName: | ||
Exclude: | ||
- src/clients/nfs-client4part.rb | ||
- src/clients/nfs.rb | ||
- src/include/nfs/routines.rb | ||
- src/include/nfs/ui.rb | ||
- src/include/nfs/wizards.rb | ||
- src/modules/Nfs.rb | ||
|
||
Style/VariableName: | ||
Exclude: | ||
- testsuite/tests/*.rb |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# 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 | ||
|
||
# Is there any justification for "aligned" which is the default? | ||
Style/MultilineOperationIndentation: | ||
EnforcedStyle: indented | ||
|
||
# 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 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
require "yast/rake" | ||
|
||
Yast::Tasks.configuration do |conf| | ||
#lets ignore license check for now | ||
# lets ignore license check for now | ||
conf.skip_license_check << /.*/ | ||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,8 @@ | ||
# encoding: utf-8 | ||
|
||
# File: clients/ | ||
# Summary: nfs-client stuff made accesible from | ||
# Author: Bubli <kmachalkova@suse.cz> | ||
# | ||
# YaST namespace | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. does it make sense to have this duplicite useless comment everywhere? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see it as a small cost to keep Style/Documentation enabled, which makes me summarize all classes. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ugh? Bootloader pass it and it do not have such stuff. I am sure, that document it on only one place make rubocop happy. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Documenting in one place does not make Rubocop happy. The cop description, "Document classes and non-namespace modules.", hints at the difference: it complains when the module is not a pure namespace, containing the YaST initialization: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OK, it make sense. So in fact it is wrong detection that it is pure namespace as it actually is. |
||
module Yast | ||
# nfs-client stuff made accesible from the partitioner | ||
class NfsClient4partClient < Client | ||
def main | ||
Yast.import "UI" | ||
|
@@ -76,7 +74,7 @@ def ToStorage(entry) | |
entry = deep_copy(entry) | ||
ret = {} | ||
|
||
if entry != nil && entry != {} | ||
if entry && entry != {} | ||
ret = { | ||
"device" => Ops.get_string(entry, "spec", ""), | ||
"mount" => Ops.get_string(entry, "file", ""), | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,10 @@ | ||
# encoding: utf-8 | ||
|
||
# File: | ||
# routines.ycp | ||
# | ||
# Module: | ||
# Configuration of nfs | ||
# | ||
# Summary: | ||
# Network NFS routines | ||
# | ||
# Authors: | ||
# Jan Holesovsky <kendy@suse.cz> | ||
# Dan Vesely <dan@suse.cz> | ||
# | ||
# $Id$ | ||
# | ||
# Network NFS routines | ||
# | ||
# YaST namespace | ||
module Yast | ||
# Miscellaneous | ||
module NfsRoutinesInclude | ||
def initialize_nfs_routines(include_target) | ||
def initialize_nfs_routines(_include_target) | ||
textdomain "nfs" | ||
|
||
Yast.import "Package" | ||
|
@@ -37,7 +22,7 @@ def SpecToServPath(spec) | |
serv = "" | ||
|
||
# no :/ inside => <server>: or [/]<path> | ||
if path_begin == nil | ||
if path_begin.nil? | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. you can use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. But only if |
||
if spec == | ||
Ops.add( | ||
Builtins.filterchars(spec, Ops.add("-_.", String.CAlnum)), | ||
|
@@ -48,14 +33,13 @@ def SpecToServPath(spec) | |
end | ||
end | ||
|
||
if path_begin != nil | ||
if path_begin | ||
serv = Builtins.substring(spec, 0, path_begin) | ||
spec = Builtins.substring(spec, Ops.add(path_begin, 1)) | ||
end | ||
term(:couple, serv, spec) | ||
end | ||
|
||
|
||
# Creates a list of ui table items for nfs fstab entries | ||
# @param [Array<Hash>] fstab list of nfs fstab entries | ||
# @return itemized table entries | ||
|
@@ -97,11 +81,11 @@ def CheckHostName(name) | |
Report.Error( | ||
Builtins.sformat( | ||
_( | ||
"The hostname entered is invalid. It must be\n" + | ||
"shorter than 50 characters and only use\n" + | ||
"valid IPv4, IPv6 or domain name.\n" + | ||
"Valid IPv4: %1\n" + | ||
"Valid IPv6: %2\n" + | ||
"The hostname entered is invalid. It must be\n" \ | ||
"shorter than 50 characters and only use\n" \ | ||
"valid IPv4, IPv6 or domain name.\n" \ | ||
"Valid IPv4: %1\n" \ | ||
"Valid IPv6: %2\n" \ | ||
"Valid domain: %3" | ||
), | ||
IP.Valid4, | ||
|
@@ -153,16 +137,15 @@ def CheckPath(name) | |
Report.Error( | ||
Builtins.sformat( | ||
_( | ||
"The path entered is invalid.\n" + | ||
"It must be shorter than 70 characters\n" + | ||
"The path entered is invalid.\n" \ | ||
"It must be shorter than 70 characters\n" \ | ||
"and it must begin with a slash (/)." | ||
) | ||
) | ||
) | ||
false | ||
end | ||
|
||
|
||
# Strips a superfluous slash off the end of a pathname. | ||
# @param [String] p pathname | ||
# @return stripped pathname | ||
|
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 think in general for generic yast style should be also:
Just parts from bootloader config, that I find useful and helpful.