@@ -4,7 +4,7 @@ use crate::analysis::parsing::{statement::{self, CompoundContent, ForContent,
44 SwitchCase , WhileContent } ,
55 structure:: ObjectStatementsContent ,
66 types:: { BitfieldsContent , LayoutContent , StructTypeContent } } ;
7- use crate :: span:: { Range , ZeroIndexed , Row , Column } ;
7+ use crate :: span:: { Range , ZeroIndexed } ;
88use crate :: analysis:: LocalDMLError ;
99use crate :: analysis:: parsing:: tree:: { ZeroRange , Content , TreeElement } ;
1010use serde:: { Deserialize , Serialize } ;
@@ -27,9 +27,6 @@ pub fn setup_indentation_size(cfg: &mut LintCfg) {
2727 if let Some ( in3) = & mut cfg. in3 {
2828 in3. indentation_spaces = indentation_spaces;
2929 }
30- if let Some ( in6) = & mut cfg. in6 {
31- in6. indentation_spaces = indentation_spaces;
32- }
3330 if let Some ( in9) = & mut cfg. in9 {
3431 in9. indentation_spaces = indentation_spaces;
3532 }
@@ -251,92 +248,6 @@ impl Rule for IN3Rule {
251248 }
252249}
253250
254- // IN6: Continuation Line
255- #[ derive( Clone , Debug , Serialize , Deserialize , PartialEq ) ]
256- pub struct IN6Options {
257- #[ serde( default = "default_indentation_spaces" ) ]
258- pub indentation_spaces : u32 ,
259- }
260-
261- pub struct IN6Rule {
262- pub enabled : bool ,
263- pub indentation_spaces : u32 ,
264- }
265-
266- impl IN6Rule {
267- pub fn from_options ( options : & Option < IN6Options > ) -> IN6Rule {
268- match options {
269- Some ( in6) => IN6Rule {
270- enabled : true ,
271- indentation_spaces : in6. indentation_spaces ,
272- } ,
273- None => IN6Rule {
274- enabled : false ,
275- indentation_spaces : 0 ,
276- } ,
277- }
278- }
279-
280- pub fn check ( & self , acc : & mut Vec < DMLStyleError > , lines : & [ & str ] ) {
281- if !self . enabled {
282- return ;
283- }
284-
285- let arithmetic_operators = [ "+" , "-" , "*" , "/" , "%" , "=" ] ;
286- let comparison_operators = [ "==" , "!=" , "<" , ">" , "<=" , ">=" ] ;
287- let logical_operators = [ "&&" , "||" ] ;
288- let bitwise_operators = [ "&" , "|" , "<<" , ">>" ] ;
289-
290- let operators = [
291- & arithmetic_operators[ ..] ,
292- & comparison_operators[ ..] ,
293- & logical_operators[ ..] ,
294- & bitwise_operators[ ..] ,
295- ] ;
296-
297- for ( i, line) in lines. iter ( ) . enumerate ( ) {
298- if let Some ( last_char) = line. trim ( ) . chars ( ) . last ( ) {
299- if operators. iter ( ) . any ( |ops| ops. contains ( & last_char. to_string ( ) . as_str ( ) ) ) {
300- let next_line = lines. get ( i + 1 ) ;
301- if let Some ( next_line) = next_line {
302- let expected_indent = line. chars ( ) . take_while ( |c| c. is_whitespace ( ) ) . count ( ) + self . indentation_spaces as usize ;
303- let actual_indent = next_line. chars ( ) . take_while ( |c| c. is_whitespace ( ) ) . count ( ) ;
304- if actual_indent != expected_indent {
305- let msg = IN6Rule :: description ( ) . to_owned ( ) ;
306- let dmlerror = DMLStyleError {
307- error : LocalDMLError {
308- range : Range :: new (
309- Row :: new_zero_indexed ( ( i + 1 ) as u32 ) ,
310- Row :: new_zero_indexed ( ( i + 1 ) as u32 ) ,
311- Column :: new_zero_indexed ( 0 ) ,
312- Column :: new_zero_indexed ( next_line. len ( ) as u32 )
313- ) ,
314- description : msg,
315- } ,
316- rule_type : Self :: get_rule_type ( ) ,
317- } ;
318- acc. push ( dmlerror) ;
319- }
320- }
321- }
322- }
323- }
324- }
325- }
326-
327- impl Rule for IN6Rule {
328- fn name ( ) -> & ' static str {
329- "IN6_CONTINUATION_LINE"
330- }
331-
332- fn description ( ) -> & ' static str {
333- "Continuation line not indented correctly."
334- }
335- fn get_rule_type ( ) -> RuleType {
336- RuleType :: IN6
337- }
338- }
339-
340251pub struct IN9Rule {
341252 pub enabled : bool ,
342253 indentation_spaces : u32
0 commit comments