BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
78a3bba6
Commit
78a3bba6
authored
Jan 28, 2017
by
Adam Pahlevi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cop for gem fetched from a git source
code fix for aesthetic & conventions remove unused proc
parent
95ea1407
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
0 deletions
+29
-0
gem_fetcher.rb
rubocop/cop/gem_fetcher.rb
+28
-0
rubocop.rb
rubocop/rubocop.rb
+1
-0
No files found.
rubocop/cop/gem_fetcher.rb
0 → 100644
View file @
78a3bba6
module
RuboCop
module
Cop
# Cop that checks for all gems specified in the Gemfile, and will
# alert if any gem is to be fetched not from the RubyGems index.
# This enforcement is done so as to minimize external build
# dependencies and build times.
class
GemFetcher
<
RuboCop
::
Cop
::
Cop
MSG
=
'Do not use gems from git repositories, only use gems from RubyGems.'
GIT_KEYS
=
[
:git
,
:github
]
def
on_send
(
node
)
file_path
=
node
.
location
.
expression
.
source_buffer
.
name
return
unless
file_path
.
end_with?
(
"Gemfile"
)
func_name
=
node
.
children
[
1
]
return
unless
func_name
==
:gem
node
.
children
.
last
.
each_node
(
:pair
)
do
|
pair
|
key_name
=
pair
.
children
[
0
].
children
[
0
].
to_sym
if
GIT_KEYS
.
include?
(
key_name
)
add_offense
(
node
,
:selector
)
end
end
end
end
end
end
rubocop/rubocop.rb
View file @
78a3bba6
require_relative
'migration_helpers'
require_relative
'cop/migration/add_index'
require_relative
'cop/migration/column_with_default'
require_relative
'cop/gem_fetcher'
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment