-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
standardrb provides a relaxed set of linting rules that provide the benefits of a linter without the headaches that can come from the slightly excessive rubocop defaults. New rules we'd like to adopt can be enabled in `.rubocop.yml`, and similarly rules we don't want to adopt can be disabled in `.rubocop.yml`.
- Loading branch information
Showing
64 changed files
with
1,688 additions
and
1,389 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
## | ||
# Plugins | ||
require: | ||
- standard | ||
|
||
## | ||
# Defaults: standardrb | ||
inherit_gem: | ||
standard: config/base.yml | ||
|
||
## | ||
# Rules that break from standardrb defaults | ||
Style/StringLiterals: | ||
EnforcedStyle: single_quotes | ||
|
||
## | ||
# Disabled rules | ||
Lint/AssignmentInCondition: | ||
Enabled: false | ||
Lint/FloatComparison: | ||
Enabled: false | ||
Lint/ConstantDefinitionInBlock: | ||
Enabled: false | ||
Lint/EmptyWhen: | ||
Exclude: | ||
- "lib/webmachine/dispatcher/route.rb" | ||
Lint/DuplicateMethods: | ||
Exclude: | ||
- "lib/webmachine/application.rb" | ||
Lint/UnderscorePrefixedVariableName: | ||
Exclude: | ||
- "lib/webmachine/trace/resource_proxy.rb" | ||
- "spec/webmachine/dispatcher_spec.rb" | ||
Lint/NestedMethodDefinition: | ||
Exclude: | ||
- "spec/webmachine/decision/flow_spec.rb" | ||
Lint/RescueException: | ||
Exclude: | ||
- "spec/webmachine/decision/fsm_spec.rb" | ||
Lint/RaiseException: | ||
Exclude: | ||
- "spec/webmachine/decision/fsm_spec.rb" | ||
Style/MissingRespondToMissing: | ||
Exclude: | ||
- "lib/webmachine/request.rb" | ||
Style/NilComparison: | ||
Exclude: | ||
- "spec/webmachine/decision/falsey_spec.rb" | ||
Style/GlobalVars: | ||
Exclude: | ||
- "lib/webmachine/decision/conneg.rb" | ||
|
||
AllCops: | ||
SuggestExtensions: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
gemset = ENV['RVM_GEMSET'] || 'webmachine' | ||
gemset = "@#{gemset}" unless gemset.to_s == '' | ||
|
||
rvms = %W[ 1.8.7 1.9.2 1.9.3 jruby rbx ].map {|v| "#{v}#{gemset}" } | ||
rvms = %W[1.8.7 1.9.2 1.9.3 jruby rbx].map { |v| "#{v}#{gemset}" } | ||
|
||
guard 'rspec', :cli => "--color --profile", :growl => true, :rvm => rvms do | ||
watch(%r{^lib/webmachine/locale/.+$}) { "spec" } | ||
guard 'rspec', cli: '--color --profile', growl: true, rvm: rvms do | ||
watch(%r{^lib/webmachine/locale/.+$}) { 'spec' } | ||
watch(%r{^spec/.+_spec\.rb$}) | ||
watch(%r{^lib/(.+)\.rb$}){ |m| "spec/#{m[1]}_spec.rb" } | ||
watch('spec/spec_helper.rb') { "spec" } | ||
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" } | ||
watch('spec/spec_helper.rb') { 'spec' } | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,44 @@ | ||
require "bundler/gem_tasks" | ||
require 'bundler/gem_tasks' | ||
|
||
begin | ||
require 'yard' | ||
require 'yard/rake/yardoc_task' | ||
YARD::Rake::YardocTask.new do |doc| | ||
doc.files = Dir["lib/**/*.rb"] + ['README.md'] | ||
doc.options = ["-m", "markdown"] | ||
doc.files = Dir['lib/**/*.rb'] + ['README.md'] | ||
doc.options = ['-m', 'markdown'] | ||
end | ||
rescue LoadError | ||
end | ||
|
||
desc "Validate the gemspec file." | ||
desc 'Validate the gemspec file.' | ||
task :validate_gemspec do | ||
Gem::Specification.load("webmachine.gemspec").validate | ||
Gem::Specification.load('webmachine.gemspec').validate | ||
end | ||
|
||
task :build => :validate_gemspec | ||
task build: :validate_gemspec | ||
|
||
desc "Cleans up white space in source files" | ||
desc 'Cleans up white space in source files' | ||
task :clean_whitespace do | ||
no_file_cleaned = true | ||
|
||
Dir["**/*.rb"].each do |file| | ||
Dir['**/*.rb'].each do |file| | ||
contents = File.read(file) | ||
cleaned_contents = contents.gsub(/([ \t]+)$/, '') | ||
unless cleaned_contents == contents | ||
no_file_cleaned = false | ||
puts " - Cleaned #{file}" | ||
File.open(file, 'w') { |f| f.write(cleaned_contents) } | ||
File.write(file, cleaned_contents) | ||
end | ||
end | ||
|
||
if no_file_cleaned | ||
puts "No files with trailing whitespace found" | ||
puts 'No files with trailing whitespace found' | ||
end | ||
end | ||
|
||
require 'rspec/core/rake_task' | ||
|
||
desc "Run specs" | ||
desc 'Run specs' | ||
RSpec::Core::RakeTask.new(:spec) | ||
|
||
task :default => :spec | ||
task default: :spec |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.