mirror of
				https://github.com/subsurface/subsurface.git
				synced 2025-02-19 22:16:15 +00:00 
			
		
		
		
	Add a simplistic tool to clean up whitespace
This hasn't been tested enought, but it seems to get really close. It assumes that clang-format is in your patch. Run perl scripys/whitespace.pl FILENAME and you'll get a diff of what it things is wrong with that file. If you like what you see, simply pipe the output into patch -p0 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
		
							parent
							
								
									23baf20f56
								
							
						
					
					
						commit
						933d44083e
					
				
					 2 changed files with 31 additions and 0 deletions
				
			
		
							
								
								
									
										20
									
								
								.clang-format
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								.clang-format
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,20 @@ | ||||||
|  | AlignEscapedNewlinesLeft: true | ||||||
|  | AccessModifierOffset: -8 # so public: and private: stays at the left site | ||||||
|  | AllowAllParametersOfDeclarationOnNextLine: false | ||||||
|  | BinPackParameters: true | ||||||
|  | BreakBeforeBinaryOperators: false | ||||||
|  | BreakBeforeBraces: Linux | ||||||
|  | BreakBeforeTernaryOperators: false | ||||||
|  | BreakConstructorInitializersBeforeComma: false | ||||||
|  | ConstructorInitializerAllOnOneLineOrOnePerLine: true | ||||||
|  | ColumnLimit: 0 | ||||||
|  | IndentFunctionDeclarationAfterType: false #personal taste, good for long methods | ||||||
|  | IndentWidth: 8 | ||||||
|  | MaxEmptyLinesToKeep: 2 | ||||||
|  | NamespaceIndentation: All | ||||||
|  | SpaceBeforeAssignmentOperators: true | ||||||
|  | # doesn't work --> SpaceBeforeParens: ControlStatements | ||||||
|  | SpacesInParentheses: false | ||||||
|  | SpacesBeforeTrailingComments: 1 | ||||||
|  | UseTab: Always | ||||||
|  | PointerBindsToType: false | ||||||
							
								
								
									
										11
									
								
								scripts/whitespace.pl
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								scripts/whitespace.pl
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,11 @@ | ||||||
|  | #! /usr/bin/perl | ||||||
|  | 
 | ||||||
|  | my $input = $ARGV[0]; | ||||||
|  | my $source = `clang-format $input`; | ||||||
|  | $source =~ s/^(.*each.*\(.*\).*)\n\s*{\s*$/$1 {/img; | ||||||
|  | $source =~ s/^(.*struct.*)\n\s*{\s*$/$1 {/img; | ||||||
|  | $source =~ s/^(.*class.*)\n\s*{\s*$/$1 {/img; | ||||||
|  | $source =~ s/^(\S*::\S*.*)\n\s*: /$1 :\n\t/img; | ||||||
|  | $source =~ s/(?:\G|^)[ ]{6}/\t/mg; | ||||||
|  | open (DIFF, "| diff -u $input -"); | ||||||
|  | print DIFF $source ; | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue