best_practice_project 0.0.4 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rubocop.yml +54 -0
- data/README.md +1 -0
- data/VERSION +1 -1
- data/best_practice_project.gemspec +5 -4
- data/lib/best_practice_project/config/rubocop.yml +4 -0
- data/lib/best_practice_project/rubocop_handler.rb +35 -10
- metadata +4 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4ac02c1babdd1ad02b8a984339c36617283294e9
|
|
4
|
+
data.tar.gz: d6917c5650e11826ec7f6d2a84ef3f5aa72466dd
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 0e1b622177296a2381f530a29af7662c9f01932549baabb56ad83d2e28da108d61d9a48caf82644703f5a0c1f2a6cf9602749435e58cc6267ab63bee59f59836
|
|
7
|
+
data.tar.gz: bce5d11f08347122560701a17497d9169341ec743cf9bde4d68147f8afdfe461b4bf283bdbe2f1ad78681f1b6662917fef636cd808c5578ff44a452009a710e9
|
data/.rubocop.yml
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
AllCops:
|
|
2
|
+
Exclude:
|
|
3
|
+
- db/schema.rb
|
|
4
|
+
- spec/dummy/db/schema.rb
|
|
5
|
+
|
|
6
|
+
# https://github.com/AtomLinter/linter-rubocop/issues/2
|
|
7
|
+
Style/FileName:
|
|
8
|
+
Enabled: false
|
|
9
|
+
|
|
10
|
+
Metrics/LineLength:
|
|
11
|
+
Max: 160
|
|
12
|
+
|
|
13
|
+
Metrics/MethodLength:
|
|
14
|
+
Max: 50
|
|
15
|
+
|
|
16
|
+
Metrics/AbcSize:
|
|
17
|
+
Max: 25
|
|
18
|
+
|
|
19
|
+
Metrics/ClassLength:
|
|
20
|
+
Max: 250
|
|
21
|
+
|
|
22
|
+
Style/AccessModifierIndentation:
|
|
23
|
+
EnforcedStyle: outdent
|
|
24
|
+
|
|
25
|
+
Style/ClassAndModuleChildren:
|
|
26
|
+
EnforcedStyle: compact
|
|
27
|
+
|
|
28
|
+
Style/Documentation:
|
|
29
|
+
Enabled: false
|
|
30
|
+
|
|
31
|
+
Style/EmptyLines:
|
|
32
|
+
Enabled: false
|
|
33
|
+
|
|
34
|
+
StringLiterals:
|
|
35
|
+
EnforcedStyle: double_quotes
|
|
36
|
+
|
|
37
|
+
StringLiteralsInInterpolation:
|
|
38
|
+
Enabled: false
|
|
39
|
+
|
|
40
|
+
Style/NilComparison:
|
|
41
|
+
Enabled: false
|
|
42
|
+
|
|
43
|
+
Style/SignalException:
|
|
44
|
+
EnforcedStyle: only_raise
|
|
45
|
+
|
|
46
|
+
Style/MultilineOperationIndentation:
|
|
47
|
+
EnforcedStyle: indented
|
|
48
|
+
|
|
49
|
+
Style/SpaceInsideHashLiteralBraces:
|
|
50
|
+
EnforcedStyle: no_space
|
|
51
|
+
|
|
52
|
+
Style/TrivialAccessors:
|
|
53
|
+
ExactNameMatch: true
|
|
54
|
+
Enabled: true
|
data/README.md
CHANGED
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.0.
|
|
1
|
+
0.0.5
|
|
@@ -2,16 +2,16 @@
|
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
|
4
4
|
# -*- encoding: utf-8 -*-
|
|
5
|
-
# stub: best_practice_project 0.0.
|
|
5
|
+
# stub: best_practice_project 0.0.5 ruby lib
|
|
6
6
|
|
|
7
7
|
Gem::Specification.new do |s|
|
|
8
8
|
s.name = "best_practice_project"
|
|
9
|
-
s.version = "0.0.
|
|
9
|
+
s.version = "0.0.5"
|
|
10
10
|
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
|
12
12
|
s.require_paths = ["lib"]
|
|
13
13
|
s.authors = ["kaspernj"]
|
|
14
|
-
s.date = "2015-
|
|
14
|
+
s.date = "2015-12-03"
|
|
15
15
|
s.description = "A bundle of various linters and code inspection tools"
|
|
16
16
|
s.email = "k@spernj.org"
|
|
17
17
|
s.extra_rdoc_files = [
|
|
@@ -21,6 +21,7 @@ Gem::Specification.new do |s|
|
|
|
21
21
|
s.files = [
|
|
22
22
|
".document",
|
|
23
23
|
".rspec",
|
|
24
|
+
".rubocop.yml",
|
|
24
25
|
"Gemfile",
|
|
25
26
|
"Gemfile.lock",
|
|
26
27
|
"LICENSE.txt",
|
|
@@ -38,7 +39,7 @@ Gem::Specification.new do |s|
|
|
|
38
39
|
]
|
|
39
40
|
s.homepage = "http://github.com/kaspernj/best_practice_project"
|
|
40
41
|
s.licenses = ["MIT"]
|
|
41
|
-
s.rubygems_version = "2.
|
|
42
|
+
s.rubygems_version = "2.2.2"
|
|
42
43
|
s.summary = "A bundle of various linters and code inspection tools"
|
|
43
44
|
|
|
44
45
|
if s.respond_to? :specification_version then
|
|
@@ -4,11 +4,15 @@ class BestPracticeProject::RubocopHandler
|
|
|
4
4
|
@actual_config_path = File.realpath("#{File.dirname(__FILE__)}/config/rubocop.yml")
|
|
5
5
|
|
|
6
6
|
if rails?
|
|
7
|
-
@config_path = Rails.root.join("config", "
|
|
8
|
-
@todo_path = Rails.root.join("config", "
|
|
7
|
+
@config_path = Rails.root.join("config", "best_project_practice_rubocop.yml").to_s
|
|
8
|
+
@todo_path = Rails.root.join("config", "best_project_practice_rubocop_todo.yml").to_s
|
|
9
|
+
@default_path = Rails.root.join(".rubocop.yml")
|
|
10
|
+
@default_todo_path = Rails.root.join(".rubocop_todo.yml")
|
|
9
11
|
else
|
|
10
|
-
@config_path = "config/
|
|
11
|
-
@todo_path = "config/
|
|
12
|
+
@config_path = "config/best_project_practice_rubocop.yml"
|
|
13
|
+
@todo_path = "config/best_project_practice_rubocop_todo.yml"
|
|
14
|
+
@default_path = ".rubocop.yml"
|
|
15
|
+
@default_todo_path = ".rubocop_todo.yml"
|
|
12
16
|
end
|
|
13
17
|
end
|
|
14
18
|
|
|
@@ -16,6 +20,10 @@ class BestPracticeProject::RubocopHandler
|
|
|
16
20
|
@bpp.rails?
|
|
17
21
|
end
|
|
18
22
|
|
|
23
|
+
def remove_best_practice_path
|
|
24
|
+
self.inherit_from_to = nil
|
|
25
|
+
end
|
|
26
|
+
|
|
19
27
|
def update_best_practice_path
|
|
20
28
|
self.inherit_from_to = @actual_config_path
|
|
21
29
|
end
|
|
@@ -24,6 +32,19 @@ class BestPracticeProject::RubocopHandler
|
|
|
24
32
|
self.inherit_from_to = "$$$best_practice_project_config_path$$$"
|
|
25
33
|
end
|
|
26
34
|
|
|
35
|
+
# Make default ".rubocop.yml" and ".rubocop_todo" to support Sublime Text plugins and likewise
|
|
36
|
+
def update_default_configs
|
|
37
|
+
remove_best_practice_path
|
|
38
|
+
File.symlink(@todo_path, @default_todo_path)
|
|
39
|
+
# FileUtils.cp(@todo_path, @default_todo_path)
|
|
40
|
+
|
|
41
|
+
# Make default ".rubocop.yml" and ".rubocop_todo" to support Sublime Text plugins and likewise
|
|
42
|
+
generated_config = {"inherit_from" => [@actual_config_path, ".rubocop_todo.yml"]}
|
|
43
|
+
File.open(@default_path, "w") do |fp|
|
|
44
|
+
fp.write(YAML.dump(generated_config))
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
|
|
27
48
|
def command
|
|
28
49
|
command = "bundle exec rubocop --display-cop-names"
|
|
29
50
|
command << " --rails" if rails?
|
|
@@ -43,13 +64,13 @@ class BestPracticeProject::RubocopHandler
|
|
|
43
64
|
puts "Generated Rubocop todo config in #{@todo_path}"
|
|
44
65
|
|
|
45
66
|
generated_config = {}
|
|
46
|
-
generated_config["inherit_from"] = "
|
|
67
|
+
generated_config["inherit_from"] = "best_project_practice_rubocop_todo.yml"
|
|
47
68
|
|
|
48
69
|
File.open(@config_path, "w") do |fp|
|
|
49
70
|
fp.write(YAML.dump(generated_config))
|
|
50
71
|
end
|
|
51
72
|
|
|
52
|
-
|
|
73
|
+
update_default_configs
|
|
53
74
|
|
|
54
75
|
puts "Generated Rubocop config in #{@config_path}"
|
|
55
76
|
end
|
|
@@ -87,7 +108,7 @@ class BestPracticeProject::RubocopHandler
|
|
|
87
108
|
begin
|
|
88
109
|
system(command)
|
|
89
110
|
ensure
|
|
90
|
-
|
|
111
|
+
remove_best_practice_path
|
|
91
112
|
end
|
|
92
113
|
end
|
|
93
114
|
|
|
@@ -96,17 +117,21 @@ private
|
|
|
96
117
|
def inherit_from_to=(new_inherit_from)
|
|
97
118
|
todo_config = File.read(@todo_path)
|
|
98
119
|
|
|
99
|
-
|
|
120
|
+
if new_inherit_from
|
|
121
|
+
replace_with = "inherit_from: \"#{new_inherit_from}\""
|
|
122
|
+
else
|
|
123
|
+
replace_with = ""
|
|
124
|
+
end
|
|
100
125
|
|
|
101
126
|
if todo_config.include?("inherit_from:")
|
|
102
127
|
replace_what = /^inherit_from: (.+)$/
|
|
103
128
|
elsif todo_config.start_with?("---\n")
|
|
104
129
|
replace_what = /\A---\n/
|
|
105
130
|
replace_with.prepend("---\n")
|
|
106
|
-
replace_with << "\n\n"
|
|
131
|
+
replace_with << "\n\n" if replace_with.length > 0
|
|
107
132
|
else
|
|
108
133
|
replace_what = /\A/
|
|
109
|
-
replace_with << "\n\n"
|
|
134
|
+
replace_with << "\n\n" if replace_with.length > 0
|
|
110
135
|
end
|
|
111
136
|
|
|
112
137
|
todo_config.gsub!(replace_what, replace_with)
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: best_practice_project
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.5
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- kaspernj
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2015-
|
|
11
|
+
date: 2015-12-03 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: psych
|
|
@@ -104,6 +104,7 @@ extra_rdoc_files:
|
|
|
104
104
|
files:
|
|
105
105
|
- ".document"
|
|
106
106
|
- ".rspec"
|
|
107
|
+
- ".rubocop.yml"
|
|
107
108
|
- Gemfile
|
|
108
109
|
- Gemfile.lock
|
|
109
110
|
- LICENSE.txt
|
|
@@ -138,7 +139,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
138
139
|
version: '0'
|
|
139
140
|
requirements: []
|
|
140
141
|
rubyforge_project:
|
|
141
|
-
rubygems_version: 2.
|
|
142
|
+
rubygems_version: 2.2.2
|
|
142
143
|
signing_key:
|
|
143
144
|
specification_version: 4
|
|
144
145
|
summary: A bundle of various linters and code inspection tools
|