Skip to content

Commit

Permalink
Merge pull request #272 from nysthee/fix/rubocop-mitigations
Browse files Browse the repository at this point in the history
Fix/rubocop mitigations
  • Loading branch information
mroth committed Apr 12, 2015
2 parents 7598ce0 + 81f3fb6 commit 713adb7
Show file tree
Hide file tree
Showing 31 changed files with 346 additions and 542 deletions.
180 changes: 16 additions & 164 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -1,205 +1,57 @@
# This configuration was generated by `rubocop --auto-gen-config`
# on 2014-12-09 17:12:22 +0000 using RuboCop version 0.27.1.
# on 2015-04-12 19:24:55 +0200 using RuboCop version 0.30.0.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
# versions of RuboCop, may require this file to be generated again.

# Offense count: 22
Lint/AmbiguousRegexpLiteral:
Enabled: false

# Offense count: 8
# Cop supports --auto-correct.
Lint/DeprecatedClassMethods:
Enabled: false

# Offense count: 2
# Cop supports --auto-correct.
Lint/StringConversionInInterpolation:
Enabled: false

# Offense count: 1
# Cop supports --auto-correct.
Lint/UnusedMethodArgument:
Enabled: false

# Offense count: 1
Lint/UselessAccessModifier:
Enabled: false

# Offense count: 2
Lint/UselessAssignment:
Enabled: false

# Offense count: 23
Metrics/AbcSize:
Max: 59
Max: 38

# Offense count: 2
# Configuration parameters: CountComments.
Metrics/ClassLength:
Max: 184

Performance/Sample:
Enabled: false
Max: 127

# Offense count: 6
# Offense count: 5
Metrics/CyclomaticComplexity:
Max: 10
Max: 9

# Offense count: 101
# Offense count: 92
# Configuration parameters: AllowURI, URISchemes.
Metrics/LineLength:
Max: 157

# Offense count: 26
# Offense count: 24
# Configuration parameters: CountComments.
Metrics/MethodLength:
Max: 32
Max: 31

# Offense count: 5
# Offense count: 4
Metrics/PerceivedComplexity:
Max: 11

# Offense count: 3
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
Style/BarePercentLiterals:
Enabled: false

# Offense count: 1
Style/CaseEquality:
Enabled: false

# Offense count: 1
# Configuration parameters: IndentWhenRelativeTo, SupportedStyles, IndentOneStep.
Style/CaseIndentation:
Enabled: false

# Offense count: 25
Style/Documentation:
Enabled: false

# Offense count: 1
Style/DoubleNegation:
Enabled: false

# Offense count: 1
# Cop supports --auto-correct.
Style/EmptyLines:
Enabled: false

# Offense count: 1
# Configuration parameters: EnforcedStyle, SupportedStyles.
Style/FormatString:
Enabled: false

# Offense count: 4
# Configuration parameters: AllowedVariables.
Style/GlobalVars:
Enabled: false

# Offense count: 10
# Configuration parameters: MinBodyLength.
Style/GuardClause:
Performance/Sample:
Enabled: false

# Offense count: 12
# Configuration parameters: MaxLineLength.
Style/IfUnlessModifier:
Enabled: false

# Offense count: 1
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
Style/IndentHash:
Enabled: true

# Offense count: 13
# Cop supports --auto-correct.
Style/LeadingCommentSpace:
Enabled: false

# Offense count: 7
# Cop supports --auto-correct.
Style/NegatedIf:
Enabled: false

# Offense count: 7
# Cop supports --auto-correct.
Style/Not:
Enabled: false

# Offense count: 1
Style/OneLineConditional:
Enabled: false

# Offense count: 79
# Cop supports --auto-correct.
# Configuration parameters: PreferredDelimiters.
Style/PercentLiteralDelimiters:
Enabled: false

# Offense count: 3
# Cop supports --auto-correct.
Style/Proc:
Enabled: false

# Offense count: 1
# Cop supports --auto-correct.
Style/RedundantBegin:
Enabled: false

# Offense count: 76
# Cop supports --auto-correct.
Style/RedundantSelf:
Enabled: false

# Offense count: 1
Style/RegexpLiteral:
Enabled: false

# Offense count: 1
# Cop supports --auto-correct.
Style/SingleSpaceBeforeFirstArg:
Enabled: false

# Offense count: 2
# Cop supports --auto-correct.
Style/SpaceAfterComma:
Style/BarePercentLiterals:
Enabled: false

# Offense count: 1
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
Style/SpaceBeforeBlockBraces:
Enabled: false

# Offense count: 5
# Cop supports --auto-correct.
Style/SpaceInsideParens:
Style/CaseEquality:
Enabled: false

# Offense count: 1
# Cop supports --auto-correct.
Style/SpecialGlobalVars:
Enabled: false

# Offense count: 15
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
Style/StringLiterals:
# Configuration parameters: IndentWhenRelativeTo, SupportedStyles, IndentOneStep.
Style/CaseIndentation:
Enabled: false

# Offense count: 1
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
Style/StringLiteralsInInterpolation:
# Offense count: 28
Style/Documentation:
Enabled: false

# Offense count: 4
# Cop supports --auto-correct.
# Configuration parameters: WordRegex.
Style/WordArray:
MinSize: 3
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
source "https://rubygems.org"
source 'https://rubygems.org'

# Specify gem dependencies in lolcommits.gemspec
gemspec
54 changes: 23 additions & 31 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,15 @@ CUKE_RESULTS = 'results.html'
CLEAN << CUKE_RESULTS
Cucumber::Rake::Task.new(:features) do |t|
optstr = "features --format html -o #{CUKE_RESULTS} --format Fivemat -x"
optstr << " --tags @#{ENV["tag"]}" unless ENV["tag"].nil?
optstr << " --tags ~@unstable" if ENV["tag"].nil? #ignore unstable tests unless specifying something at CLI
optstr << " --tags @#{ENV['tag']}" unless ENV['tag'].nil?
optstr << ' --tags ~@unstable' if ENV['tag'].nil? # ignore unstable tests unless specifying something at CLI
t.cucumber_opts = optstr
t.fork = false
end

Rake::RDocTask.new do |rd|
rd.main = "README.rdoc"
rd.rdoc_files.include("README.rdoc","lib/**/*.rb","bin/**/*")
rd.main = 'README.rdoc'
rd.rdoc_files.include('README.rdoc', 'lib/**/*.rb', 'bin/**/*')
end

# only run rubocop on platforms where it is supported, sigh
Expand All @@ -56,32 +56,24 @@ else
task :default => [:test, :features]
end


desc "Migrate an existing local .lolcommits directory to Dropbox"
desc 'Migrate an existing local .lolcommits directory to Dropbox'
task :dropboxify do
$home = ENV['HOME']
dropbox_loldir = "#{$home}/Dropbox/lolcommits"
loldir = "#{$home}/.lolcommits"
backup_loldir = "#{$home}/.lolcommits.old"

#check whether we've done this already
if File.symlink? loldir
abort "already dropboxified!"
end

#create dropbox folder
if not File.directory? dropbox_loldir
FileUtils.mkdir_p dropbox_loldir
end

#backup existing loldir
if File.directory? loldir
FileUtils.mv( loldir, backup_loldir )
end

#symlink dropbox to local
FileUtils.ln_s( dropbox_loldir, loldir )

#copy over existing files
FileUtils.cp_r( "#{backup_loldir}/.", loldir)
dropbox_loldir = "#{ENV['HOME']}/Dropbox/lolcommits"
loldir = "#{ENV['HOME']}/.lolcommits"
backup_loldir = "#{ENV['HOME']}/.lolcommits.old"

# check whether we've done this already
abort 'already dropboxified!' if File.symlink? loldir

# create dropbox folder
FileUtils.mkdir_p dropbox_loldir unless File.directory? dropbox_loldir

# backup existing loldir
FileUtils.mv(loldir, backup_loldir) if File.directory? loldir

# symlink dropbox to local
FileUtils.ln_s(dropbox_loldir, loldir)

# copy over existing files
FileUtils.cp_r("#{backup_loldir}/.", loldir)
end
16 changes: 6 additions & 10 deletions bin/lolcommits
Original file line number Diff line number Diff line change
Expand Up @@ -54,17 +54,14 @@ end
#
# @return [Integer, String, nil]
def capture_animate
if Platform.can_animate?
Choice.choices[:animate] || ENV['LOLCOMMITS_ANIMATE'] || nil
end
return unless Platform.can_animate?
Choice.choices[:animate] || ENV['LOLCOMMITS_ANIMATE'] || nil
end

def default_device
result = Choice.choices[:device] || ENV['LOLCOMMITS_DEVICE']

if Platform.platform_linux?
result ||= Dir.glob('/dev/video*').first
end
result ||= Dir.glob('/dev/video*').first if Platform.platform_linux?

result
end
Expand Down Expand Up @@ -202,7 +199,7 @@ Choice.options do

option :show_config do
short '-sc'
long '--show-config'
long '--show-config'
desc 'display configuration file'
end

Expand Down Expand Up @@ -314,11 +311,10 @@ change_dir_to_root_or_repo!
#
load_local_plugins!


#
# Handle actions manually since choice seems weird
#
if not (Choice.choices[:enable] || Choice.choices[:disable])
if !Choice.choices[:enable] || !Choice.choices[:disable]
if Choice.choices[:capture]
do_capture
elsif Choice.choices[:configure]
Expand All @@ -330,7 +326,7 @@ if not (Choice.choices[:enable] || Choice.choices[:disable])
elsif Choice.choices[:devices]
puts Platform.device_list
puts "Specify a device with --device=\"{device name}\" "\
"or set the LOLCOMMITS_DEVICE env variable"
'or set the LOLCOMMITS_DEVICE env variable'
elsif Choice.choices[:last]
do_last
elsif Choice.choices[:browse]
Expand Down
Loading

0 comments on commit 713adb7

Please sign in to comment.