Specify base branch for flake8 comparison (#5796)
Internally we work against a branch named 'llnl/develop', which mirrors the public repository's `develop` branch. It's useful to be able to run flake8 on our changes, using `llnl/develop` as the base branch instead of `develop`. Internally the flake8 subcommand generates the list of changes files using a hardcoded range of `develop...`. This makes the base of that range a command line option, with a default of `develop`. That lets us do this: ``` spack flake8 --base llnl/develop ``` which uses a range of `llnl/develop...`.
This commit is contained in:
		 George Hartzell
					George Hartzell
				
			
				
					committed by
					
						 Todd Gamblin
						Todd Gamblin
					
				
			
			
				
	
			
			
			 Todd Gamblin
						Todd Gamblin
					
				
			
						parent
						
							d839012e00
						
					
				
				
					commit
					b43064190c
				
			| @@ -115,9 +115,11 @@ def changed_files(args): | |||||||
|  |  | ||||||
|     git = which('git', required=True) |     git = which('git', required=True) | ||||||
|  |  | ||||||
|  |     range = "{0}...".format(args.base) | ||||||
|  |  | ||||||
|     git_args = [ |     git_args = [ | ||||||
|         # Add changed files committed since branching off of develop |         # Add changed files committed since branching off of develop | ||||||
|         ['diff', '--name-only', '--diff-filter=ACMR', 'develop...'], |         ['diff', '--name-only', '--diff-filter=ACMR', range], | ||||||
|         # Add changed files that have been staged but not yet committed |         # Add changed files that have been staged but not yet committed | ||||||
|         ['diff', '--name-only', '--diff-filter=ACMR', '--cached'], |         ['diff', '--name-only', '--diff-filter=ACMR', '--cached'], | ||||||
|         # Add changed files that are unstaged |         # Add changed files that are unstaged | ||||||
| @@ -209,6 +211,9 @@ def filter_file(source, dest, output=False): | |||||||
|  |  | ||||||
|  |  | ||||||
| def setup_parser(subparser): | def setup_parser(subparser): | ||||||
|  |     subparser.add_argument( | ||||||
|  |         '-b', '--base', action='store', default='develop', | ||||||
|  |         help="select base branch for collecting list of modified files") | ||||||
|     subparser.add_argument( |     subparser.add_argument( | ||||||
|         '-k', '--keep-temp', action='store_true', |         '-k', '--keep-temp', action='store_true', | ||||||
|         help="do not delete temporary directory where flake8 runs. " |         help="do not delete temporary directory where flake8 runs. " | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user