Skip to content

Commit

Permalink
fixup! [#64] Implement copy/paste protection checks
Browse files Browse the repository at this point in the history
Review: fix config, README, CHANGES
  • Loading branch information
YuriRomanowski committed Dec 23, 2022
1 parent d497a1b commit 2e0d0f6
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 4 deletions.
2 changes: 2 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ Unreleased
* [#231](https://github.com/serokell/xrefcheck/pull/231)
+ Anchor analysis takes now into account the appropriate case-sensitivity depending on
the configured Markdown flavour.
* [#245](https://github.com/serokell/xrefcheck/pull/245)
+ Now xrefcheck is able to detect possible copy-pastes relying on links and their names.

0.2.2
==========
Expand Down
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ Comparing to alternative solutions, this tool tries to achieve the following poi
* Supports relative and absolute local links.
* Supports external links (`http`, `https`, `ftp` and `ftps`).
* Detects broken and ambiguous anchors in local links.
* Detects possible bad copy-pastes of links.
* Integration with GitHub Actions.

## Dependencies [](#xrefcheck)
Expand Down Expand Up @@ -148,6 +149,16 @@ There are several ways to fix this:
* By default, `xrefcheck` will ignore links to localhost.
* This behavior can be disabled by removing the corresponding entry from the `ignoreExternalRefsTo` list in the config file.

1. How does the copy-paste check work?
* If there are some references with the same links and for one of them name is similar to the link itself, other links may turn out to be copypasted from that link. Example:
```md
Links with bad copypaste:
[good link](https://good.link.uri/).
[copypasted link](https://good.link.uri/).
```
The second link will be reported by `xrefcheck` as a possible bad copy-paste of the first link.
* This checks both external references and local ones.

## Further work [↑](#xrefcheck)

- [ ] Support link detection in different languages, not only Markdown.
Expand Down
4 changes: 2 additions & 2 deletions src/Xrefcheck/Config/Default.hs
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ scanners:
# This affects which anchors are generated for headers.
flavor: #s{flavor}

# Whether copy-paste check is enabled globally.
copyPasteCheckEnabled: True
# Whether the copy-paste check is enabled globally.
copyPasteCheckEnabled: true
|]
where
ignoreLocalRefsFrom :: NonEmpty Text
Expand Down
4 changes: 2 additions & 2 deletions tests/configs/github-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,5 @@ scanners:
# This affects which anchors are generated for headers.
flavor: GitHub

# Whether copy-paste check is enabled globally.
copyPasteCheckEnabled: True
# Whether the copy-paste check is enabled globally.
copyPasteCheckEnabled: true

0 comments on commit 2e0d0f6

Please sign in to comment.