def _get_all_files():
 jscsrc_path = os.path.join(os.getcwd(), '.jscsrc')
 parsed_args = _PARSER.parse_args()
 if parsed_args.path:
  input_path = os.path.join(os.getcwd(), parsed_args.path)
  if (not os.path.exists(input_path)):
   print ('Could not locate file or directory %s. Exiting.' % input_path)
   print '----------------------------------------'
   sys.exit(1)
  if os.path.isfile(input_path):
   all_files = [input_path]
  else:
   excluded_glob_patterns = _get_glob_patterns_excluded_from_jscsrc(jscsrc_path)
   all_files = _get_all_files_in_directory(input_path, excluded_glob_patterns)
 elif parsed_args.files:
  valid_filepaths = []
  invalid_filepaths = []
  for f in parsed_args.files:
   if os.path.isfile(f):
    valid_filepaths.append(f)
   else:
    invalid_filepaths.append(f)
  if invalid_filepaths:
   print ('The following file(s) do not exist: %s\nExiting.' % invalid_filepaths)
   sys.exit(1)
  all_files = valid_filepaths
 else:
  all_files = _get_changed_filenames()
 return all_files

def _get_all_files ( ) : jscsrc_path = os . path . join ( os . getcwd ( ) , '.jscsrc' ) parsed_args = _PARSER . parse_args ( ) if parsed_args . path : input_path = os . path . join ( os . getcwd ( ) , parsed_args . path ) if ( not os . path . exists ( input_path ) ) : print ( 'Could not locate file or directory %s. Exiting.' % input_path ) print '----------------------------------------' sys . exit ( 1 ) if os . path . isfile ( input_path ) : all_files = [ input_path ] else : excluded_glob_patterns = _get_glob_patterns_excluded_from_jscsrc ( jscsrc_path ) all_files = _get_all_files_in_directory ( input_path , excluded_glob_patterns ) elif parsed_args . files : valid_filepaths = [ ] invalid_filepaths = [ ] for f in parsed_args . files : if os . path . isfile ( f ) : valid_filepaths . append ( f ) else : invalid_filepaths . append ( f ) if invalid_filepaths : print ( 'The following file(s) do not exist: %s\nExiting.' % invalid_filepaths ) sys . exit ( 1 ) all_files = valid_filepaths else : all_files = _get_changed_filenames ( ) return all_files
this function is used to check if this script is ran from root directory and to return a list of all the files for linting and pattern checks .