Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
ab2eb49f
Commit
ab2eb49f
authored
Sep 10, 2020
by
Peter Leitzen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Configure excluded directories for Gitlab/RailsLogger cop
Avoid programmatic checks because they are slower as well.
parent
ba920779
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
16 deletions
+5
-16
.rubocop.yml
.rubocop.yml
+5
-0
rubocop/cop/gitlab/rails_logger.rb
rubocop/cop/gitlab/rails_logger.rb
+0
-16
No files found.
.rubocop.yml
View file @
ab2eb49f
...
@@ -543,3 +543,8 @@ Migration/CreateTableWithForeignKeys:
...
@@ -543,3 +543,8 @@ Migration/CreateTableWithForeignKeys:
# Disable this cop for all the existing migrations
# Disable this cop for all the existing migrations
Exclude
:
Exclude
:
-
!ruby/regexp
/\Adb\/(?:post_)?migrate\/(?:201[0-9]\d+|20200[0-8][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9])_.+\.rb\z/
-
!ruby/regexp
/\Adb\/(?:post_)?migrate\/(?:201[0-9]\d+|20200[0-8][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9])_.+\.rb\z/
Gitlab/RailsLogger
:
Exclude
:
-
'
spec/**/*.rb'
-
'
ee/spec/**/*.rb'
rubocop/cop/gitlab/rails_logger.rb
View file @
ab2eb49f
...
@@ -24,27 +24,11 @@ module RuboCop
...
@@ -24,27 +24,11 @@ module RuboCop
(send (const nil? :Rails) :logger ... )
(send (const nil? :Rails) :logger ... )
PATTERN
PATTERN
WHITELISTED_DIRECTORIES
=
%w[
spec
]
.
freeze
def
on_send
(
node
)
def
on_send
(
node
)
return
if
in_whitelisted_directory?
(
node
)
return
unless
rails_logger?
(
node
)
return
unless
rails_logger?
(
node
)
add_offense
(
node
,
location: :expression
)
add_offense
(
node
,
location: :expression
)
end
end
def
in_whitelisted_directory?
(
node
)
path
=
file_path_for_node
(
node
)
WHITELISTED_DIRECTORIES
.
any?
do
|
directory
|
path
.
start_with?
(
File
.
join
(
rails_root
,
directory
),
File
.
join
(
rails_root
,
'ee'
,
directory
)
)
end
end
end
end
end
end
end
end
...
...
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