netsoft-rubocop 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.circleci/config.yml +141 -0
- data/.gitignore +56 -0
- data/.rubocop.yml +1 -0
- data/CHANGELOG.md +13 -0
- data/Dangerfile +3 -0
- data/Gemfile +8 -0
- data/README.md +45 -0
- data/Rakefile +4 -0
- data/bin/setup-rubygems.sh +3 -0
- data/bin/tag_check.sh +17 -0
- data/default.yml +117 -0
- data/lib/netsoft/rubocop.rb +9 -0
- data/lib/netsoft/rubocop/cops/auth_http_positional_arguments.rb +139 -0
- data/lib/netsoft/rubocop/version.rb +7 -0
- data/netsoft-rubocop.gemspec +32 -0
- metadata +142 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 8cf6516546fb841a50c1ae074379461322412af26b550d185a29732bd89ff601
|
4
|
+
data.tar.gz: b7f3bf4846b605d70a81c9f6dafa991eb14d33a036e67895d09caf921d38e89e
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: d6279ee377b16ca8faed2b20d9ee54d881f2e40acc58a272ae779936cda7319a217c352e9edcc44a88219f0a0d82ccc4d5ea1372ab891b1dbac50b17317b63fd
|
7
|
+
data.tar.gz: 3c6376c673f1d22ac69c87b4051963af7d6a941541f4fb0b4f346ac8fad46151ab45f2ac480251015315101c2b5e3cab5857cc9bf1c9fb5e4e71189479c5bca7
|
@@ -0,0 +1,141 @@
|
|
1
|
+
version: 2
|
2
|
+
|
3
|
+
defaults: &defaults
|
4
|
+
docker: &ruby_image
|
5
|
+
- &ruby_image
|
6
|
+
image: circleci/ruby:2.4.4-stretch
|
7
|
+
environment:
|
8
|
+
CIRCLE_ARTIFACTS: /tmp/circelci-artifacts
|
9
|
+
RUBYOPT: '-KU -E utf-8:utf-8'
|
10
|
+
BUNDLE_PATH: vendor/bundle
|
11
|
+
BUNDLE_VERSION: 1.15.2
|
12
|
+
BUNDLE_JOBS: 4
|
13
|
+
BUNDLE_RETRY: 3
|
14
|
+
|
15
|
+
filters:
|
16
|
+
test: &filter_test
|
17
|
+
filters:
|
18
|
+
tags:
|
19
|
+
ignore: /^v.*/
|
20
|
+
beta: &filter_beta
|
21
|
+
filters:
|
22
|
+
branches:
|
23
|
+
ignore: /.*/
|
24
|
+
tags:
|
25
|
+
only: /^v[0-9]+(\.[0-9]+)+(\.[a-z].+).*/
|
26
|
+
release: &filter_release
|
27
|
+
filters:
|
28
|
+
branches:
|
29
|
+
ignore: /.*/
|
30
|
+
tags:
|
31
|
+
only: /^v[0-9]+(\.[0-9]+)+/
|
32
|
+
|
33
|
+
workflows:
|
34
|
+
version: 2
|
35
|
+
build_test:
|
36
|
+
jobs:
|
37
|
+
- "Checkout":
|
38
|
+
<<: *filter_test
|
39
|
+
context: org-global
|
40
|
+
- "Build":
|
41
|
+
<<: *filter_test
|
42
|
+
context: org-global
|
43
|
+
requires:
|
44
|
+
- "Checkout"
|
45
|
+
build_test_beta:
|
46
|
+
jobs:
|
47
|
+
- "Checkout":
|
48
|
+
<<: *filter_beta
|
49
|
+
context: org-global
|
50
|
+
- "Build":
|
51
|
+
<<: *filter_beta
|
52
|
+
context: org-global
|
53
|
+
requires:
|
54
|
+
- "Checkout"
|
55
|
+
- "Publish":
|
56
|
+
<<: *filter_beta
|
57
|
+
context: org-global
|
58
|
+
requires:
|
59
|
+
- "Build"
|
60
|
+
build_test_release:
|
61
|
+
jobs:
|
62
|
+
- "Checkout":
|
63
|
+
<<: *filter_release
|
64
|
+
context: org-global
|
65
|
+
- "Build":
|
66
|
+
<<: *filter_release
|
67
|
+
context: org-global
|
68
|
+
requires:
|
69
|
+
- "Checkout"
|
70
|
+
- "Publish":
|
71
|
+
<<: *filter_release
|
72
|
+
context: org-global
|
73
|
+
requires:
|
74
|
+
- "Build"
|
75
|
+
|
76
|
+
jobs:
|
77
|
+
"Checkout":
|
78
|
+
<<: *defaults
|
79
|
+
steps:
|
80
|
+
- attach_workspace:
|
81
|
+
at: .
|
82
|
+
- checkout
|
83
|
+
|
84
|
+
- restore_cache:
|
85
|
+
keys:
|
86
|
+
- netsoft-rubocop-bundle-v2-{{ checksum "Gemfile" }}-{{ checksum "netsoft-rubocop.gemspec" }}
|
87
|
+
- run:
|
88
|
+
name: Install bundler
|
89
|
+
command: gem install bundler --version=$BUNDLE_VERSION
|
90
|
+
- run:
|
91
|
+
name: Bundle Install
|
92
|
+
command: |-
|
93
|
+
bundle _${BUNDLE_VERSION}_ check || bundle _${BUNDLE_VERSION}_ install --retry=$BUNDLE_RETRY
|
94
|
+
- save_cache:
|
95
|
+
key: netsoft-rubocop--bundle-v2-{{ checksum "Gemfile" }}-{{ checksum "netsoft-rubocop.gemspec" }}
|
96
|
+
paths:
|
97
|
+
- vendor/bundle
|
98
|
+
- Gemfile.lock
|
99
|
+
|
100
|
+
- persist_to_workspace:
|
101
|
+
root: .
|
102
|
+
paths: .
|
103
|
+
"Build":
|
104
|
+
<<: *defaults
|
105
|
+
steps:
|
106
|
+
- attach_workspace:
|
107
|
+
at: .
|
108
|
+
- run:
|
109
|
+
name: Install bundler
|
110
|
+
command: gem install bundler --version=$BUNDLE_VERSION
|
111
|
+
- run:
|
112
|
+
name: Build gem
|
113
|
+
command: |-
|
114
|
+
gem build *.gemspec
|
115
|
+
- run:
|
116
|
+
name: "Install netsoft-danger"
|
117
|
+
command: |-
|
118
|
+
gem install netsoft-danger
|
119
|
+
- run:
|
120
|
+
name: Run rubocop
|
121
|
+
command: |-
|
122
|
+
netsoft-circle rubocop
|
123
|
+
- run:
|
124
|
+
name: Run Danger
|
125
|
+
command: |-
|
126
|
+
danger
|
127
|
+
- store_artifacts:
|
128
|
+
path: /tmp/circelci-artifacts
|
129
|
+
"Publish":
|
130
|
+
<<: *defaults
|
131
|
+
steps:
|
132
|
+
- attach_workspace:
|
133
|
+
at: .
|
134
|
+
- run:
|
135
|
+
name: Deploy to gem server
|
136
|
+
command: |-
|
137
|
+
./bin/tag_check.sh
|
138
|
+
./bin/setup-rubygems.sh
|
139
|
+
rm -rf pkg
|
140
|
+
rake build
|
141
|
+
gem push pkg/*.gem
|
data/.gitignore
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
/.config
|
4
|
+
/coverage/
|
5
|
+
/InstalledFiles
|
6
|
+
/pkg/
|
7
|
+
/spec/reports/
|
8
|
+
/spec/examples.txt
|
9
|
+
/test/tmp/
|
10
|
+
/test/version_tmp/
|
11
|
+
/tmp/
|
12
|
+
|
13
|
+
# Used by dotenv library to load environment variables.
|
14
|
+
# .env
|
15
|
+
|
16
|
+
# Ignore Byebug command history file.
|
17
|
+
.byebug_history
|
18
|
+
|
19
|
+
## Specific to RubyMotion:
|
20
|
+
.dat*
|
21
|
+
.repl_history
|
22
|
+
build/
|
23
|
+
*.bridgesupport
|
24
|
+
build-iPhoneOS/
|
25
|
+
build-iPhoneSimulator/
|
26
|
+
|
27
|
+
## Specific to RubyMotion (use of CocoaPods):
|
28
|
+
#
|
29
|
+
# We recommend against adding the Pods directory to your .gitignore. However
|
30
|
+
# you should judge for yourself, the pros and cons are mentioned at:
|
31
|
+
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
|
32
|
+
#
|
33
|
+
# vendor/Pods/
|
34
|
+
|
35
|
+
## Documentation cache and generated files:
|
36
|
+
/.yardoc/
|
37
|
+
/_yardoc/
|
38
|
+
/doc/
|
39
|
+
/rdoc/
|
40
|
+
|
41
|
+
## Environment normalization:
|
42
|
+
/.bundle/
|
43
|
+
/vendor/bundle
|
44
|
+
/lib/bundler/man/
|
45
|
+
|
46
|
+
# for a library or gem, you might want to ignore these files since the code is
|
47
|
+
# intended to run in multiple environments; otherwise, check them in:
|
48
|
+
# Gemfile.lock
|
49
|
+
# .ruby-version
|
50
|
+
# .ruby-gemset
|
51
|
+
|
52
|
+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
53
|
+
.rvmrc
|
54
|
+
|
55
|
+
Gemfile.lock
|
56
|
+
.ruby-*
|
data/.rubocop.yml
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
inherit_from: default.yml
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
# Changelog
|
2
|
+
|
3
|
+
All notable changes to this project will be documented in this file.
|
4
|
+
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
7
|
+
|
8
|
+
## [Unreleased]
|
9
|
+
|
10
|
+
## [1.0.0] - 2019-08-28
|
11
|
+
### Added
|
12
|
+
- Default rubocop config
|
13
|
+
- Netsoft/AuthHttpPositionalArguments cop
|
data/Dangerfile
ADDED
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
# netsoft-rubocop
|
2
|
+
|
3
|
+
Hubstaff style guides and shared style configs.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your project Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
group :test, :development do
|
11
|
+
gem 'netsoft-rubocop', github: 'NetsoftHoldings/netsoft-rubocop', tag: 'v1.0.0'
|
12
|
+
end
|
13
|
+
```
|
14
|
+
|
15
|
+
And then run:
|
16
|
+
|
17
|
+
```bash
|
18
|
+
$ bundle install
|
19
|
+
```
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
Create a `.rubocop.yml` with the following directives:
|
24
|
+
|
25
|
+
```yaml
|
26
|
+
inherit_gem:
|
27
|
+
netsoft-rubocop:
|
28
|
+
- default.yml
|
29
|
+
```
|
30
|
+
|
31
|
+
Now, run:
|
32
|
+
|
33
|
+
```bash
|
34
|
+
$ bundle exec rubocop
|
35
|
+
```
|
36
|
+
|
37
|
+
You do not need to include rubocop directly in your application's dependencies.
|
38
|
+
netsoft-rubocop will include a specific version of `rubocop`, `rubocop-performance`,
|
39
|
+
`rubocop-rails` and `rubocop-rspec` that is shared across all projects.
|
40
|
+
|
41
|
+
## Releasing
|
42
|
+
|
43
|
+
1. Update version.rb file accordingly.
|
44
|
+
2. Tag the release: `git tag vVERSION`
|
45
|
+
3. Push changes: `git push --tags`
|
data/Rakefile
ADDED
data/bin/tag_check.sh
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
|
3
|
+
tag=`git describe --tags --exact-match HEAD 2> /dev/null`
|
4
|
+
|
5
|
+
if [ $? -eq 0 ]; then
|
6
|
+
version=`grep VERSION lib/netsoft/rubocop/version.rb | sed -e "s/.*'\([^']*\)'.*/\1/"`
|
7
|
+
|
8
|
+
if [ "v$version" = "$tag" ]; then
|
9
|
+
echo "Revision $tag Matches $version"
|
10
|
+
else
|
11
|
+
echo "Revision $tag does not match $version"
|
12
|
+
exit 2
|
13
|
+
fi
|
14
|
+
else
|
15
|
+
echo "No tag found"
|
16
|
+
exit 1
|
17
|
+
fi
|
data/default.yml
ADDED
@@ -0,0 +1,117 @@
|
|
1
|
+
require:
|
2
|
+
- ./lib/netsoft/rubocop/cops/auth_http_positional_arguments
|
3
|
+
- rubocop-rails
|
4
|
+
- rubocop-performance
|
5
|
+
- rubocop-rspec
|
6
|
+
|
7
|
+
AllCops:
|
8
|
+
TargetRubyVersion: 2.4
|
9
|
+
TargetRailsVersion: 5.2
|
10
|
+
DisplayStyleGuide: true
|
11
|
+
StyleGuideBaseURL: https://rubystyle.guide
|
12
|
+
Exclude:
|
13
|
+
- 'db/**/*'
|
14
|
+
- 'coverage/**/*'
|
15
|
+
- 'log/**/*'
|
16
|
+
- 'public/**/*'
|
17
|
+
- 'tmp/**/*'
|
18
|
+
- 'spec/dummy/**/*'
|
19
|
+
- 'vendor/**/*'
|
20
|
+
- 'gemfiles/**/*'
|
21
|
+
- 'node_modules/**/*'
|
22
|
+
|
23
|
+
Naming/RescuedExceptionsVariableName:
|
24
|
+
PreferredName: ex
|
25
|
+
|
26
|
+
Naming/UncommunicativeMethodParamName:
|
27
|
+
AllowedNames:
|
28
|
+
- me
|
29
|
+
- ex
|
30
|
+
|
31
|
+
Layout/AlignHash:
|
32
|
+
EnforcedHashRocketStyle: table
|
33
|
+
EnforcedColonStyle: table
|
34
|
+
|
35
|
+
Layout/ExtraSpacing:
|
36
|
+
AllowForAlignment: true
|
37
|
+
|
38
|
+
Layout/IndentAssignment:
|
39
|
+
IndentationWidth: 4
|
40
|
+
|
41
|
+
Layout/IndentFirstArrayElement:
|
42
|
+
EnforcedStyle: consistent
|
43
|
+
IndentationWidth: 4
|
44
|
+
|
45
|
+
Layout/IndentFirstHashElement:
|
46
|
+
EnforcedStyle: consistent
|
47
|
+
IndentationWidth: 4
|
48
|
+
|
49
|
+
Layout/SpaceInsideBlockBraces:
|
50
|
+
EnforcedStyle: space
|
51
|
+
SpaceBeforeBlockParameters: true
|
52
|
+
|
53
|
+
Layout/SpaceInsideHashLiteralBraces:
|
54
|
+
EnforcedStyle: no_space
|
55
|
+
|
56
|
+
Lint/AmbiguousBlockAssociation:
|
57
|
+
Exclude:
|
58
|
+
- spec/**/*
|
59
|
+
|
60
|
+
Rails:
|
61
|
+
Enabled: true
|
62
|
+
|
63
|
+
Rails/HttpPositionalArguments:
|
64
|
+
Enabled: false
|
65
|
+
|
66
|
+
Rails/SkipsModelValidations:
|
67
|
+
Whitelist:
|
68
|
+
- touch
|
69
|
+
- update_attribute
|
70
|
+
- update_counters
|
71
|
+
- increment_counter
|
72
|
+
- decrement_counter
|
73
|
+
|
74
|
+
Netsoft/AuthHttpPositionalArguments:
|
75
|
+
Enabled: true
|
76
|
+
Include:
|
77
|
+
- 'spec/controllers/**/*'
|
78
|
+
|
79
|
+
RSpec/ExpectChange:
|
80
|
+
EnforcedStyle: block
|
81
|
+
|
82
|
+
RSpec/ImplicitSubject:
|
83
|
+
Enabled: false
|
84
|
+
|
85
|
+
RSpec/MessageSpies:
|
86
|
+
Enabled: false
|
87
|
+
|
88
|
+
RSpec/NamedSubject:
|
89
|
+
Enabled: false
|
90
|
+
|
91
|
+
RSpec/NestedGroups:
|
92
|
+
Enabled: false
|
93
|
+
|
94
|
+
RSpec/NotToNot:
|
95
|
+
EnforcedStyle: to_not
|
96
|
+
|
97
|
+
Style/AndOr:
|
98
|
+
EnforcedStyle: conditionals
|
99
|
+
|
100
|
+
Style/BlockDelimiters:
|
101
|
+
EnforcedStyle: semantic
|
102
|
+
AllowBracesOnProceduralOneLiners: true
|
103
|
+
|
104
|
+
Style/MultilineBlockChain:
|
105
|
+
Enabled: false
|
106
|
+
|
107
|
+
Style/RescueModifier:
|
108
|
+
Enabled: false
|
109
|
+
|
110
|
+
Style/TrailingCommaInArrayLiteral:
|
111
|
+
EnforcedStyleForMultiline: comma
|
112
|
+
|
113
|
+
Style/TrailingCommaInHashLiteral:
|
114
|
+
EnforcedStyleForMultiline: comma
|
115
|
+
|
116
|
+
Metrics:
|
117
|
+
Enabled: false
|
@@ -0,0 +1,139 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'rubocop/cop/mixin/target_rails_version'
|
4
|
+
|
5
|
+
module RuboCop
|
6
|
+
module Cop
|
7
|
+
module Netsoft
|
8
|
+
# This cop is used to identify usages of http methods like `get`, `post`,
|
9
|
+
# `put`, `patch` without the usage of keyword arguments in your tests and
|
10
|
+
# change them to use keyword args. This cop only applies to Rails >= 5.
|
11
|
+
# If you are running Rails < 5 you should disable the
|
12
|
+
# Netsoft/HttpPositionalArguments cop or set your TargetRailsVersion in your
|
13
|
+
# .rubocop.yml file to 4.0, etc.
|
14
|
+
#
|
15
|
+
# @example
|
16
|
+
# # bad
|
17
|
+
# get :new, { user_id: 1}
|
18
|
+
#
|
19
|
+
# # good
|
20
|
+
# get :new, params: { user_id: 1 }
|
21
|
+
class AuthHttpPositionalArguments < Cop
|
22
|
+
extend RuboCop::Cop::TargetRailsVersion
|
23
|
+
|
24
|
+
MSG = 'Use keyword arguments instead of positional arguments for http call: `%<verb>s`.'
|
25
|
+
KEYWORD_ARGS = %i[method params session body flash xhr as headers env].freeze
|
26
|
+
HTTP_METHODS = %i[get post put patch delete head].freeze
|
27
|
+
HTTP_AUTH_METHODS = %i[get_with post_with put_with patch_with delete_with].freeze
|
28
|
+
|
29
|
+
minimum_target_rails_version 5.0
|
30
|
+
|
31
|
+
def_node_matcher :http_request?, <<-PATTERN
|
32
|
+
(send nil? {#{HTTP_METHODS.map(&:inspect).join(' ')}} !nil? $_ ...)
|
33
|
+
PATTERN
|
34
|
+
|
35
|
+
def_node_matcher :http_auth_request?, <<-PATTERN
|
36
|
+
(send nil? {#{HTTP_AUTH_METHODS.map(&:inspect).join(' ')}} !nil? !nil? $_ ...)
|
37
|
+
PATTERN
|
38
|
+
|
39
|
+
def on_send(node)
|
40
|
+
message = format(MSG, verb: node.method_name)
|
41
|
+
|
42
|
+
http_request?(node) do |data|
|
43
|
+
return unless needs_conversion?(data)
|
44
|
+
|
45
|
+
add_offense(node, location: :selector, message: message)
|
46
|
+
end
|
47
|
+
|
48
|
+
http_auth_request?(node) do |data|
|
49
|
+
return unless auth_needs_conversion?(data)
|
50
|
+
|
51
|
+
add_offense(node, location: :selector, message: message)
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
# given a pre Rails 5 method: get :new, {user_id: @user.id}, {}
|
56
|
+
#
|
57
|
+
# @return lambda of auto correct procedure
|
58
|
+
# the result should look like:
|
59
|
+
# get :new, params: { user_id: @user.id }, session: {}
|
60
|
+
# the http_method is the method used to call the controller
|
61
|
+
# the controller node can be a symbol, method, object or string
|
62
|
+
# that represents the path/action on the Rails controller
|
63
|
+
# the data is the http parameters and environment sent in
|
64
|
+
# the Rails 5 http call
|
65
|
+
def autocorrect(node)
|
66
|
+
has_auth = HTTP_AUTH_METHODS.include?(node.method_name.to_sym)
|
67
|
+
if has_auth
|
68
|
+
user, http_path, *data = *node.arguments
|
69
|
+
else
|
70
|
+
http_path, *data = *node.arguments
|
71
|
+
end
|
72
|
+
|
73
|
+
controller_action = http_path.source
|
74
|
+
params = convert_hash_data(data.first, 'params')
|
75
|
+
session = convert_hash_data(data.last, 'session') if data.size > 1
|
76
|
+
# the range of the text to replace, which is the whole line
|
77
|
+
code_to_replace = node.loc.expression
|
78
|
+
# what to replace with
|
79
|
+
format = parentheses_format(node)
|
80
|
+
new_code = format(format, name: node.method_name,
|
81
|
+
action: has_auth ? [user.source, controller_action].join(',') : controller_action,
|
82
|
+
params: params, session: session)
|
83
|
+
->(corrector) { corrector.replace(code_to_replace, new_code) }
|
84
|
+
end
|
85
|
+
|
86
|
+
private
|
87
|
+
|
88
|
+
def needs_conversion?(data)
|
89
|
+
return true unless data.hash_type?
|
90
|
+
|
91
|
+
data.each_pair.none? do |pair|
|
92
|
+
special_keyword_arg?(pair.key) ||
|
93
|
+
format_arg?(pair.key) && data.pairs.one?
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
def auth_needs_conversion?(data)
|
98
|
+
return true unless data.hash_type?
|
99
|
+
|
100
|
+
data.each_pair.none? do |pair|
|
101
|
+
special_keyword_arg?(pair.key) ||
|
102
|
+
format_arg?(pair.key) && data.pairs.one?
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
def special_keyword_arg?(node)
|
107
|
+
node.sym_type? && KEYWORD_ARGS.include?(node.value)
|
108
|
+
end
|
109
|
+
|
110
|
+
def format_arg?(node)
|
111
|
+
node.sym_type? && node.value == :format
|
112
|
+
end
|
113
|
+
|
114
|
+
def convert_hash_data(data, type)
|
115
|
+
return '' if data.hash_type? && data.empty?
|
116
|
+
|
117
|
+
hash_data = if data.hash_type?
|
118
|
+
format('{ %<data>s }',
|
119
|
+
data: data.pairs.map(&:source).join(', '))
|
120
|
+
else
|
121
|
+
# user supplies an object,
|
122
|
+
# no need to surround with braces
|
123
|
+
data.source
|
124
|
+
end
|
125
|
+
|
126
|
+
format(', %<type>s: %<hash_data>s', type: type, hash_data: hash_data)
|
127
|
+
end
|
128
|
+
|
129
|
+
def parentheses_format(node)
|
130
|
+
if parentheses?(node)
|
131
|
+
'%<name>s(%<action>s%<params>s%<session>s)'
|
132
|
+
else
|
133
|
+
'%<name>s %<action>s%<params>s%<session>s'
|
134
|
+
end
|
135
|
+
end
|
136
|
+
end
|
137
|
+
end
|
138
|
+
end
|
139
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
lib = File.expand_path('lib', __dir__)
|
4
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
5
|
+
require 'netsoft/rubocop/version'
|
6
|
+
|
7
|
+
Gem::Specification.new do |spec|
|
8
|
+
spec.name = 'netsoft-rubocop'
|
9
|
+
spec.version = Netsoft::Rubocop::VERSION
|
10
|
+
spec.authors = ['Alex Yarotsky']
|
11
|
+
spec.email = ['alex.yarotsky@hubstaff.com']
|
12
|
+
|
13
|
+
spec.summary = 'Hubstaff style guides and shared style configs.'
|
14
|
+
spec.homepage = 'https://github.com/netsoftHoldings/netsoft-rubocop'
|
15
|
+
|
16
|
+
# Specify which files should be added to the gem when it is released.
|
17
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
18
|
+
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
19
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
20
|
+
end
|
21
|
+
spec.bindir = 'exe'
|
22
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
23
|
+
spec.require_paths = %w[lib]
|
24
|
+
|
25
|
+
spec.add_development_dependency 'bundler', '~> 1.15'
|
26
|
+
spec.add_development_dependency 'rake', '~> 12.0'
|
27
|
+
|
28
|
+
spec.add_runtime_dependency 'rubocop', '~> 0.74.0'
|
29
|
+
spec.add_runtime_dependency 'rubocop-performance', '~> 1.4'
|
30
|
+
spec.add_runtime_dependency 'rubocop-rails', '~> 2.2'
|
31
|
+
spec.add_runtime_dependency 'rubocop-rspec', '~> 1.35'
|
32
|
+
end
|
metadata
ADDED
@@ -0,0 +1,142 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: netsoft-rubocop
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Alex Yarotsky
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2019-09-02 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.15'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.15'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '12.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '12.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rubocop
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 0.74.0
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 0.74.0
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rubocop-performance
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '1.4'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '1.4'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rubocop-rails
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '2.2'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '2.2'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rubocop-rspec
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '1.35'
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '1.35'
|
97
|
+
description:
|
98
|
+
email:
|
99
|
+
- alex.yarotsky@hubstaff.com
|
100
|
+
executables: []
|
101
|
+
extensions: []
|
102
|
+
extra_rdoc_files: []
|
103
|
+
files:
|
104
|
+
- ".circleci/config.yml"
|
105
|
+
- ".gitignore"
|
106
|
+
- ".rubocop.yml"
|
107
|
+
- CHANGELOG.md
|
108
|
+
- Dangerfile
|
109
|
+
- Gemfile
|
110
|
+
- README.md
|
111
|
+
- Rakefile
|
112
|
+
- bin/setup-rubygems.sh
|
113
|
+
- bin/tag_check.sh
|
114
|
+
- default.yml
|
115
|
+
- lib/netsoft/rubocop.rb
|
116
|
+
- lib/netsoft/rubocop/cops/auth_http_positional_arguments.rb
|
117
|
+
- lib/netsoft/rubocop/version.rb
|
118
|
+
- netsoft-rubocop.gemspec
|
119
|
+
homepage: https://github.com/netsoftHoldings/netsoft-rubocop
|
120
|
+
licenses: []
|
121
|
+
metadata: {}
|
122
|
+
post_install_message:
|
123
|
+
rdoc_options: []
|
124
|
+
require_paths:
|
125
|
+
- lib
|
126
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
127
|
+
requirements:
|
128
|
+
- - ">="
|
129
|
+
- !ruby/object:Gem::Version
|
130
|
+
version: '0'
|
131
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
132
|
+
requirements:
|
133
|
+
- - ">="
|
134
|
+
- !ruby/object:Gem::Version
|
135
|
+
version: '0'
|
136
|
+
requirements: []
|
137
|
+
rubyforge_project:
|
138
|
+
rubygems_version: 2.7.7
|
139
|
+
signing_key:
|
140
|
+
specification_version: 4
|
141
|
+
summary: Hubstaff style guides and shared style configs.
|
142
|
+
test_files: []
|