-
Notifications
You must be signed in to change notification settings - Fork 44
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
Backported code from the current master #543
Conversation
# | ||
# @param devregex [String] regex to filter by | ||
# @return [Array] of ifcfg names | ||
def get_devices(devregex = "[~]") |
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.
why parameter is not regexp and instead only string that is later interpreted as regexp?
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.
also why regexp is not just ~
?
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 don't know, ask @teclator ;-)
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 improve it 👍 . It was one of my first cleanups and just use same match that was used with Builtins.regexpmatch
https://github.com/yast/yast-yast2/pull/433/files#diff-36f13a6d2bafc7ad7bcfa6f8a452e81dL704
PR: #433
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.
@teclator I know ;-) I'll do so for master not maintenance branch.
expect(subject.get_devices("1")).not_to include "em1", "eth1", "br1" | ||
end | ||
|
||
it "filters with <[~]> by default" do |
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.
maybe i woulld name it filters devices with "~" by default
expect(subject.get_devices(".")).to eql [] | ||
end | ||
|
||
it "returns all devices filtering with <''>" do |
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.
with empty string
expect(subject.get_devices("")).to eql devices | ||
end | ||
|
||
it "does not crash with exception" do |
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.
quite strong statement and you are never sure that it do not return expection. E.g. low memory or signal can get almost in every line of code.
expect { subject.get_devices }.not_to raise_error | ||
end | ||
|
||
it "doesn't carry empty strings" do |
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.
filters out empty strings
@jreidinger Are you fine with creating a PR with modifications based on your comments against master? This should be pure backport of code which already (more less) is in master. |
@mchf yes, I am fine. |
@mchf @jreidinger, I'm fine with just merge this PR with the backported code but the improvements or modifications maybe would be great to do directly in SP1 and then merge into SP2 and master |
.travis.yml
Outdated
@@ -5,7 +5,7 @@ before_install: | |||
# disable rvm, use system Ruby | |||
- rvm reset | |||
- wget https://raw.githubusercontent.com/yast/yast-devtools/master/travis-tools/travis_setup.sh | |||
- sh ./travis_setup.sh -p "rake yast2-core yast2-devtools yast2-testsuite yast2-ruby-bindings yast2 yast2-pkg-bindings" -g "rspec:3.3.0 yast-rake gettext simplecov coveralls rubocop:0.29.1" | |||
- sh ./travis_setup.sh -p "rake yast2-core yast2-devtools yast2-testsuite yast2-ruby-bindings yast2 yast2-pkg-bindings" -g "rspec:3.3.0 yast-rake gettext simplecov:0.10.0 coveralls rubocop:0.29.1" |
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.
better fix is to completelly remove simplecov and it pick right version
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
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.
LGTM
https://bugzilla.suse.com/show_bug.cgi?id=1028081