-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
627 additions
and
2 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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
#!/usr/bin/env ruby | ||
|
||
require 'rubocop/git' | ||
require 'rubocop/git/cli' | ||
|
||
RuboCop::Git::CLI.new.run |
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,235 @@ | ||
AccessorMethodName: | ||
Enabled: false | ||
|
||
Alias: | ||
Enabled: false | ||
|
||
ArrayJoin: | ||
Enabled: false | ||
|
||
AsciiComments: | ||
Enabled: false | ||
|
||
AsciiIdentifiers: | ||
Enabled: false | ||
|
||
Attr: | ||
Enabled: false | ||
|
||
BlockNesting: | ||
Enabled: false | ||
|
||
CaseEquality: | ||
Enabled: false | ||
|
||
CharacterLiteral: | ||
Enabled: false | ||
|
||
ClassLength: | ||
Enabled: false | ||
|
||
ClassVars: | ||
Enabled: false | ||
|
||
CollectionMethods: | ||
PreferredMethods: | ||
find: detect | ||
reduce: inject | ||
collect: map | ||
find_all: select | ||
|
||
ColonMethodCall: | ||
Enabled: false | ||
|
||
CommentAnnotation: | ||
Enabled: false | ||
|
||
CyclomaticComplexity: | ||
Enabled: false | ||
|
||
Delegate: | ||
Enabled: false | ||
|
||
DeprecatedHashMethods: | ||
Enabled: false | ||
|
||
Documentation: | ||
Enabled: false | ||
|
||
DotPosition: | ||
EnforcedStyle: trailing | ||
|
||
DoubleNegation: | ||
Enabled: false | ||
|
||
EmptyLiteral: | ||
Enabled: false | ||
|
||
Encoding: | ||
Enabled: false | ||
|
||
EvenOdd: | ||
Enabled: false | ||
|
||
FileName: | ||
Enabled: false | ||
|
||
FlipFlop: | ||
Enabled: false | ||
|
||
FormatString: | ||
Enabled: false | ||
|
||
GlobalVars: | ||
Enabled: false | ||
|
||
IfUnlessModifier: | ||
Enabled: false | ||
|
||
IfWithSemicolon: | ||
Enabled: false | ||
|
||
Lambda: | ||
Enabled: false | ||
|
||
LambdaCall: | ||
Enabled: false | ||
|
||
LineEndConcatenation: | ||
Enabled: false | ||
|
||
LineLength: | ||
Max: 80 | ||
|
||
MethodLength: | ||
Enabled: false | ||
|
||
ModuleFunction: | ||
Enabled: false | ||
|
||
NegatedIf: | ||
Enabled: false | ||
|
||
NegatedWhile: | ||
Enabled: false | ||
|
||
NilComparison: | ||
Enabled: false | ||
|
||
Not: | ||
Enabled: false | ||
|
||
NumericLiterals: | ||
Enabled: false | ||
|
||
OneLineConditional: | ||
Enabled: false | ||
|
||
OpMethod: | ||
Enabled: false | ||
|
||
ParameterLists: | ||
Enabled: false | ||
|
||
PercentLiteralDelimiters: | ||
PreferredDelimiters: | ||
'%': '{}' | ||
|
||
PerlBackrefs: | ||
Enabled: false | ||
|
||
PredicateName: | ||
NamePrefixBlacklist: | ||
- is_ | ||
|
||
Proc: | ||
Enabled: false | ||
|
||
RaiseArgs: | ||
Enabled: false | ||
|
||
RegexpLiteral: | ||
Enabled: false | ||
|
||
SelfAssignment: | ||
Enabled: false | ||
|
||
SingleLineBlockParams: | ||
Enabled: false | ||
|
||
SingleLineMethods: | ||
Enabled: false | ||
|
||
SignalException: | ||
Enabled: false | ||
|
||
SpecialGlobalVars: | ||
Enabled: false | ||
|
||
VariableInterpolation: | ||
Enabled: false | ||
|
||
TrailingComma: | ||
Enabled: false | ||
|
||
TrivialAccessors: | ||
Enabled: false | ||
|
||
VariableInterpolation: | ||
Enabled: false | ||
|
||
WhenThen: | ||
Enabled: false | ||
|
||
WhileUntilModifier: | ||
Enabled: false | ||
|
||
WordArray: | ||
Enabled: false | ||
|
||
# Lint | ||
|
||
AmbiguousOperator: | ||
Enabled: false | ||
|
||
AmbiguousRegexpLiteral: | ||
Enabled: false | ||
|
||
AssignmentInCondition: | ||
Enabled: false | ||
|
||
ConditionPosition: | ||
Enabled: false | ||
|
||
DeprecatedClassMethods: | ||
Enabled: false | ||
|
||
ElseLayout: | ||
Enabled: false | ||
|
||
HandleExceptions: | ||
Enabled: false | ||
|
||
InvalidCharacterLiteral: | ||
Enabled: false | ||
|
||
LiteralInCondition: | ||
Enabled: false | ||
|
||
LiteralInInterpolation: | ||
Enabled: false | ||
|
||
Loop: | ||
Enabled: false | ||
|
||
ParenthesesAsGroupedExpression: | ||
Enabled: false | ||
|
||
RequireParentheses: | ||
Enabled: false | ||
|
||
UnderscorePrefixedVariableName: | ||
Enabled: false | ||
|
||
Void: | ||
Enabled: 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,20 @@ | ||
require 'rubocop/git/version' | ||
require 'rubocop' | ||
require 'active_support/core_ext/module/attribute_accessors' | ||
|
||
module RuboCop | ||
module Git | ||
# Your code goes here... | ||
autoload :FileCollection, 'rubocop/git/file_collection' | ||
autoload :FileViolation, 'rubocop/git/file_violation' | ||
autoload :Line, 'rubocop/git/line' | ||
autoload :ModifiedFile, 'rubocop/git/modified_file' | ||
autoload :Patch, 'rubocop/git/patch' | ||
autoload :PseudoPullRequest, 'rubocop/git/pseudo_pull_request' | ||
autoload :PseudoResource, 'rubocop/git/pseudo_resource' | ||
autoload :Runner, 'rubocop/git/runner' | ||
autoload :StyleChecker, 'rubocop/git/style_checker' | ||
autoload :StyleGuide, 'rubocop/git/style_guide' | ||
|
||
mattr_accessor :config_path | ||
end | ||
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 |
---|---|---|
@@ -0,0 +1,42 @@ | ||
require 'rubocop/git' | ||
require 'optparse' | ||
|
||
module RuboCop | ||
module Git | ||
class CLI | ||
def run(args = ARGV) | ||
options = parse_arguments(args) | ||
Runner.new.run(options) | ||
end | ||
|
||
private | ||
|
||
def parse_arguments(args) | ||
options = {} | ||
|
||
OptionParser.new do |opt| | ||
opt.on('-c', '--config FILE', | ||
'Specify configuration file') do |config| | ||
options[:config] = config | ||
end | ||
|
||
opt.on('--cached', 'git diff --cached') do | ||
options[:cached] = true | ||
end | ||
|
||
opt.on('--staged', 'synonym of --cached') do | ||
options[:cached] = true | ||
end | ||
|
||
opt.on('--hound', 'Hound compatibility mode') do | ||
options[:hound] = true | ||
end | ||
|
||
opt.parse(args) | ||
end | ||
|
||
options | ||
end | ||
end | ||
end | ||
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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
module RuboCop::Git | ||
# copy from https://github.com/thoughtbot/hound/blob/a6a8d3f/app/models/file_collection.rb | ||
class FileCollection | ||
IGNORED_FILES = ['db/schema.rb'] | ||
|
||
attr_reader :files | ||
|
||
def initialize(files) | ||
@files = files | ||
end | ||
|
||
def relevant_files | ||
files.reject do |file| | ||
file.removed? || !file.ruby? || IGNORED_FILES.include?(file.filename) | ||
end | ||
end | ||
end | ||
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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
module RuboCop::Git | ||
# copy from https://github.com/thoughtbot/hound/blob/a6a8d3f/app/models/file_violation.rb | ||
class FileViolation < Struct.new(:filename, :offenses) | ||
end | ||
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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
module RuboCop::Git | ||
# copy from https://github.com/thoughtbot/hound/blob/a6a8d3f/app/models/line.rb | ||
class Line < Struct.new(:content, :line_number, :patch_position) | ||
def ==(other_line) | ||
content == other_line.content | ||
end | ||
end | ||
end |
Oops, something went wrong.