Skip to content

Commit

Permalink
new rubocop: manual fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
jreidinger committed Dec 29, 2023
1 parent 4bc5880 commit 21390f0
Show file tree
Hide file tree
Showing 20 changed files with 39 additions and 12 deletions.
12 changes: 11 additions & 1 deletion .rubocop.yml
Expand Up @@ -3,17 +3,27 @@ inherit_from:
/usr/share/YaST2/data/devtools/data/rubocop-1.24.1_yast_style.yml

# Don't enforce any particular name for block params
SingleLineBlockParams:
Style/SingleLineBlockParams:
Enabled: false

Style/FrozenStringLiteralComment:
Enabled: false

Metrics/AbcSize:
Max: 40

Metrics/CyclomaticComplexity:
Max: 10

Metrics/BlockLength:
# rspec is known as DSL with big blocks
Exclude:
- test/**/*

# do not break API
Naming/MethodParameterName:
Enabled: false

AllCops:
Exclude:
- 'src/modules/**/*'
Expand Down
8 changes: 4 additions & 4 deletions src/lib/users/clients/auto.rb
Expand Up @@ -19,14 +19,13 @@

require "yast"
require "installation/auto_client"
require "y2issues"
require "y2users"
require "y2users/autoinst/reader"
require "y2issues"
require "y2users/config_merger"
require "y2users/config_manager"
require "y2users/autoinst/reader"
require "y2users/users_module/reader"
require "y2users/config_merger"
require "y2users/linux/writer"
require "y2users/users_module/reader"

Yast.import "Users"
Yast.import "Linuxrc"
Expand All @@ -41,6 +40,7 @@ module Clients
# AutoYaST users client
class Auto < ::Installation::AutoClient
def initialize
super
textdomain "users"

Yast.include self, "users/wizards.rb"
Expand Down
1 change: 1 addition & 0 deletions src/lib/users/clients/users_finish.rb
Expand Up @@ -37,6 +37,7 @@ class UsersFinishClient < ::Installation::FinishClient
include Logger

def initialize
super
textdomain "users"

Yast.import "Users"
Expand Down
1 change: 1 addition & 0 deletions src/lib/users/dialogs/inst_root_first.rb
Expand Up @@ -33,6 +33,7 @@ class InstRootFirstDialog < ::CWM::Dialog
#
# @param root_user [Y2Users::Users] object holding the root user configuration
def initialize(root_user)
super()
textdomain "users"

@root_user = root_user
Expand Down
1 change: 1 addition & 0 deletions src/lib/users/encryption_proposal.rb
Expand Up @@ -26,6 +26,7 @@ class EncryptionProposal < ::Installation::ProposalClient
include Yast::Logger

def initialize
super
Yast.import "Wizard"
textdomain "users"
end
Expand Down
1 change: 1 addition & 0 deletions src/lib/users/proposal.rb
Expand Up @@ -29,6 +29,7 @@ class Proposal < ::Installation::ProposalClient
include Yast::Logger

def initialize
super
Yast.import "Wizard"
Yast.import "Mode"
textdomain "users"
Expand Down
3 changes: 3 additions & 0 deletions src/lib/users/ssh_authorized_keys_file.rb
Expand Up @@ -100,9 +100,12 @@ def keys=(new_keys)
keys
end

# it is not our regexp
# rubocop:disable Lint/MixedRegexpCaptureTypes
# https://github.com/puppetlabs/puppet/blob/master/lib/puppet/type/ssh_authorized_key.rb#L138
AUTHORIZED_KEYS_REGEX =
/\A(?<env>(.+)\s+)?(?<type>(ssh|ecdsa)-\S+)\s+(?<key>[^ ]+)\s*(?<comment>.*)\z/.freeze
# rubocop:enable Lint/MixedRegexpCaptureTypes

# Determine is a string qualifies like a valid key
#
Expand Down
1 change: 1 addition & 0 deletions src/lib/users/widgets.rb
Expand Up @@ -51,6 +51,7 @@ class << self
# @param focus [Boolean] if set, then widget set focus to first password input field
# @param allow_empty [Boolean] whether the user can left the password empty or not
def initialize(user, little_space: false, focus: false, allow_empty: false)
super()
textdomain "users"

@user = user
Expand Down
1 change: 1 addition & 0 deletions src/lib/users/widgets/inst_root_first.rb
Expand Up @@ -31,6 +31,7 @@ class InstRootFirst < ::CWM::CustomWidget
#
# @param user [Y2Users::User] the root user to work with
def initialize(user)
super()
textdomain "users"

@user = user
Expand Down
1 change: 1 addition & 0 deletions src/lib/users/widgets/public_key_selector.rb
Expand Up @@ -40,6 +40,7 @@ class << self
#
# @param user [Y2Users::User] the user to work with
def initialize(user)
super()
textdomain "users"

@user = user
Expand Down
1 change: 1 addition & 0 deletions src/lib/y2users/autoinst_profile/groups_section.rb
Expand Up @@ -41,6 +41,7 @@ def new_from_hashes(hashes)
end

def initialize(groups = [])
super()
@groups = groups
end

Expand Down
1 change: 1 addition & 0 deletions src/lib/y2users/autoinst_profile/users_section.rb
Expand Up @@ -40,6 +40,7 @@ def new_from_hashes(hashes)
end

def initialize(users = [])
super()
@users = users
end

Expand Down
2 changes: 1 addition & 1 deletion src/lib/y2users/config_element_collection.rb
Expand Up @@ -26,7 +26,7 @@ class ConfigElementCollection < Collection
#
# @param elements [Array<ConfigElement>]
def initialize(elements = [])
@elements = elements
super
end

# Deletes the element with the given id from the collection
Expand Down
1 change: 1 addition & 0 deletions src/lib/y2users/linux/groups_writer.rb
Expand Up @@ -42,6 +42,7 @@ class GroupsWriter < ActionWriter
# @param initial_config [Config] see #initial_config
# @param commit_config [CommitConfig] see #commit_config
def initialize(target_config, initial_config, commit_config)
super()
textdomain "users"

@initial_config = initial_config
Expand Down
1 change: 1 addition & 0 deletions src/lib/y2users/linux/local_reader.rb
Expand Up @@ -27,6 +27,7 @@ class LocalReader < BaseReader
#
# @param source_dir [String, Pathname] path of source directory for reading files
def initialize(source_dir = "/")
super()
@source_dir = source_dir
end

Expand Down
1 change: 1 addition & 0 deletions src/lib/y2users/linux/users_writer.rb
Expand Up @@ -53,6 +53,7 @@ class UsersWriter < ActionWriter
# @param initial_config [Config] see #initial_config
# @param commit_config [CommitConfig]
def initialize(target_config, initial_config, commit_config)
super()
textdomain "users"

@initial_config = initial_config
Expand Down
1 change: 1 addition & 0 deletions src/lib/y2users/password.rb
Expand Up @@ -176,6 +176,7 @@ class PasswordValue < ShadowField
#
# @param content [String] password value
def initialize(content)
super()
self.content = content
end

Expand Down
1 change: 1 addition & 0 deletions test/dialogs_test.rb
Expand Up @@ -6,6 +6,7 @@

class UsersDialogsDummy < Yast::Module
def initialize
super
Yast.include self, "users/dialogs.rb"
end
end
Expand Down
9 changes: 6 additions & 3 deletions test/fixtures/users_export.rb
Expand Up @@ -273,7 +273,8 @@
"shell" => "/bin/bash",
"uid" => "1000",
"user_password" => "$6$Jn1sSsaWb5Jj$97bMFbWPGB5UgE/Vt7uuUMjLPIW4C" \
"7McyvXxkyltK/0GgW0Q7qG6F0eKeVLYziskSihzlakgXUG1gPRw/ZKw10",
"7McyvXxkyltK/0GgW0Q7qG6F0eKeVLYziskSihzlakgXU" \
"G1gPRw/ZKw10",
"username" => "tux" },
{ "authorized_keys" => [],
"encrypted" => true,
Expand Down Expand Up @@ -386,7 +387,8 @@
"shell" => "/bin/bash",
"uid" => "0",
"user_password" => "$6$ASfaLE9EGIam$Gk9YxWfX/EeB8sEv3qLYdHQXTx.9T" \
"1wNoyn5Y34PMZ03wh8S48QhbpjC8gUQvdFnbdH.4HqGeT3z5Y2zdlM11/",
"1wNoyn5Y34PMZ03wh8S48QhbpjC8gUQvdFnbdH.4HqGeT" \
"3z5Y2zdlM11/",
"username" => "root" },
{ "authorized_keys" => [],
"encrypted" => true,
Expand Down Expand Up @@ -547,7 +549,8 @@
"shell" => "/bin/bash",
"uid" => "0",
"user_password" => "$6$ASfaLE9EGIam$Gk9YxWfX/EeB8sEv3qLYdHQXTx.9T1" \
"wNoyn5Y34PMZ03wh8S48QhbpjC8gUQvdFnbdH.4HqGeT3z5Y2zdlM11/",
"wNoyn5Y34PMZ03wh8S48QhbpjC8gUQvdFnbdH.4HqGeT3z" \
"5Y2zdlM11/",
"username" => "toor" },
{ "authorized_keys" => [],
"encrypted" => true,
Expand Down
3 changes: 0 additions & 3 deletions test/lib/users/widgets/inst_root_first_test.rb
Expand Up @@ -52,9 +52,6 @@
end

context "when neither a password nor public key was given" do
before do
end

it "returns false" do
expect(widget.validate).to eq(false)
end
Expand Down

0 comments on commit 21390f0

Please sign in to comment.