-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Problem: As GitHub and GitLab do not render symlinks as the file they point to, we are considering to implement a new scanner for symlinks that verifies them up to some extent. Solution: A scanner that validates the reference from a symlink has been implemented in the same style as the markdown scanner.
- Loading branch information
Showing
16 changed files
with
223 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
{- SPDX-FileCopyrightText: 2023 Serokell <https://serokell.io> | ||
- | ||
- SPDX-License-Identifier: MPL-2.0 | ||
-} | ||
|
||
-- | Scanner for gathering references to verify from symlinks. | ||
-- | ||
-- A symlink's reference corresponds to the file it points to. | ||
module Xrefcheck.Scanners.Symlink | ||
( symlinkScanner | ||
, symlinkSupport | ||
) where | ||
|
||
import Universum | ||
|
||
import System.Directory (getSymbolicLinkTarget) | ||
|
||
import Xrefcheck.Core | ||
import Xrefcheck.Scan | ||
import Xrefcheck.System | ||
|
||
symlinkScanner :: ScanAction | ||
symlinkScanner root path = do | ||
rLink <- unRelPosixLink . mkRelPosixLink | ||
<$> getSymbolicLinkTarget (filePathFromRoot root path) | ||
|
||
let rName = "Symbolic Link" | ||
rPos = Position Nothing | ||
rInfo = referenceInfo rLink | ||
|
||
pure (FileInfo [Reference {rName, rPos, rInfo}] [], []) | ||
|
||
symlinkSupport :: FileSupport | ||
symlinkSupport isSymlink _ = do | ||
guard isSymlink | ||
pure symlinkScanner |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# SPDX-FileCopyrightText: 2023 Serokell <https://serokell.io> | ||
# | ||
# SPDX-License-Identifier: Unlicense | ||
|
||
exclusions: | ||
ignore: | ||
- broken.md | ||
- outside.md | ||
|
||
scanners: | ||
markdown: | ||
flavor: GitHub |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,4 @@ | |
|
||
[Empty file](a) | ||
|
||
[Symlink ref](../s.md) | ||
|
||
[Symlink ref with anchor](../s.md#a) | ||
[Some symlink](../ok.md) |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.