Skip to content

Commit

Permalink
check if dir exists and is not a link
Browse files Browse the repository at this point in the history
  • Loading branch information
richm committed Aug 24, 2021
1 parent 4856081 commit 461fe5b
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions report-modules-plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -411,17 +411,19 @@ def handle_item(item, filectx):


def os_walk(from_path):
for (dirpath, _, filenames) in os.walk(from_path):
for filename in filenames:
filepath = os.path.join(dirpath, filename)
yield filepath
if os.path.isdir(from_path) and not os.path.islink(from_path):
for (dirpath, _, filenames) in os.walk(from_path):
for filename in filenames:
filepath = os.path.join(dirpath, filename)
yield filepath


def os_listdir(from_path):
for dirent in os.scandir(from_path):
if dirent.is_symlink():
continue
yield dirent.name, dirent.path
if os.path.isdir(from_path) and not os.path.islink(from_path):
for dirent in os.scandir(from_path):
if dirent.is_symlink():
continue
yield dirent.name, dirent.path


def process_yml_file(filepath, ctx):
Expand Down

0 comments on commit 461fe5b

Please sign in to comment.