Skip to content

Commit

Permalink
Add rubocop.
Browse files Browse the repository at this point in the history
  • Loading branch information
teclator committed Mar 9, 2020
1 parent 9073aa4 commit da87d63
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 30 deletions.
21 changes: 21 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# use the shared Yast defaults
inherit_from:
/usr/share/YaST2/data/devtools/data/rubocop-0.71.0_yast_style.yml

AllCops:
Exclude:
- 'package/*.spec'
- 'src/modules/*.rb'
- 'src/include/slp-server/*.rb'
- 'src/clients/*.rb'
- 'test/*.rb'

Metrics/BlockLength:
Max: 50
Exclude:
- 'test/**/*.rb'

# this needs more testing if we can have frozen string literals
Style/FrozenStringLiteralComment:
Enabled: false

2 changes: 1 addition & 1 deletion Rakefile
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
58 changes: 29 additions & 29 deletions src/lib/y2slp/clients/slp_server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
# To contact SUSE LLC about this file by physical or electronic mail, you may
# find current contact information at www.suse.com.

require 'yast'
require "yast"

module Y2Slp
module Clients
Expand All @@ -29,14 +29,14 @@ class SlpServer < Yast::Client

# Constructor
def initialize
Yast.import 'UI'
textdomain 'slp-server'
Yast.import "UI"
textdomain "slp-server"

Yast.import 'Progress'
Yast.import 'Report'
Yast.import 'Summary'
Yast.import 'CommandLine'
Yast.include self, 'slp-server/wizards.rb'
Yast.import "Progress"
Yast.import "Report"
Yast.import "Summary"
Yast.import "CommandLine"
Yast.include self, "slp-server/wizards.rb"
end

def main
Expand All @@ -45,50 +45,50 @@ def main
end
end

private
private

# It logs the start and finish of the given block call returning the
# result of the call.
def log_and_return(&block)
# The main ()
log.info '----------------------------------------'
log.info 'SlpServer module started'
log.info "----------------------------------------"
log.info "SlpServer module started"

ret = block.call

# Finish
log.info "SlpServer module finished with ret=#{ret.inspect})"
log.info '----------------------------------------'
log.info "----------------------------------------"
end

def cmdline_description
{
'id' => 'slp-server',
"id" => "slp-server",
# Command line help text for the Xslp-server module
'help' => _(
'Configuration of an SLP server'
"help" => _(
"Configuration of an SLP server"
),
'guihandler' => fun_ref(method(:SlpServerSequence), 'any ()'),
'initialize' => fun_ref(Yast::SlpServer.method(:Read), 'boolean ()'),
'finish' => fun_ref(Yast::SlpServer.method(:Write), 'boolean ()'),
'actions' =>
# FIXME: TODO: fill the functionality description here
{},
'options' =>
# FIXME: TODO: fill the option descriptions here
{},
'mappings' =>
# FIXME: TODO: fill the mappings of actions and options here
{}
"guihandler" => fun_ref(method(:SlpServerSequence), "any ()"),
"initialize" => fun_ref(Yast::SlpServer.method(:Read), "boolean ()"),
"finish" => fun_ref(Yast::SlpServer.method(:Write), "boolean ()"),
"actions" =>
# FIXME: TODO: fill the functionality description here
{},
"options" =>
# FIXME: TODO: fill the option descriptions here
{},
"mappings" =>
# FIXME: TODO: fill the mappings of actions and options here
{}
}
end

def propose?
return false if Yast::WFM.Args.empty?
return false unless Yast::Ops.is_path?(Yast::WFM.Args.first)
return false unless Yast::WFM.Args.first == path('.propose')
return false unless Yast::WFM.Args.first == path(".propose")

log.info 'Using PROPOSE mode'
log.info "Using PROPOSE mode"
true
end
end
Expand Down

0 comments on commit da87d63

Please sign in to comment.