Skip to content

Commit

Permalink
Fixed Style/MutableConstant
Browse files Browse the repository at this point in the history
  • Loading branch information
lslezak committed Jun 9, 2016
1 parent 0679991 commit a8def0f
Show file tree
Hide file tree
Showing 35 changed files with 89 additions and 89 deletions.
2 changes: 1 addition & 1 deletion library/general/src/modules/Hooks.rb
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ def create(hook_name, source_file)
end

class SearchPath
DEFAULT_DIR = "/var/lib/YaST2/hooks"
DEFAULT_DIR = "/var/lib/YaST2/hooks".freeze

attr_reader :path

Expand Down
2 changes: 1 addition & 1 deletion library/general/src/modules/Linuxrc.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ module Yast
class LinuxrcClass < Module
# Disables filesystem snapshots (fate#317973)
# Possible values: all, post, pre, single
DISABLE_SNAPSHOTS = "disable_snapshots"
DISABLE_SNAPSHOTS = "disable_snapshots".freeze

def main
Yast.import "Mode"
Expand Down
2 changes: 1 addition & 1 deletion library/general/src/modules/OSRelease.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def initialize
textdomain "base"
end

OS_RELEASE_PATH = "/etc/os-release"
OS_RELEASE_PATH = "/etc/os-release".freeze

# Get information about the OS release
# Throws exception Yast::OSReleaseFileMissingError if release file
Expand Down
4 changes: 2 additions & 2 deletions library/general/test/asciifile_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ def stub_file_reading(filename, contents)

describe "AsciiFile" do
context "when working with a fstab file" do
FSTAB_FILENAME = "/etc/fstab"
FSTAB_CONTENTS = <<EOS
FSTAB_FILENAME = "/etc/fstab".freeze
FSTAB_CONTENTS = <<EOS.freeze
UUID=001c0d61-e99f-4ab7-ba4b-bda6f54a052d / btrfs defaults 0 0
# NFS
192.168.1.1:/ /mnt nfs4 rw 0 0
Expand Down
2 changes: 1 addition & 1 deletion library/general/test/linuxrc_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"XkbRules" => "xfree86",
"XkbModel" => "pc104",
"umount_result" => "0"
}
}.freeze

def load_install_inf(defaults_replacement = {})
# Default value
Expand Down
2 changes: 1 addition & 1 deletion library/network/src/lib/network/firewalld.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class FWCmd

BASH_SCR_PATH = Yast::Path.new(".target.bash_output")
# Base firewall-cmd command
COMMAND = "LANG=C firewall-cmd"
COMMAND = "LANG=C firewall-cmd".freeze

attr_reader :option_str

Expand Down
2 changes: 1 addition & 1 deletion library/network/src/lib/network/susefirewall2.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ module Yast
# SuSEFirewall2/SF2 Class. The original, simply created from the Firewall
# factory class.
class SuSEFirewall2Class < SuSEFirewallClass
CONFIG_FILE = "/etc/sysconfig/SuSEfirewall2"
CONFIG_FILE = "/etc/sysconfig/SuSEfirewall2".freeze

include Yast::Logger

Expand Down
14 changes: 7 additions & 7 deletions library/network/src/lib/network/susefirewall2services.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,19 +38,19 @@ class SuSEFirewall2ServicesClass < SuSEFirewallServicesClass
include Yast::Logger

# this is how services defined by package are distinguished
DEFINED_BY_PKG_PREFIX = "service:"
DEFINED_BY_PKG_PREFIX = "service:".freeze

SERVICES_DIR = "/etc/sysconfig/SuSEfirewall2.d/services/"
SERVICES_DIR = "/etc/sysconfig/SuSEfirewall2.d/services/".freeze

# please, check it with configuration in refresh-srv-def-by-pkgs-trans.sh script
SERVICES_TEXTDOMAIN = "firewall-services"
SERVICES_TEXTDOMAIN = "firewall-services".freeze

READ_ONLY_SERVICE_FEATURES = ["name", "description"]
READ_ONLY_SERVICE_FEATURES = ["name", "description"].freeze

IGNORED_SERVICES = ["TEMPLATE", "..", "."]
IGNORED_SERVICES = ["TEMPLATE", "..", "."].freeze

TEMPLATE_SERVICE_NAME = "template service"
TEMPLATE_SERVICE_DESCRIPTION = "opens ports for foo in order to allow bar"
TEMPLATE_SERVICE_NAME = "template service".freeze
TEMPLATE_SERVICE_DESCRIPTION = "opens ports for foo in order to allow bar".freeze

def main
textdomain "base"
Expand Down
6 changes: 3 additions & 3 deletions library/network/src/lib/network/susefirewalld.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ class SuSEFirewalldClass < SuSEFirewallClass
# :ports = [Array<String>]
# :protocols = [Array<String>]
# :services = [Array<String>]
ZONE_ATTRIBUTES = [:interfaces, :masquerade, :modified, :ports, :protocols, :services]
ZONE_ATTRIBUTES = [:interfaces, :masquerade, :modified, :ports, :protocols, :services].freeze
# {enable,start}_firewall are "inherited" from SF2 so we can't use symbols
# there without having to change all the SF2 callers.
KEY_SETTINGS = ["enable_firewall", "logging", "routing", "start_firewall"]
KEY_SETTINGS = ["enable_firewall", "logging", "routing", "start_firewall"].freeze

EMPTY_ZONE = {
interfaces: [],
Expand All @@ -61,7 +61,7 @@ class SuSEFirewalldClass < SuSEFirewallClass
ports: [],
protocols: [],
services: []
}
}.freeze

# We need that for the tests. Nothing else should access the API
# directly
Expand Down
4 changes: 2 additions & 2 deletions library/network/src/lib/network/susefirewalldservices.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ module Yast
class SuSEFirewalldServicesClass < SuSEFirewallServicesClass
include Yast::Logger

SERVICES_DIR = ["/etc/firewalld/services", "/usr/lib/firewalld/services"]
SERVICES_DIR = ["/etc/firewalld/services", "/usr/lib/firewalld/services"].freeze

IGNORED_SERVICES = ["..", "."]
IGNORED_SERVICES = ["..", "."].freeze

def initialize
@services = nil
Expand Down
2 changes: 1 addition & 1 deletion library/network/src/lib/network/susefirewallservices.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class SuSEFirewallServicesClass < Module
"broadcast_ports" => [],
"name" => "",
"description" => ""
}
}.freeze

# Function returns the map of supported (known) services.
#
Expand Down
14 changes: 7 additions & 7 deletions library/network/src/modules/NetworkInterfaces.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ class NetworkInterfacesClass < Module
Yast.import "String"

# A single character used to separate alias id
ALIAS_SEPARATOR = "#"
TYPE_REGEX = "(ip6tnl|mip6mnha|[#{String.CAlpha}]+)"
ID_REGEX = "([^#{ALIAS_SEPARATOR}]*)"
ALIAS_REGEX = "(.*)"
DEVNAME_REGEX = "#{TYPE_REGEX}-?#{ID_REGEX}"
ALIAS_SEPARATOR = "#".freeze
TYPE_REGEX = "(ip6tnl|mip6mnha|[#{String.CAlpha}]+)".freeze
ID_REGEX = "([^#{ALIAS_SEPARATOR}]*)".freeze
ALIAS_REGEX = "(.*)".freeze
DEVNAME_REGEX = "#{TYPE_REGEX}-?#{ID_REGEX}".freeze
# Supported hotplug types
HOTPLUG_TYPES = ["pcmcia", "usb"]
HOTPLUG_TYPES = ["pcmcia", "usb"].freeze

# @attribute Name
# @return [String]
Expand Down Expand Up @@ -691,7 +691,7 @@ def ConcealSecrets(devs)
"SCOPE",
"LABEL",
"IP_OPTIONS"
]
].freeze

# Read devices from files
# @return true if sucess
Expand Down
8 changes: 4 additions & 4 deletions library/network/src/modules/NetworkService.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,19 +54,19 @@ class NetworkServiceClass < Module
netconfig: "network",
network_manager: "NetworkManager",
wicked: "wicked"
}
}.freeze

# network backend identification to its rpm package name mapping
BACKEND_PKG_NAMES = {
# <internal-id> <service name>
netconfig: "sysconfig-network",
network_manager: "NetworkManager",
wicked: "wicked"
}
}.freeze

SYSTEMCTL = "/bin/systemctl"
SYSTEMCTL = "/bin/systemctl".freeze

WICKED = "/usr/sbin/wicked"
WICKED = "/usr/sbin/wicked".freeze

DEFAULT_BACKEND = :wicked

Expand Down
2 changes: 1 addition & 1 deletion library/network/src/modules/SuSEFirewall.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class FirewallClass < Module
FIREWALL_BACKENDS = {
sf2: "SuSEfirewall2",
fwd: "firewalld"
}
}.freeze

# Check if backend is installed on the system.
#
Expand Down
2 changes: 1 addition & 1 deletion library/network/test/load_ipv6_cfg_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
data: { "IPADDR" => "2a00:8a00:6000:40::451", "PREFIXLEN" => "119" },
expected: { "IPADDR" => "2a00:8a00:6000:40::451", "PREFIXLEN" => "119", "NETMASK" => "" }
}
]
].freeze

describe Yast::NetworkInterfaces do
context "Handling IPv6 address" do
Expand Down
2 changes: 1 addition & 1 deletion library/network/test/network_interfaces_helpers_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ module Yast
alias_id: "0",
type_by_regex: "enp"
}
]
].freeze

DEVICE_DESCS.each do |device_desc|
device_name = device_desc[:name]
Expand Down
4 changes: 2 additions & 2 deletions library/network/test/susefirewalld_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ def reset_FirewallDIsInstalled_cache
services: ["dns"],
protocols: ["ah"]
}
}
}.freeze

BAD_FAKE_FIREWALLD_CONFIG = {
"dmz" => {
Expand All @@ -163,7 +163,7 @@ def reset_FirewallDIsInstalled_cache
services: ["foobar"],
interfaces: ["eth3"]
}
}
}.freeze
FULL_FAKE_FIREWALLD_CONFIG = GOOD_FAKE_FIREWALLD_CONFIG.merge(BAD_FAKE_FIREWALLD_CONFIG)

context "when verifying its basic configuration" do
Expand Down
2 changes: 1 addition & 1 deletion library/packages/src/lib/packages/repository.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class Repository

# Repository schemes considered local (see #local?)
# https://github.com/openSUSE/libzypp/blob/a7a038aeda1ad6d9e441e7d3755612aa83320dce/zypp/Url.cc#L458
LOCAL_SCHEMES = [:cd, :dvd, :dir, :hd, :iso, :file]
LOCAL_SCHEMES = [:cd, :dvd, :dir, :hd, :iso, :file].freeze

# @return [Fixnum] Repository ID
attr_reader :repo_id
Expand Down
2 changes: 1 addition & 1 deletion library/packages/src/modules/PackageCallbacks.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class PackageCallbacksClass < Module
# max. retry timeout (15 minutes)
RETRY_MAX_TIMEOUT = 15 * 60
# symbols for ticking in cmd line
TICK_LABELS = ["/", "-", "\\", "|"]
TICK_LABELS = ["/", "-", "\\", "|"].freeze

def main
Yast.import "Pkg"
Expand Down
4 changes: 2 additions & 2 deletions library/packages/src/modules/Product.rb
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,12 @@ def find_property(key = __callee__)
# Values loaded from os-release file
OS_RELEASE_PROPERTIES = [
:name, :short_name, :version
]
].freeze

# All these methods have been dropped
DROPPED_METHODS = [
:vendor, :dist, :distproduct, :distversion, :shortlabel
]
].freeze

# Returns list Hashes of selected (installation) or installed (running system)
# base products got from libzypp
Expand Down
2 changes: 1 addition & 1 deletion library/packages/test/lib/product_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
BASE_ATTRS = {
name: "openSUSE", version: "20160405", arch: "x86_64",
category: "addon", status: :installed, vendor: "openSUSE"
}
}.freeze

subject(:product) do
Packages::Product.new(BASE_ATTRS)
Expand Down
4 changes: 2 additions & 2 deletions library/packages/test/product_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -278,10 +278,10 @@ def stub_defaults
end

# Methods that do not allow empty result
SUPPORTED_METHODS = [:name, :short_name, :version, :run_you, :flags, :relnotesurl]
SUPPORTED_METHODS = [:name, :short_name, :version, :run_you, :flags, :relnotesurl].freeze

# Empty result is allowed
SUPPORTED_METHODS_ALLOWED_EMPTY = [:relnotesurl_all, :product_of_relnotes]
SUPPORTED_METHODS_ALLOWED_EMPTY = [:relnotesurl_all, :product_of_relnotes].freeze

context "while called on a broken system (no os-release, no zypp information)" do
before(:each) do
Expand Down
8 changes: 4 additions & 4 deletions library/system/src/lib/yast2/fs_snapshot.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,13 @@ class FsSnapshot

Yast.import "Linuxrc"

FIND_CONFIG_CMD = "/usr/bin/snapper --no-dbus --root=%{root} list-configs | grep \"^root \" >/dev/null"
CREATE_SNAPSHOT_CMD = "/usr/lib/snapper/installation-helper --step 5 --root-prefix=%{root} --snapshot-type %{snapshot_type} --description \"%{description}\""
LIST_SNAPSHOTS_CMD = "LANG=en_US.UTF-8 /usr/bin/snapper --no-dbus --root=%{root} list"
FIND_CONFIG_CMD = "/usr/bin/snapper --no-dbus --root=%{root} list-configs | grep \"^root \" >/dev/null".freeze
CREATE_SNAPSHOT_CMD = "/usr/lib/snapper/installation-helper --step 5 --root-prefix=%{root} --snapshot-type %{snapshot_type} --description \"%{description}\"".freeze
LIST_SNAPSHOTS_CMD = "LANG=en_US.UTF-8 /usr/bin/snapper --no-dbus --root=%{root} list".freeze
VALID_LINE_REGEX = /\A\w+\s+\| \d+/

# Predefined snapshot cleanup strategies (the user can define custom ones, too)
CLEANUP_STRATEGY = { number: "number", timeline: "timeline" }
CLEANUP_STRATEGY = { number: "number", timeline: "timeline" }.freeze

attr_reader :number, :snapshot_type, :previous_number, :timestamp, :user,
:cleanup_algo, :description
Expand Down
4 changes: 2 additions & 2 deletions library/system/src/modules/Kernel.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@
module Yast
class KernelClass < Module
# default configuration file for Kernel modules loaded on boot
MODULES_CONF_FILE = "yast.conf"
MODULES_CONF_FILE = "yast.conf".freeze

# directory where configuration for Kernel modules loaded on boot is stored
MODULES_DIR = "/etc/modules-load.d/"
MODULES_DIR = "/etc/modules-load.d/".freeze

# SCR path for reading/writing Kernel modules
MODULES_SCR = Path.new(".kernel_modules_to_load")
Expand Down
16 changes: 8 additions & 8 deletions library/system/test/fs_snapshot_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ def logger
described_class.log
end

FIND_CONFIG = "/usr/bin/snapper --no-dbus --root=/ list-configs | grep \"^root \" >/dev/null"
FIND_IN_ROOT_CONFIG = "/usr/bin/snapper --no-dbus --root=/mnt list-configs | grep \"^root \" >/dev/null"
LIST_SNAPSHOTS = "LANG=en_US.UTF-8 /usr/bin/snapper --no-dbus --root=/ list"
FIND_CONFIG = "/usr/bin/snapper --no-dbus --root=/ list-configs | grep \"^root \" >/dev/null".freeze
FIND_IN_ROOT_CONFIG = "/usr/bin/snapper --no-dbus --root=/mnt list-configs | grep \"^root \" >/dev/null".freeze
LIST_SNAPSHOTS = "LANG=en_US.UTF-8 /usr/bin/snapper --no-dbus --root=/ list".freeze

let(:dummy_snapshot) { double("snapshot") }

Expand Down Expand Up @@ -69,9 +69,9 @@ def logger

describe ".create_single" do
CREATE_SINGLE_SNAPSHOT = "/usr/lib/snapper/installation-helper --step 5 "\
"--root-prefix=/ --snapshot-type single --description \"some-description\""
OPTION_CLEANUP_NUMBER = " --cleanup \"number\""
OPTION_IMPORTANT = " --userdata \"important=yes\""
"--root-prefix=/ --snapshot-type single --description \"some-description\"".freeze
OPTION_CLEANUP_NUMBER = " --cleanup \"number\"".freeze
OPTION_IMPORTANT = " --userdata \"important=yes\"".freeze

before do
allow(Yast2::FsSnapshot).to receive(:configured?).and_return(configured)
Expand Down Expand Up @@ -169,7 +169,7 @@ def logger

describe ".create_pre" do
CREATE_PRE_SNAPSHOT = "/usr/lib/snapper/installation-helper --step 5 "\
"--root-prefix=/ --snapshot-type pre --description \"some-description\""
"--root-prefix=/ --snapshot-type pre --description \"some-description\"".freeze

before do
allow(Yast2::FsSnapshot).to receive(:configured?).and_return(configured)
Expand Down Expand Up @@ -268,7 +268,7 @@ def logger
describe ".create_post" do
CREATE_POST_SNAPSHOT = "/usr/lib/snapper/installation-helper --step 5 "\
"--root-prefix=/ --snapshot-type post --description \"some-description\" "\
"--pre-num 2"
"--pre-num 2".freeze

before do
allow(Yast2::FsSnapshot).to receive(:configured?).and_return(configured)
Expand Down
6 changes: 3 additions & 3 deletions library/systemd/src/lib/yast2/systemctl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ def initialize(struct)
module Systemctl
include Yast::Logger

CONTROL = "systemctl"
COMMAND_OPTIONS = " --no-legend --no-pager --no-ask-password "
ENV_VARS = " LANG=C TERM=dumb COLUMNS=1024 "
CONTROL = "systemctl".freeze
COMMAND_OPTIONS = " --no-legend --no-pager --no-ask-password ".freeze
ENV_VARS = " LANG=C TERM=dumb COLUMNS=1024 ".freeze
SYSTEMCTL = ENV_VARS + CONTROL + COMMAND_OPTIONS
TIMEOUT = 30 # seconds

Expand Down
6 changes: 3 additions & 3 deletions library/systemd/src/lib/yast2/systemd_unit.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ class SystemdUnit
Yast.import "Stage"
include Yast::Logger

SUPPORTED_TYPES = %w( service socket target )
SUPPORTED_STATES = %w( enabled disabled )
SUPPORTED_TYPES = %w( service socket target ).freeze
SUPPORTED_STATES = %w( enabled disabled ).freeze

DEFAULT_PROPERTIES = {
id: "Id",
Expand All @@ -46,7 +46,7 @@ class SystemdUnit
sub_state: "SubState",
unit_file_state: "UnitFileState",
path: "FragmentPath"
}
}.freeze

extend Forwardable

Expand Down
Loading

0 comments on commit a8def0f

Please sign in to comment.