Skip to content

Commit

Permalink
make numberic literals more readable
Browse files Browse the repository at this point in the history
  • Loading branch information
jreidinger committed Jan 14, 2015
1 parent e0913ac commit f284b25
Show file tree
Hide file tree
Showing 14 changed files with 169 additions and 174 deletions.
5 changes: 0 additions & 5 deletions .rubocop.yml
Expand Up @@ -82,11 +82,6 @@ Style/FileName:
Style/MethodName:
Enabled: false

# Offense count: 170
# Cop supports --auto-correct.
Style/NumericLiterals:
MinDigits: 17

# Offense count: 1
# Cop supports --auto-correct.
Style/PerlBackrefs:
Expand Down
2 changes: 1 addition & 1 deletion library/cwm/src/modules/CWM.rb
Expand Up @@ -569,7 +569,7 @@ def prepareWidget(widget_descr)
)
elsif widget == :intfield
min = Ops.get_integer(w, "minimum", 0)
max = Ops.get_integer(w, "maximum", 2147483647)
max = Ops.get_integer(w, "maximum", 2_147_483_647)

This comment has been minimized.

Copy link
@lslezak

lslezak Jan 15, 2015

Member

Maybe an expression form, like 2 * 2**30 - 1 would be better in this case...

This comment has been minimized.

Copy link
@jreidinger

jreidinger Jan 16, 2015

Author Member

ugh, then I propose to have 2**31 - 1 with comment that libyui use signed integer?

This comment has been minimized.

Copy link
@jreidinger

jreidinger Jan 16, 2015

Author Member

fixed in 47932a6

Ops.set(
w,
"widget",
Expand Down
2 changes: 1 addition & 1 deletion library/general/src/modules/Misc.rb
Expand Up @@ -260,7 +260,7 @@ def RunCommandWithTimeout(run_command, log_command, script_time_out)
SCR.Read(path(".process.running"), processID)
)
# debugging #165821
if Ops.modulo(time_spent, 100000) == 0
if Ops.modulo(time_spent, 100_000) == 0
Builtins.y2milestone("running: %1", running)
flag = "/tmp/SourceManagerTimeout"
if SCR.Read(path(".target.size"), flag) != -1
Expand Down
4 changes: 2 additions & 2 deletions library/general/test/agents_test/proc_meminfo_agent_test.rb
Expand Up @@ -24,12 +24,12 @@

it "returned hash contain memtotal key" do
content = Yast::SCR.Read(AGENT_PATH)
expect(content).to include("memtotal" => 1021032)
expect(content).to include("memtotal" => 1_021_032)
end

it "returned hash contain memfree key" do
content = Yast::SCR.Read(AGENT_PATH)
expect(content).to include("memfree" => 83408)
expect(content).to include("memfree" => 83_408)
end
end
end

0 comments on commit f284b25

Please sign in to comment.