Skip to content

Commit

Permalink
Merge pull request #115 from DavidS/rubocop-fixes
Browse files Browse the repository at this point in the history
Rubocop fixes
  • Loading branch information
domcleal authored Apr 28, 2017
2 parents 5d5be63 + 02f88d3 commit 2185419
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 6 deletions.
4 changes: 4 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,7 @@ Style/HashSyntax:
# dealbreaker:
Style/TrailingCommaInLiteral:
Enabled: false

# would require external library
Style/IndentHeredoc:
Enabled: false
2 changes: 1 addition & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ Cucumber::Rake::Task.new do |t|
t.cucumber_opts << '--format pretty'
end

task :test => [:clean, :spec, :cucumber, :rubocop]
task :test => %i[clean spec cucumber rubocop]
4 changes: 2 additions & 2 deletions lib/modulesync.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def self.managed_modules(path, filter, negative_filter)
exit
end
managed_modules.select! { |m| m =~ Regexp.new(filter) } unless filter.nil?
managed_modules.select! { |m| m !~ Regexp.new(negative_filter) } unless negative_filter.nil?
managed_modules.reject! { |m| m =~ Regexp.new(negative_filter) } unless negative_filter.nil?
managed_modules
end

Expand Down Expand Up @@ -89,7 +89,7 @@ def self.manage_file(filename, settings, options)

def self.manage_module(puppet_module, module_files, module_options, defaults, options)
puts "Syncing #{puppet_module}"
namespace, module_name = self.module_name(puppet_module, options[:namespace])
namespace, module_name = module_name(puppet_module, options[:namespace])
unless options[:offline]
git_base = options[:git_base]
git_uri = "#{git_base}#{namespace}"
Expand Down
2 changes: 1 addition & 1 deletion lib/modulesync/git.rb
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ def self.update(name, files, options)
def self.untracked_unignored_files(repo)
ignore_path = "#{repo.dir.path}/.gitignore"
ignored = File.exist?(ignore_path) ? File.open(ignore_path).read.split : []
repo.status.untracked.keep_if { |f, _| !ignored.any? { |i| File.fnmatch(i, f) } }
repo.status.untracked.keep_if { |f, _| ignored.none? { |i| File.fnmatch(i, f) } }
end

def self.update_noop(name, options)
Expand Down
1 change: 1 addition & 0 deletions modulesync.gemspec
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# coding: utf-8

lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)

Expand Down
4 changes: 2 additions & 2 deletions spec/unit/modulesync/settings_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
it { expect(subject.managed?('Gemfile')).to eq true }
it { expect(subject.managed?('Gemfile/foo')).to eq true }
it { expect(subject.managed_files([])).to eq ['Gemfile'] }
it { expect(subject.managed_files(%w(Rakefile Gemfile other_file))).to eq %w(Gemfile other_file) }
it { expect(subject.managed_files(%w[Rakefile Gemfile other_file])).to eq %w[Gemfile other_file] }
it { expect(subject.unmanaged_files([])).to eq ['Rakefile'] }
it { expect(subject.unmanaged_files(%w(Rakefile Gemfile other_file))).to eq ['Rakefile'] }
it { expect(subject.unmanaged_files(%w[Rakefile Gemfile other_file])).to eq ['Rakefile'] }
end

0 comments on commit 2185419

Please sign in to comment.