Skip to content

Commit

Permalink
Exclude symlinks when VALIDATE_ALL_CODEBASE = false (#2964)
Browse files Browse the repository at this point in the history
Fixes #2944
  • Loading branch information
nvuillam authored Sep 19, 2023
1 parent fcec4aa commit 1300aa0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,15 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),

Note: Can be used with `oxsecurity/megalinter@beta` in your GitHub Action mega-linter.yml file, or with `oxsecurity/megalinter:beta` docker image

- Upgrade python to 3.11.5
- Workflow job name changed from `build` to `megalinter` to prevent conflicts with other workflows
- Secretlint logo - reduce size to 150 and remove background
- Add support for master branch in TEMPLATES/mega-linter.yml, by @rasa
- Fix rstcheck options & install
- Deprecate SCSS LINT as not maintained anymore (<https://github.com/sds/scss-lint#notice-consider-other-tools-before-adopting-scss-lint>)
- Replace `https://megalinter.io/flavors` with `https://megalinter.io/latest/flavors` to avoid lychee 404 error
- Fix [v7 issue when using MEGALINTER_FILES_TO_LINT](https://github.com/oxsecurity/megalinter/issues/2744) ( thanks @pfiaux !)
- Upgrade python to 3.11.5
- Fix [Ignore symlink files when VALIDATE_ALL_CODEBASE is false](https://github.com/oxsecurity/megalinter/issues/2944)

- Media
- [Maximize your code consistency with Megalinter](https://codewithme.cloud/posts/2023/08/maximize-your-code-consistency-with-megalinter/) by [Tor Ivar Asbølmo](https://www.linkedin.com/in/torivara/) on [codewithme.cloud](https://codewithme.cloud)
Expand Down
6 changes: 4 additions & 2 deletions megalinter/MegaLinter.py
Original file line number Diff line number Diff line change
Expand Up @@ -753,12 +753,14 @@ def list_files_git_diff(self):
local_ref = f"refs/remotes/{default_branch_remote}"
# Try to fetch default_branch from origin, because it'sn't cached locally.
repo.git.fetch("origin", f"{remote_ref}:{local_ref}")
# Make git diff to list files
# Make git diff to list files (and exclude symlinks)
diff = repo.git.diff(default_branch_remote, name_only=True)
logging.info(f"Modified files:\n{diff}")
all_files = list()
for diff_line in diff.splitlines():
if os.path.isfile(self.workspace + os.path.sep + diff_line):
if os.path.isfile(
self.workspace + os.path.sep + diff_line
) and not os.path.islink(self.workspace + os.path.sep + diff_line):
all_files += [diff_line]
return all_files

Expand Down

0 comments on commit 1300aa0

Please sign in to comment.