mirror of
https://github.com/ThrowTheSwitch/Unity.git
synced 2026-01-23 00:15:58 +01:00
Started to flesh out rubocop settings for this project. Added rakefile tasks to do so. Updated first script to make it compliant.
This commit is contained in:
@@ -4,3 +4,51 @@ inherit_from: .rubocop_todo.yml
|
||||
|
||||
AllCops:
|
||||
TargetRubyVersion: 2.1
|
||||
|
||||
# These are areas where ThrowTheSwitch's coding style diverges from the Ruby standard
|
||||
# (Maybe we will make these conform over time)
|
||||
Style/SpecialGlobalVars:
|
||||
SupportedStyles:
|
||||
- use_perl_names
|
||||
- use_english_names
|
||||
EnforcedStyle: use_perl_names
|
||||
Style/FormatString:
|
||||
Enabled: false
|
||||
|
||||
# This is disabled because it seems to get confused over nested hashes
|
||||
Style/AlignHash:
|
||||
Enabled: false
|
||||
EnforcedHashRocketStyle: table
|
||||
EnforcedColonStyle: table
|
||||
|
||||
# We purposefully use these insecure features because they're what makes Ruby awesome
|
||||
Security/Eval:
|
||||
Enabled: false
|
||||
Security/YAMLLoad:
|
||||
Enabled: false
|
||||
|
||||
# At this point, we're not ready to enforce inline documentation requirements
|
||||
Style/Documentation:
|
||||
Enabled: false
|
||||
Style/DocumentationMethod:
|
||||
Enabled: false
|
||||
|
||||
# At this point, we're not ready to enforce any metrics
|
||||
Metrics/AbcSize:
|
||||
Enabled: false
|
||||
Metrics/BlockLength:
|
||||
Enabled: false
|
||||
Metrics/BlockNesting:
|
||||
Enabled: false
|
||||
Metrics/ClassLength:
|
||||
Enabled: false
|
||||
Metrics/CyclomaticComplexity:
|
||||
Enabled: false
|
||||
Metrics/LineLength:
|
||||
Enabled: false
|
||||
Metrics/MethodLength:
|
||||
Enabled: false
|
||||
Metrics/ParameterLists:
|
||||
Enabled: false
|
||||
Metrics/PerceivedComplexity:
|
||||
Enabled: false
|
||||
|
||||
@@ -1,23 +1,18 @@
|
||||
# This configuration was generated by
|
||||
# `rubocop --auto-gen-config`
|
||||
# on 2017-03-28 08:23:05 -0400 using RuboCop version 0.48.0.
|
||||
# on 2017-03-28 15:45:51 -0400 using RuboCop version 0.48.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: 2
|
||||
Lint/AmbiguousBlockAssociation:
|
||||
Exclude:
|
||||
- '../auto/generate_module.rb'
|
||||
|
||||
# Offense count: 1
|
||||
# Cop supports --auto-correct.
|
||||
Lint/DeprecatedClassMethods:
|
||||
Exclude:
|
||||
- 'rakefile_helper.rb'
|
||||
|
||||
# Offense count: 7
|
||||
# Offense count: 6
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: EnforcedStyleAlignWith, SupportedStylesAlignWith, AutoCorrect.
|
||||
# SupportedStylesAlignWith: keyword, variable, start_of_line
|
||||
@@ -25,7 +20,6 @@ Lint/EndAlignment:
|
||||
Exclude:
|
||||
- '../auto/colour_prompt.rb'
|
||||
- '../auto/colour_reporter.rb'
|
||||
- '../auto/generate_module.rb'
|
||||
- '../auto/parseOutput.rb'
|
||||
- '../auto/stylize_as_junit.rb'
|
||||
|
||||
@@ -35,10 +29,9 @@ Lint/RescueException:
|
||||
- '../auto/stylize_as_junit.rb'
|
||||
- '../auto/unity_test_summary.rb'
|
||||
|
||||
# Offense count: 2
|
||||
# Offense count: 1
|
||||
Lint/ShadowingOuterLocalVariable:
|
||||
Exclude:
|
||||
- '../auto/generate_module.rb'
|
||||
- '../auto/stylize_as_junit.rb'
|
||||
|
||||
# Offense count: 3
|
||||
@@ -60,56 +53,17 @@ Lint/Void:
|
||||
Exclude:
|
||||
- '../auto/parseOutput.rb'
|
||||
|
||||
# Offense count: 45
|
||||
Metrics/AbcSize:
|
||||
Max: 80
|
||||
|
||||
# Offense count: 6
|
||||
# Configuration parameters: CountComments, ExcludedMethods.
|
||||
Metrics/BlockLength:
|
||||
Max: 89
|
||||
|
||||
# Offense count: 4
|
||||
# Configuration parameters: CountComments.
|
||||
Metrics/ClassLength:
|
||||
Max: 341
|
||||
|
||||
# Offense count: 14
|
||||
Metrics/CyclomaticComplexity:
|
||||
Max: 17
|
||||
|
||||
# Offense count: 226
|
||||
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
|
||||
# URISchemes: http, https
|
||||
Metrics/LineLength:
|
||||
Max: 154
|
||||
|
||||
# Offense count: 39
|
||||
# Configuration parameters: CountComments.
|
||||
Metrics/MethodLength:
|
||||
Max: 58
|
||||
|
||||
# Offense count: 3
|
||||
# Configuration parameters: CountComments.
|
||||
Metrics/ModuleLength:
|
||||
Max: 204
|
||||
|
||||
# Offense count: 13
|
||||
Metrics/PerceivedComplexity:
|
||||
Max: 19
|
||||
|
||||
# Offense count: 2
|
||||
# Cop supports --auto-correct.
|
||||
Performance/StringReplacement:
|
||||
Exclude:
|
||||
- 'rakefile_helper.rb'
|
||||
|
||||
# Offense count: 1
|
||||
# Cop supports --auto-correct.
|
||||
Security/YAMLLoad:
|
||||
Exclude:
|
||||
- 'rakefile_helper.rb'
|
||||
|
||||
# Offense count: 10
|
||||
Style/AccessorMethodName:
|
||||
Exclude:
|
||||
@@ -129,27 +83,12 @@ Style/BlockDelimiters:
|
||||
Exclude:
|
||||
- 'spec/generate_module_existing_file_spec.rb'
|
||||
|
||||
# Offense count: 4
|
||||
# Offense count: 17
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: EnforcedStyle, SupportedStyles, SingleLineConditionsOnly, IncludeTernaryExpressions.
|
||||
# SupportedStyles: assign_to_condition, assign_inside_condition
|
||||
Style/ConditionalAssignment:
|
||||
Exclude:
|
||||
- 'rakefile_helper.rb'
|
||||
|
||||
# Offense count: 12
|
||||
Style/Documentation:
|
||||
Exclude:
|
||||
- 'spec/**/*'
|
||||
- 'test/**/*'
|
||||
- '../auto/colour_prompt.rb'
|
||||
- '../auto/generate_module.rb'
|
||||
- '../auto/generate_test_runner.rb'
|
||||
- '../auto/parseOutput.rb'
|
||||
- '../auto/stylize_as_junit.rb'
|
||||
- '../auto/test_file_filter.rb'
|
||||
- '../auto/type_sanitizer.rb'
|
||||
- '../auto/unity_test_summary.rb'
|
||||
- '../examples/example_3/rakefile_helper.rb'
|
||||
- '../extras/fixture/rakefile_helper.rb'
|
||||
- 'rakefile_helper.rb'
|
||||
@@ -199,13 +138,6 @@ Style/FileName:
|
||||
Exclude:
|
||||
- '../auto/parseOutput.rb'
|
||||
|
||||
# Offense count: 4
|
||||
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
||||
# SupportedStyles: format, sprintf, percent
|
||||
Style/FormatString:
|
||||
Exclude:
|
||||
- '../auto/generate_module.rb'
|
||||
|
||||
# Offense count: 164
|
||||
# Configuration parameters: AllowedVariables.
|
||||
Style/GlobalVars:
|
||||
@@ -328,7 +260,7 @@ Style/Not:
|
||||
Exclude:
|
||||
- 'rakefile_helper.rb'
|
||||
|
||||
# Offense count: 2
|
||||
# Offense count: 1
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: AutoCorrect, EnforcedStyle, SupportedStyles.
|
||||
# SupportedStyles: predicate, comparison
|
||||
@@ -336,7 +268,6 @@ Style/NumericPredicate:
|
||||
Exclude:
|
||||
- 'spec/**/*'
|
||||
- '../auto/colour_reporter.rb'
|
||||
- '../auto/generate_module.rb'
|
||||
|
||||
# Offense count: 17
|
||||
# Cop supports --auto-correct.
|
||||
@@ -453,13 +384,15 @@ Style/SpaceInsideParens:
|
||||
Exclude:
|
||||
- 'tests/test_generate_test_runner.rb'
|
||||
|
||||
# Offense count: 2
|
||||
# Offense count: 3
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
||||
# SupportedStyles: use_perl_names, use_english_names
|
||||
Style/SpecialGlobalVars:
|
||||
Exclude:
|
||||
- 'rakefile_helper.rb'
|
||||
- '../auto/generate_test_runner.rb'
|
||||
- '../auto/stylize_as_junit.rb'
|
||||
- '../auto/unity_test_summary.rb'
|
||||
|
||||
# Offense count: 167
|
||||
# Cop supports --auto-correct.
|
||||
|
||||
@@ -74,19 +74,30 @@ end
|
||||
namespace :style do
|
||||
desc "Check style"
|
||||
task :check do
|
||||
`rubocop ../`
|
||||
report execute("rubocop ../ --config .rubocop.yml", true)
|
||||
report "Style Checked."
|
||||
end
|
||||
|
||||
namespace :check do
|
||||
Dir['../**/*.rb'].each do |f|
|
||||
task File.basename(f, '.rb').to_sym do
|
||||
report execute("rubocop #{f} --color --config .rubocop.yml", true)
|
||||
report "Style Checked."
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
desc "Attempt to Autocorrect style"
|
||||
task :auto do
|
||||
`rubocop ../ --auto-correct`
|
||||
File.delete(".rubocop_todo.yml")
|
||||
execute("rubocop ../ --auto-correct --config .rubocop.yml")
|
||||
report "Autocorrected What We Could."
|
||||
end
|
||||
|
||||
desc "Update style todo list"
|
||||
task :todo do
|
||||
`rubocop ../ --auto-gen-config`
|
||||
File.delete(".rubocop_todo.yml")
|
||||
execute("rubocop ../ --auto-gen-config --config .rubocop.yml")
|
||||
report "Updated Style TODO List."
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user