Skip to content

Commit

Permalink
Linting
Browse files Browse the repository at this point in the history
  • Loading branch information
schneems committed Dec 11, 2024
1 parent c5e6b81 commit 722694c
Show file tree
Hide file tree
Showing 8 changed files with 8 additions and 12 deletions.
2 changes: 1 addition & 1 deletion lib/rundoc/code_command/file_command/append.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def initialize(filename)
def to_md(env)
return unless render_command?

if env[:commands].any? {|c| c[:object].not_hidden? }
if env[:commands].any? { |c| c[:object].not_hidden? }
raise "Must call append in its own code section"
end

Expand Down
2 changes: 1 addition & 1 deletion lib/rundoc/code_command/file_command/remove.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ def initialize(filename)
end

def to_md(env)
if env[:commands].any? {|c| c[:object].not_hidden? }
if env[:commands].any? { |c| c[:object].not_hidden? }
raise "Must call remove in its own code section"
end

Expand Down
2 changes: 1 addition & 1 deletion lib/rundoc/code_command/pre/erb.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require_relative "../print/erb.rb"
require_relative "../print/erb"

class Rundoc::CodeCommand
class PreErb < Rundoc::CodeCommand
Expand Down
1 change: 0 additions & 1 deletion lib/rundoc/code_command/print/erb.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ def empty_binding
end
end


class Rundoc::CodeCommand
RUNDOC_ERB_BINDINGS = Hash.new { |h, k| h[k] = EmptyBinding.create }
RUNDOC_DEFAULT_ERB_BINDING = "default"
Expand Down
2 changes: 1 addition & 1 deletion lib/rundoc/code_command/write.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def initialize(filename)

def to_md(env)
if render_command?
if env[:commands].any? {|c| c[:object].not_hidden? }
if env[:commands].any? { |c| c[:object].not_hidden? }
raise "must call write in its own code section"
end
env[:before] << "In file `#{filename}` write:"
Expand Down
2 changes: 1 addition & 1 deletion lib/rundoc/fenced_code_block.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def call
env[:context] = @context
env[:stack] = @stack

while code_command = @stack.pop
while (code_command = @stack.pop)
code_output = code_command.call(env) || ""
code_line = code_command.to_md(env) || ""
result << code_line if code_command.render_command?
Expand Down
2 changes: 0 additions & 2 deletions test/integration/pre_erb_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ def test_file_write

Dir.mktmpdir do |dir|
Dir.chdir(dir) do
env = {}
expected = <<~EOF
In file `lol.txt` write:
Expand Down Expand Up @@ -41,7 +40,6 @@ def test_erb_shared_binding_persists_values

Dir.mktmpdir do |dir|
Dir.chdir(dir) do
env = {}
expected = <<~EOF
```
$ echo #{key}
Expand Down
7 changes: 3 additions & 4 deletions test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,11 @@ def default_context(
source_path: nil,
screenshots_dirname: nil
)

Rundoc::Context::Execution.new(
output_dir: output_dir || Pathname("/dev/null"),
source_path: source_path || Pathname("/dev/null"),
output_dir: output_dir || Pathname(File::NULL),
source_path: source_path || Pathname(File::NULL),
with_contents_dir: nil,
screenshots_dirname: screenshots_dirname || Pathname("/dev/null")
screenshots_dirname: screenshots_dirname || Pathname(File::NULL)
)
end

Expand Down

0 comments on commit 722694c

Please sign in to comment.