rubocop-jekyll 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 304012622aba6c768cd0c26b39b181176983cbd2
4
+ data.tar.gz: 700bf336eaedb0fc2b2acd9b560b7c0af5fc9225
5
+ SHA512:
6
+ metadata.gz: 1177caa8b482f1f696a631387bbe970ef4569bea8baaf051588c917e3b9219f3eb2a8639bd0f8828480c9f72b5ffe6d962a84586d2f5867af3c712eb120cb5ec
7
+ data.tar.gz: 98a66b9786c33afdb19b9c4404692e7de2ca24048d0ed48b93771c296cc6fd2f3b7b62a22043600128b4ed5a9aebdda22c1ca715ef762ad0f558ac43275f94fc
data/.rubocop.yml ADDED
@@ -0,0 +1,108 @@
1
+ AllCops:
2
+ TargetRubyVersion: 2.3
3
+ Include:
4
+ - lib/**/*.rb
5
+ - test/**/*.rb
6
+ Exclude:
7
+ - bin/**/*
8
+ - exe/**/*
9
+ - benchmark/**/*
10
+ - script/**/*
11
+ - vendor/**/*
12
+ - tmp/**/*
13
+
14
+
15
+ Layout/AlignHash:
16
+ EnforcedHashRocketStyle: table
17
+ Layout/IndentationWidth:
18
+ Severity: error
19
+ Layout/IndentArray:
20
+ EnforcedStyle: consistent
21
+ Layout/IndentHash:
22
+ EnforcedStyle: consistent
23
+ Layout/MultilineMethodCallIndentation:
24
+ EnforcedStyle: indented
25
+ Layout/MultilineOperationIndentation:
26
+ EnforcedStyle: indented
27
+ Layout/EmptyComment:
28
+ Enabled: false
29
+ Layout/EndAlignment:
30
+ Severity: error
31
+
32
+
33
+ Lint/UnreachableCode:
34
+ Severity: error
35
+
36
+
37
+ Metrics/AbcSize:
38
+ Max: 21
39
+ Metrics/ClassLength:
40
+ Max: 240
41
+ Metrics/LineLength:
42
+ Max: 100
43
+ Severity: warning
44
+ Metrics/MethodLength:
45
+ CountComments: false
46
+ Max: 20
47
+ Severity: error
48
+ Metrics/ModuleLength:
49
+ Max: 240
50
+ Metrics/ParameterLists:
51
+ Max: 4
52
+ Metrics/PerceivedComplexity:
53
+ Max: 8
54
+
55
+
56
+ Naming/FileName:
57
+ Enabled: false
58
+ Naming/UncommunicativeMethodParamName:
59
+ AllowedNames:
60
+ - _
61
+
62
+
63
+ Style/AccessModifierDeclarations:
64
+ Enabled: false
65
+ Style/Alias:
66
+ EnforcedStyle: prefer_alias_method
67
+ Style/AndOr:
68
+ Severity: error
69
+ Style/FrozenStringLiteralComment:
70
+ EnforcedStyle: always
71
+ Style/Documentation:
72
+ Enabled: false
73
+ Style/DoubleNegation:
74
+ Enabled: false
75
+ Style/GuardClause:
76
+ Enabled: false
77
+ Style/HashSyntax:
78
+ EnforcedStyle: hash_rockets
79
+ Severity: error
80
+ Style/ModuleFunction:
81
+ Enabled: false
82
+ Style/MultilineTernaryOperator:
83
+ Severity: error
84
+ Style/PercentLiteralDelimiters:
85
+ PreferredDelimiters:
86
+ "%q": "{}"
87
+ "%Q": "{}"
88
+ "%r": "!!"
89
+ "%s": "()"
90
+ "%w": "()"
91
+ "%W": "()"
92
+ "%x": "()"
93
+ Style/RegexpLiteral:
94
+ EnforcedStyle: percent_r
95
+ Style/RescueModifier:
96
+ Enabled: false
97
+ Style/SignalException:
98
+ EnforcedStyle: only_raise
99
+ Style/StringLiterals:
100
+ EnforcedStyle: double_quotes
101
+ Style/StringLiteralsInInterpolation:
102
+ EnforcedStyle: double_quotes
103
+ Style/SymbolArray:
104
+ EnforcedStyle: brackets
105
+ Style/TrailingCommaInArrayLiteral:
106
+ EnforcedStyleForMultiline: consistent_comma
107
+ Style/TrailingCommaInHashLiteral:
108
+ EnforcedStyleForMultiline: consistent_comma
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2018 Ashwin Maroli & Contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,47 @@
1
+ # RuboCop Jekyll
2
+
3
+ A RuboCop extension to enforce common code style in Jekyll and Jekyll plugins.
4
+
5
+
6
+ ## Installation
7
+
8
+ Just install the `rubocop-jekyll` gem
9
+
10
+ ```
11
+ gem install rubocop-jekyll
12
+ ```
13
+
14
+ or if you prefer Bundler, add it to your `Gemfile` or `gemspec`
15
+
16
+ ```ruby
17
+ # Gemfile
18
+
19
+ gem "rubocop-jekyll", "~> 0.1.0"
20
+ ```
21
+ ```ruby
22
+ # <plugin>.gemspec
23
+
24
+ spec.add_development_dependency "rubocop-jekyll", "~> 0.1.0"
25
+ ```
26
+ and run `bundle install`
27
+
28
+
29
+ ## Usage
30
+
31
+ You need to tell RuboCop to load the extension and *inherit* the custom RuboCop configuration advocated by
32
+ [Jekyll](https://github.com/jekyll).
33
+
34
+ Place the following at the top of your `.rubocop.yml`.
35
+
36
+ ```yaml
37
+ require: rubocop-jekyll
38
+ inherit_gem:
39
+ rubocop-jekyll: .rubocop.yml
40
+ ```
41
+
42
+ Running `bundle exec rubocop` will now automatically load the `rubocop-jekyll` cops together with the standard cops.
43
+
44
+
45
+ ## Customization
46
+
47
+ You can override any settings inherited from the extension by subsequently redefining the concerned parameters.
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ path_to_cops = File.join(File.expand_path("rubocop", __dir__), "cop", "**", "*.rb")
4
+ Dir[path_to_cops].each { |cop| require cop }
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ # ------------------------------------------ #
4
+ # Originally authored by Parker Moore
5
+ # https://github.com/jekyll/jekyll/pull/6615
6
+ # ------------------------------------------ #
7
+
8
+ module RuboCop
9
+ module Cop
10
+ module Jekyll
11
+ class NoPAllowed < Cop
12
+ MSG = "Avoid using `p` to print things. Use `Jekyll.logger` instead."
13
+
14
+ def_node_search :p_called?, "(send _ :p _)"
15
+
16
+ def on_send(node)
17
+ add_offense(node, :location => :selector) if p_called?(node)
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ # ------------------------------------------ #
4
+ # Originally authored by Parker Moore
5
+ # https://github.com/jekyll/jekyll/pull/6615
6
+ # ------------------------------------------ #
7
+
8
+ module RuboCop
9
+ module Cop
10
+ module Jekyll
11
+ class NoPutsAllowed < Cop
12
+ MSG = "Avoid using `puts` to print things. Use `Jekyll.logger` instead."
13
+
14
+ def_node_search :puts_called?, "(send nil? :puts _)"
15
+
16
+ def on_send(node)
17
+ add_offense(node, :location => :selector) if puts_called?(node)
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
metadata ADDED
@@ -0,0 +1,65 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rubocop-jekyll
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Ashwin Maroli
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2018-07-15 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rubocop
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 0.57.2
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 0.57.2
27
+ description: A RuboCop extension to enforce common code style in Jekyll and Jekyll
28
+ plugins
29
+ email:
30
+ - ashmaroli@gmail.com
31
+ executables: []
32
+ extensions: []
33
+ extra_rdoc_files: []
34
+ files:
35
+ - ".rubocop.yml"
36
+ - LICENSE
37
+ - README.md
38
+ - lib/rubocop-jekyll.rb
39
+ - lib/rubocop/cop/jekyll/no_p_allowed.rb
40
+ - lib/rubocop/cop/jekyll/no_puts_allowed.rb
41
+ homepage: https://github.com/ashmaroli/rubocop-jekyll
42
+ licenses:
43
+ - MIT
44
+ metadata: {}
45
+ post_install_message:
46
+ rdoc_options: []
47
+ require_paths:
48
+ - lib
49
+ required_ruby_version: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ version: 2.3.0
54
+ required_rubygems_version: !ruby/object:Gem::Requirement
55
+ requirements:
56
+ - - ">="
57
+ - !ruby/object:Gem::Version
58
+ version: '0'
59
+ requirements: []
60
+ rubyforge_project:
61
+ rubygems_version: 2.6.14
62
+ signing_key:
63
+ specification_version: 4
64
+ summary: Code style check for Jekyll and Jekyll plugins
65
+ test_files: []