Skip to content

Commit f14f81e

Browse files
dafyddcrosbyfacebook-github-bot
authored andcommitted
Fix compact class CI errors (facebook#293)
Summary: Note: this based on top of the shipit sync PR facebook#292 Pull Request resolved: facebook#293 Differential Revision: D70406994 fbshipit-source-id: 80bcbe374c647c90142c73feda098e9885f7e0c7
1 parent 586dffa commit f14f81e

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

.cookstyle.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,14 @@ AllCops:
1111
Lint/Syntax:
1212
Enabled: true
1313

14+
# Generally speaking, we don't want to use compact class definitions in Chef
15+
# because it opens the codebase to runtime constant-load failures. However, we
16+
# control the load path of Cookstyle, and the deep nesting of class definitions
17+
# make readability difficult.
18+
Style/ClassAndModuleChildren:
19+
Exclude:
20+
- !ruby/regexp /^.*\/cookstyle\/.*\.rb$/
21+
1422
Chef/Correctness/BlockGuardWithOnlyString:
1523
Enabled: true
1624
Chef/Correctness/ChefApplicationFatal:

cookstyle/helpers.rb

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,16 @@
1717
def fb_msg(msg)
1818
"#{msg} (https://github.com/facebook/chef-cookbooks)".freeze
1919
end
20+
21+
# Predefine modules for compact style, cannot be compact
22+
module RuboCop # rubocop:disable Chef/Meta/CookstyleCompactClassStyle
23+
module Cop
24+
module Chef
25+
module Meta
26+
class Base < RuboCop::Cop::Base
27+
prepend RuboCop::Cop
28+
end
29+
end
30+
end
31+
end
32+
end

0 commit comments

Comments
 (0)