@@ -86,8 +86,8 @@ impl Rule for HL1002 {
8686 }
8787
8888 fn check ( & self , ctx : & LintContext ) -> Vec < CheckFailure > {
89- if let Some ( chart) = ctx. chart_metadata {
90- if !chart. has_valid_api_version ( ) {
89+ if let Some ( chart) = ctx. chart_metadata
90+ && !chart. has_valid_api_version ( ) {
9191 let version = match & chart. api_version {
9292 ApiVersion :: Unknown ( v) => v. clone ( ) ,
9393 _ => "unknown" . to_string ( ) ,
@@ -101,7 +101,6 @@ impl Rule for HL1002 {
101101 RuleCategory :: Structure ,
102102 ) ] ;
103103 }
104- }
105104 vec ! [ ]
106105 }
107106}
@@ -127,8 +126,8 @@ impl Rule for HL1003 {
127126 }
128127
129128 fn check ( & self , ctx : & LintContext ) -> Vec < CheckFailure > {
130- if let Some ( chart) = ctx. chart_metadata {
131- if chart. name . is_empty ( ) {
129+ if let Some ( chart) = ctx. chart_metadata
130+ && chart. name . is_empty ( ) {
132131 return vec ! [ CheckFailure :: new(
133132 "HL1003" ,
134133 Severity :: Error ,
@@ -138,7 +137,6 @@ impl Rule for HL1003 {
138137 RuleCategory :: Structure ,
139138 ) ] ;
140139 }
141- }
142140 vec ! [ ]
143141 }
144142}
@@ -164,8 +162,8 @@ impl Rule for HL1004 {
164162 }
165163
166164 fn check ( & self , ctx : & LintContext ) -> Vec < CheckFailure > {
167- if let Some ( chart) = ctx. chart_metadata {
168- if chart. version . is_empty ( ) {
165+ if let Some ( chart) = ctx. chart_metadata
166+ && chart. version . is_empty ( ) {
169167 return vec ! [ CheckFailure :: new(
170168 "HL1004" ,
171169 Severity :: Error ,
@@ -175,7 +173,6 @@ impl Rule for HL1004 {
175173 RuleCategory :: Structure ,
176174 ) ] ;
177175 }
178- }
179176 vec ! [ ]
180177 }
181178}
@@ -201,8 +198,8 @@ impl Rule for HL1005 {
201198 }
202199
203200 fn check ( & self , ctx : & LintContext ) -> Vec < CheckFailure > {
204- if let Some ( chart) = ctx. chart_metadata {
205- if !chart. version . is_empty ( ) && !is_valid_semver ( & chart. version ) {
201+ if let Some ( chart) = ctx. chart_metadata
202+ && !chart. version . is_empty ( ) && !is_valid_semver ( & chart. version ) {
206203 return vec ! [ CheckFailure :: new(
207204 "HL1005" ,
208205 Severity :: Warning ,
@@ -215,7 +212,6 @@ impl Rule for HL1005 {
215212 RuleCategory :: Structure ,
216213 ) ] ;
217214 }
218- }
219215 vec ! [ ]
220216 }
221217}
@@ -241,13 +237,13 @@ impl Rule for HL1006 {
241237 }
242238
243239 fn check ( & self , ctx : & LintContext ) -> Vec < CheckFailure > {
244- if let Some ( chart) = ctx. chart_metadata {
245- if chart. description . is_none ( )
240+ if let Some ( chart) = ctx. chart_metadata
241+ && ( chart. description . is_none ( )
246242 || chart
247243 . description
248244 . as_ref ( )
249245 . map ( |d| d. is_empty ( ) )
250- . unwrap_or ( true )
246+ . unwrap_or ( true ) )
251247 {
252248 return vec ! [ CheckFailure :: new(
253249 "HL1006" ,
@@ -258,7 +254,6 @@ impl Rule for HL1006 {
258254 RuleCategory :: Structure ,
259255 ) ] ;
260256 }
261- }
262257 vec ! [ ]
263258 }
264259}
@@ -284,8 +279,8 @@ impl Rule for HL1007 {
284279 }
285280
286281 fn check ( & self , ctx : & LintContext ) -> Vec < CheckFailure > {
287- if let Some ( chart) = ctx. chart_metadata {
288- if chart. maintainers . is_empty ( ) {
282+ if let Some ( chart) = ctx. chart_metadata
283+ && chart. maintainers . is_empty ( ) {
289284 return vec ! [ CheckFailure :: new(
290285 "HL1007" ,
291286 Severity :: Info ,
@@ -295,7 +290,6 @@ impl Rule for HL1007 {
295290 RuleCategory :: Structure ,
296291 ) ] ;
297292 }
298- }
299293 vec ! [ ]
300294 }
301295}
@@ -321,8 +315,8 @@ impl Rule for HL1008 {
321315 }
322316
323317 fn check ( & self , ctx : & LintContext ) -> Vec < CheckFailure > {
324- if let Some ( chart) = ctx. chart_metadata {
325- if chart. is_deprecated ( ) {
318+ if let Some ( chart) = ctx. chart_metadata
319+ && chart. is_deprecated ( ) {
326320 return vec ! [ CheckFailure :: new(
327321 "HL1008" ,
328322 Severity :: Warning ,
@@ -332,7 +326,6 @@ impl Rule for HL1008 {
332326 RuleCategory :: Structure ,
333327 ) ] ;
334328 }
335- }
336329 vec ! [ ]
337330 }
338331}
@@ -359,11 +352,10 @@ impl Rule for HL1009 {
359352
360353 fn check ( & self , ctx : & LintContext ) -> Vec < CheckFailure > {
361354 // Skip for library charts
362- if let Some ( chart) = ctx. chart_metadata {
363- if chart. is_library ( ) {
355+ if let Some ( chart) = ctx. chart_metadata
356+ && chart. is_library ( ) {
364357 return vec ! [ ] ;
365358 }
366- }
367359
368360 let has_templates = ctx
369361 . files
@@ -466,8 +458,8 @@ impl Rule for HL1012 {
466458 }
467459
468460 fn check ( & self , ctx : & LintContext ) -> Vec < CheckFailure > {
469- if let Some ( chart) = ctx. chart_metadata {
470- if !is_valid_chart_name ( & chart. name ) {
461+ if let Some ( chart) = ctx. chart_metadata
462+ && !is_valid_chart_name ( & chart. name ) {
471463 return vec ! [ CheckFailure :: new(
472464 "HL1012" ,
473465 Severity :: Error ,
@@ -480,7 +472,6 @@ impl Rule for HL1012 {
480472 RuleCategory :: Structure ,
481473 ) ] ;
482474 }
483- }
484475 vec ! [ ]
485476 }
486477}
@@ -506,9 +497,9 @@ impl Rule for HL1013 {
506497 }
507498
508499 fn check ( & self , ctx : & LintContext ) -> Vec < CheckFailure > {
509- if let Some ( chart) = ctx. chart_metadata {
510- if let Some ( icon) = & chart. icon {
511- if icon. starts_with ( "http://" ) {
500+ if let Some ( chart) = ctx. chart_metadata
501+ && let Some ( icon) = & chart. icon
502+ && icon. starts_with ( "http://" ) {
512503 return vec ! [ CheckFailure :: new(
513504 "HL1013" ,
514505 Severity :: Warning ,
@@ -518,8 +509,6 @@ impl Rule for HL1013 {
518509 RuleCategory :: Structure ,
519510 ) ] ;
520511 }
521- }
522- }
523512 vec ! [ ]
524513 }
525514}
@@ -545,9 +534,9 @@ impl Rule for HL1014 {
545534 }
546535
547536 fn check ( & self , ctx : & LintContext ) -> Vec < CheckFailure > {
548- if let Some ( chart) = ctx. chart_metadata {
549- if let Some ( home) = & chart. home {
550- if home. starts_with ( "http://" ) {
537+ if let Some ( chart) = ctx. chart_metadata
538+ && let Some ( home) = & chart. home
539+ && home. starts_with ( "http://" ) {
551540 return vec ! [ CheckFailure :: new(
552541 "HL1014" ,
553542 Severity :: Warning ,
@@ -557,8 +546,6 @@ impl Rule for HL1014 {
557546 RuleCategory :: Structure ,
558547 ) ] ;
559548 }
560- }
561- }
562549 vec ! [ ]
563550 }
564551}
0 commit comments