File tree 4 files changed +28
-8
lines changed
4 files changed +28
-8
lines changed Original file line number Diff line number Diff line change @@ -65,14 +65,23 @@ def run
65
65
full_base_path_uri += '/' unless full_base_path_uri . end_with? ( '/' )
66
66
67
67
path = path . gsub ( File ::ALT_SEPARATOR , File ::SEPARATOR ) if File ::ALT_SEPARATOR
68
- path = if File . directory? ( path )
69
- Dir . glob ( [
70
- "#{ path } /**/*.pp" ,
71
- "#{ path } /**/*.{yaml,yml}" ,
72
- ] )
73
- else
74
- @args
75
- end
68
+
69
+ if PuppetLint . configuration . read_paths
70
+ paths_from_path = [ ]
71
+ File . readlines ( path , chomp : true ) . each do |line |
72
+ paths_from_path . append ( line )
73
+ end
74
+ path = paths_from_path
75
+ else
76
+ path = if File . directory? ( path )
77
+ Dir . glob ( [
78
+ "#{ path } /**/*.pp" ,
79
+ "#{ path } /**/*.{yaml,yml}" ,
80
+ ] )
81
+ else
82
+ @args
83
+ end
84
+ end
76
85
77
86
PuppetLint . configuration . with_filename = true if path . length > 1
78
87
Original file line number Diff line number Diff line change @@ -154,5 +154,6 @@ def defaults
154
154
self . ignore_paths = [ 'vendor/**/*.pp' ]
155
155
self . github_actions = ENV . key? ( 'GITHUB_ACTION' )
156
156
self . codeclimate_report_file = ENV . fetch ( 'CODECLIMATE_REPORT_FILE' , nil )
157
+ self . read_paths = false
157
158
end
158
159
end
Original file line number Diff line number Diff line change @@ -132,6 +132,10 @@ def self.build(args = [])
132
132
PuppetLint . configuration . top_scope_variables = vars . split ( ',' )
133
133
end
134
134
135
+ opts . on ( '--read-paths' , 'Threat PATH as a file containing puppet manifest paths.' ) do
136
+ PuppetLint . configuration . read_paths = true
137
+ end
138
+
135
139
PuppetLint . configuration . checks . each do |check |
136
140
opts . on ( "--no-#{ check } -check" , "Skip the #{ check } check." ) do
137
141
PuppetLint . configuration . send ( :"disable_#{ check } " )
Original file line number Diff line number Diff line change 42
42
result = puppet_lint ( [ File . join ( manifest_root , 'two_warnings.pp' ) ] )
43
43
expect ( result [ :stdout ] ) . to have_warnings ( 2 )
44
44
end
45
+
46
+ it 'reads paths from file' do
47
+ result = puppet_lint ( [ '--read-paths' , File . join ( manifest_root , 'list' ) ] )
48
+ expect ( result [ :stdout ] ) . to have_warnings ( 1 )
49
+ expect ( result [ :stdout ] ) . to have_errors ( 1 )
50
+ end
45
51
end
46
52
47
53
context 'with a YAML file provided' do
You can’t perform that action at this time.
0 commit comments