ragnarson-stylecheck 0.0.2

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 840638094b92e21b7c6c0c9ebf0b50601008995f
4
+ data.tar.gz: bebada66cc6f199c465b0b55098272844ae9e2ea
5
+ SHA512:
6
+ metadata.gz: 4b3dd2b35b3432fe19cd5b774fc9456256930a0bcb578ffbc754d127395b0f3add08fa36c143eda41bf7dc88a4318f6e1d4915e535bbd3bcfe23e62870a3705a
7
+ data.tar.gz: 452c04917246a42151ddd4fb247c7b8ee6b231c6c66d969a6b41c46b95aabdc04df6abb120a220f9f3d402f5ac3e39577562b2c565f9253a130d2054da99c71d
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright 2014 Ragnarson sp. z o. o.
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,12 @@
1
+ # ragnarson-stylecheck
2
+
3
+ This gem should streamline using of rubocop and potentially other automated stylecheck tools.
4
+
5
+ # install
6
+
7
+ Just add to gemfile and new rake task should be available
8
+ (if not add `require "ragnarson/rake_task"` to your Rakefile)
9
+
10
+ * `bundle exec rake style`
11
+
12
+ This for now just prepares a rubocop config and runs the rubocop check
@@ -0,0 +1,82 @@
1
+ Style/AlignParameters:
2
+ EnforcedStyle: with_fixed_indentation
3
+
4
+ Style/ClassAndModuleChildren:
5
+ Enabled: false
6
+
7
+ Style/Documentation:
8
+ Enabled: false
9
+
10
+ # Multi-line method chaining should be done with leading dots.
11
+ Style/DotPosition:
12
+ EnforcedStyle: trailing
13
+
14
+ # Use empty lines between defs.
15
+ Style/EmptyLineBetweenDefs:
16
+ # If true, this parameter means that single line method definitions don't
17
+ # need an empty line between them.
18
+ AllowAdjacentOneLineDefs: true
19
+
20
+ Style/EmptyLines:
21
+ Exclude:
22
+ - Gemfile
23
+
24
+ # Checks whether the source file has a utf-8 encoding comment or not
25
+ Style/Encoding:
26
+ Enabled: false
27
+
28
+ Style/InlineComment:
29
+ Enabled: false
30
+
31
+ Style/MultilineOperationIndentation:
32
+ EnforcedStyle: indented
33
+
34
+ # Enforce the method used for string formatting.
35
+ Style/FormatString:
36
+ Enabled: false
37
+
38
+ Style/IfUnlessModifier:
39
+ MaxLineLength: 120
40
+
41
+ Style/Semicolon:
42
+ # Allow ; to separate several expressions on the same line.
43
+ AllowAsExpressionSeparator: true
44
+
45
+
46
+ Style/StringLiterals:
47
+ EnforcedStyle: double_quotes
48
+ Exclude:
49
+ - Gemfile
50
+ - Rakefile
51
+
52
+ Style/StringLiteralsInInterpolation:
53
+ EnforcedStyle: double_quotes
54
+
55
+ Style/TrailingComma:
56
+ # If EnforcedStyleForMultiline is comma, the cop allows a comma after the
57
+ # last item of a list, but only for lists where each item is on its own line.
58
+ EnforcedStyleForMultiline: no_comma
59
+
60
+ Style/RaiseArgs:
61
+ Enabled: false
62
+
63
+ # Allow logical `or`/`and` in conditionals
64
+ Style/AndOr:
65
+ EnforcedStyle: conditionals
66
+
67
+ ##################### Metrics ##################################
68
+
69
+ Metrics/AbcSize:
70
+ Severity: warning
71
+ Max: 25
72
+
73
+ Metrics/LineLength:
74
+ Max: 120
75
+ # To make it possible to copy or click on URIs in the code, we allow lines
76
+ # contaning a URI to be longer than Max.
77
+ AllowURI: true
78
+ URISchemes:
79
+ - http
80
+ - https
81
+
82
+ ##################### Rails ##################################
@@ -0,0 +1,2 @@
1
+ require 'rake'
2
+ load 'ragnarson/tasks/rubocop.rake'
@@ -0,0 +1,13 @@
1
+ module Ragnarson
2
+ # style checking for booking sync projects
3
+ module Stylecheck
4
+ class << self
5
+ def root
6
+ Gem::Specification.find_by_name('ragnarson-stylecheck').gem_dir
7
+ end
8
+ end
9
+ end
10
+ end
11
+
12
+ require 'ragnarson/stylecheck/rubocop_helpers'
13
+ require 'ragnarson/stylecheck/railtie' if defined?(Rails)
@@ -0,0 +1,11 @@
1
+ module Ragnarson
2
+ module Stylecheck
3
+ # auto loading rake tasks
4
+ class Railtie < Rails::Railtie
5
+ rake_tasks do
6
+ rake_path = File.join(File.dirname(__FILE__), '../tasks/*.rake')
7
+ Dir[rake_path].each { |f| load f }
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,14 @@
1
+ require 'fileutils'
2
+
3
+ module Ragnarson
4
+ module Stylecheck
5
+ # helper to nicely update rubocop config
6
+ module RubocopHelpers
7
+ class << self
8
+ def config
9
+ File.join(Ragnarson::Stylecheck.root, 'config', 'rubocop.yml')
10
+ end
11
+ end
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,32 @@
1
+ require 'ragnarson/stylecheck'
2
+ require "fileutils"
3
+
4
+ namespace :style do
5
+ namespace :rubocop do
6
+ desc "Run RuboCop with auto_correct"
7
+ task :with_auto_correct do
8
+ options = ["--rails", "--auto-correct"]
9
+ options += ["--fail-level", "refactor"]
10
+ options += ["-c", Ragnarson::Stylecheck::RubocopHelpers.config]
11
+ sh "bundle exec rubocop #{options.join(' ')}" do |ok, _res|
12
+ abort "Fix code style errors" unless ok
13
+ end
14
+ end
15
+
16
+ desc 'Run RuboCop without auto_correct'
17
+ task :without_auto_correct do
18
+ options = ["--rails"]
19
+ options += ["--fail-level", "refactor"]
20
+ options += ["--display-cop-names"]
21
+ options += ["-c", Ragnarson::Stylecheck::RubocopHelpers.config]
22
+ sh "bundle exec rubocop #{options.join(' ')}" do |ok, _res|
23
+ abort "Fix code style errors" unless ok
24
+ end
25
+ end
26
+ end
27
+ end
28
+
29
+ desc "Check codestyle and fix common errors"
30
+ task :style do
31
+ Rake::Task["style:rubocop:with_auto_correct"].invoke
32
+ end
metadata ADDED
@@ -0,0 +1,67 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ragnarson-stylecheck
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.2
5
+ platform: ruby
6
+ authors:
7
+ - Piotr Marciniak
8
+ - Grzesiek Kołodziejczyk
9
+ - Oskar Szrajer
10
+ autorequire:
11
+ bindir: bin
12
+ cert_chain: []
13
+ date: 2015-03-30 00:00:00.000000000 Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: rubocop
17
+ requirement: !ruby/object:Gem::Requirement
18
+ requirements:
19
+ - - "~>"
20
+ - !ruby/object:Gem::Version
21
+ version: 0.29.1
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ requirements:
26
+ - - "~>"
27
+ - !ruby/object:Gem::Version
28
+ version: 0.29.1
29
+ description: Wraps rubocop for simple and consisten experience
30
+ email: oskarszrajer@gmail.com
31
+ executables: []
32
+ extensions: []
33
+ extra_rdoc_files: []
34
+ files:
35
+ - MIT-LICENSE
36
+ - README.md
37
+ - config/rubocop.yml
38
+ - lib/ragnarson/rake_task.rb
39
+ - lib/ragnarson/stylecheck.rb
40
+ - lib/ragnarson/stylecheck/railtie.rb
41
+ - lib/ragnarson/stylecheck/rubocop_helpers.rb
42
+ - lib/ragnarson/tasks/rubocop.rake
43
+ homepage: https://github.com/ragnarson/ragnarson-stylecheck
44
+ licenses:
45
+ - MIT
46
+ metadata: {}
47
+ post_install_message:
48
+ rdoc_options: []
49
+ require_paths:
50
+ - lib
51
+ required_ruby_version: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ version: '0'
56
+ required_rubygems_version: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: '0'
61
+ requirements: []
62
+ rubyforge_project:
63
+ rubygems_version: 2.4.5
64
+ signing_key:
65
+ specification_version: 4
66
+ summary: Automatic style check for ragnarson projects
67
+ test_files: []