Commit Graph

379 Commits

Author SHA1 Message Date
Andrei Borzenkov
a6b4513587 [#95] Support HTML tag parsing compatible with HTML spec
Problem: We had hardcoded HTML tag parser, that doesn't work with add valid HTML tags

Solution: Replace it with `tagsoup` library, that care about all parsing stuff
2022-07-17 20:48:51 +04:00
Andrei Borzenkov
e4af3c7310
Merge pull request #114 from serokell/Player205/#113-Improve-help-message
[#113] Improve error message of dump-config option
2022-07-15 17:02:29 +04:00
Andrei Borzenkov
189974e24c [#113] Improve error message of dump-config option
Problem: we had no list of avalibale git repository types in help message

Soluiton: Add them, using allFlavors value as source of truth
2022-07-15 17:00:18 +04:00
Constantine Ter-Matevosian
70330609bc
Merge pull request #88 from serokell/breakerzirconia/#31-handle-too-many-requests
[#31] Handle the "429 too many requests" errors
2022-07-14 17:29:50 +03:00
Andrei Borzenkov
2c41713578
[#104] Add maxRetries to configurable options
Problem: maxRetries option was hardcoded in source

Solution: Add it to verify options in config and make new CLI option to override count of retries
2022-07-14 17:25:52 +03:00
Constantine Ter-Matevosian
032395007b
[#31] Handle the "429 too many requests" errors
Problem: The current version of xrefcheck handles the HTTP responses
with the 429 status code just like every other error, when it is
possible to try and eliminate the occurrences of such errors within the
program itself.

Solution: Each time the result of performing a request on a given link
is a 429 error, retrieve the Retry-After information, describing the
delay (in seconds), from the headers of the HTTP response, or,
alternatively, use a configurable default value if the Retry-After
header is absent, and rerun the request after an amount of time
described by the said value had passed. Only after the number of retries
had reached its limiting value, which, as of right now, is not
configurable and is hardcoded, is when the 429 error is converted into
becoming 'unfixable', and any further attempts to remove the error are
terminated.

Additionally, the progress bar has been upgraded and the following
elements are supplied:
1. an extra color -- Blue -- indicating the errors that might get
   eliminated during the verification;
2. a timer with the number of seconds left to wait for the restart of
   the request; if, during the verification, a new 429 error had emerged
   with the new Retry-After value being greater than or equal to the
   elapsed time, the timer is immediately updated with that value and
   begins ticking down each second from scratch.
2022-07-14 17:25:52 +03:00
Andrei Borzenkov
561750a8ac
Merge pull request #111 from serokell/Player205/#103-Fix-port-using-in-golden-tests
[#103] Specify port in golden test links instead of default one
2022-07-14 14:46:44 +04:00
Andrei Borzenkov
6cdaef2412 [#103] Specify port in golden test links instead of default one
Problem: We used default ports to test error reports in checking of localhost link, but this port may be in use by other program, so xrefcheck reports another message

Solution: Specify port by value that is likely not to be used by other programs
2022-07-14 14:40:45 +04:00
Andrei Borzenkov
894324cdbe
Merge pull request #109 from serokell/Player205/#106-Fix-path-using
[#106] Fix using ./ in paths
2022-07-14 14:36:35 +04:00
Andrei Borzenkov
55268fee2c [#106] Fix using ./ in paths
Problem: --ignored and --root CLI options had misbehave when you use ./ in path

Solution: add path normalisation and path-equality from System.FilePath instead of common functions for strings
2022-07-13 16:13:38 +04:00
Andrei Borzenkov
d6fb95f5b9
Merge pull request #110 from serokell/Player205/#105-Enable-weeder-and-hlint
[#105] Add hlint support, enable -Weverything
2022-07-13 11:09:23 +04:00
Andrei Borzenkov
654d143113 [#105] Add hlint support, enable -Weveryting
Problem: we had a lot redundant dependencies and had no linter for handling obvious errors

Solution: hlint support and enable -Weverything flag, fix all hints from them, add hlint to the CI pipeline
2022-07-13 11:08:01 +04:00
Andrei Borzenkov
606ad5aaef
Merge pull request #108 from serokell/Player205/#107-Update-stack-resolver
[#107] Update stack resolver to the newer version
2022-07-08 13:03:36 +04:00
Andrei Borzenkov
e460301275 [#107] Replace file-embed library with inline config
Problem: At new resolver version we recieved obscure error when tried to cross-compile project to Windows on CI. Changing file-embed version to the old one doesn't help us.

Solution: inline content of this file into haskell source, using raw-string-qq library, that helps us to avoid escaping and typing newline characters.
2022-07-08 13:01:13 +04:00
Andrei Borzenkov
b255445a55 [#107] Update stack resolver to the newer version
Problem: We had old resolver version, that used ghc 8.10.4 and outdated versions of libraries

Solution: Change resolver to lts 19.13, that uses ghc 9.0.2 and update haskell.nix configuration files to can build project via `nix-build` command
2022-07-08 13:01:13 +04:00
Андреев Кирилл
f69d74e13d
Merge pull request #100 from serokell/kirill.andreev/hotfix/revert-version-increment
Undo errorneous version increment
2021-11-09 18:12:36 +03:00
Андреев Кирилл
a9a156ef41
Undo errorneous version increment 2021-11-09 15:50:13 +04:00
Андреев Кирилл
36625c01c3
Merge pull request #97 from serokell/kirill.andreev/deriving-strats-by-def
Kirill.andreev/deriving strats by def
2021-11-09 14:37:08 +03:00
Андреев Кирилл
9ecf668fbc
Add explicit strategies to deriving clauses
Problem:  The `deriving ($classes...)` is becoming obsolete.

Solution: Replace with `deriving $strat ($classes...)`;
          make old deriving a warning.
2021-11-04 18:46:54 +04:00
Андреев Кирилл
7e954c20a4
Silence a warning 2021-11-04 18:35:07 +04:00
Андреев Кирилл
878775ce33
Add regression tests for ignore link bug 2021-11-04 18:20:00 +04:00
Андреев Кирилл
72a1b23433
Addressing requested changes 2021-11-04 18:14:51 +04:00
Андреев Кирилл
420aee0f6d
Update src/Xrefcheck/Scanners/Markdown.hs
Co-authored-by: Diogo Castro <dc@diogocastro.com>
2021-11-03 18:53:43 +04:00
Андреев Кирилл
d644a95734
[#71] Separate concerns in Node traversal.
Problem:  The tree traversal uses explicit recursion and
          does not-closely-unrelated stuff at once.

Solution: Separate different actions.
2021-11-01 15:25:34 +04:00
Kirill Andreev
92c3de5587
Improve readability of imports
Problem:  In
          ```
          import qualified Foo.Bar as Bar
          import Foo.Bar (Bar)
          ```
          names of the imported modules are on different
          vertical lines, which disables autosorting,
          and makes it harder to read.

Solution: Use `ImportQualifiedPost`
2021-11-01 15:25:29 +04:00
Kirill Andreev
2f9a9d8599
Remove mixins
Problem:  Stack cannot build projects with mixins, and they only
          used to splice universum instead of base.

Solution: Use `NoImplicitPreduce` and import `Universum`
          everywhere explicitly.
2021-11-01 15:24:25 +04:00
Diogo Castro
d43953192d
Merge pull request #82 from serokell/breakerzirconia/#75-roots-with-appended-slashes
[#75] Fix the root with an appended slash support
2021-10-26 14:08:48 +01:00
Constantine Ter-Matevosian
b9e7ffb99d
[#75] Fix the root with an appended slash support
Problem: The results of the repository analysis will always contain
invalid references if the root contains a trailing forward slash.

Solution: Strip the root's trailing slash (if present) when having it be
given as an argument of the System.FilePath.Posix.takeDirectory
function.
2021-10-26 15:16:47 +03:00
Konstantin Ivanov
f8bb96c8a9
Merge pull request #83 from serokell/breakerzirconia/#74-detect-link-verification-duplication
[#74] Detect duplicating links during verification
2021-10-08 20:41:29 +04:00
Constantine Ter-Matevosian
82accc132c [#74] Detect and handle duplicate links during verification
Problem: All the duplicate external links get verified independently,
which is wasteful.

Solution: Store the verification results in the map. Verify the link
once if it hasn't been verified already, and insert the results
into the map; alternatively, if the link has been verified before,
return the results by retrieving the respective value from the map.
The traversal of all the filepath-reference pairs is done via
'forConcurrentlyCaching', which is semantically similar to
Control.Concurrent.Async.forConcurrently, except it stores the
action results in a map (in our case, we need to store the
verification results of only the external references).
2021-10-08 19:29:11 +03:00
worm2fed
f8de92024a
Merge pull request #66 from serokell/worm2fed/#47-ftp-links
[#47] Handle ftp links
2021-10-08 17:27:28 +03:00
Andrey Demidenko
c67ee9bd52
[#47] Handle ftp links
Problem:
Currently we support only http and https links. If there is an `ftp://`
link, you will get exception.

Solution:
Use `ftp-client` to check connection to ftp, see response statuses and
check file existence. This produces adding new error types and small
refactoring.
Provide a test which is separate executable, where we have to pass CLA -
ftp host.

Co-authored-by: Alexander Bantyev <alexander.bantyev@serokell.io>
2021-10-08 13:59:14 +03:00
Diogo Castro
c20bb32d79
Merge pull request #85 from serokell/worm2fed/#81-new-config-options
[#81] Add ability to decide whether to ignore auth failures and localhost links
2021-10-08 11:34:11 +01:00
Andrey Demidenko
5e266775bd
[Chore] Move commands related functionality to lib
Problem:
We have `exec` directory with `Main.hs` which (from semantic) supposed
to only run Xrefcheck.
Also, it's a common practice to keep `Main.hs` as simple as it possible.
But now it have some logic.

Solution:
Move commands related functionality to lib (separate module) and keep
`Main.hs` very simple, only as runner.
2021-10-08 13:29:19 +03:00
Andrey Demidenko
24226ac2d8
[#81] Add config option for protected links
Problem:
We do not know what to do with protected links, because we cannot check
them. So we have two options, assume that these links is valid or not.

Solution:
Provide config option for user to decide what to do - assume protected
links valid or not.
2021-10-08 13:29:19 +03:00
Andrey Demidenko
29d4f12c61
[#81] Add config option for localhost links
Problem:
Almost all the time we can't validate localhost links, so we just skip them.
But to run ftp links tests (#47) we need to refer to localhost.

Solution:
Add config option whether to ignore localhost links and provide bats
tests for this new feature.

Co-authored-by: Alexander Bantyev <alexander.bantyev@serokell.io>
2021-10-08 13:29:19 +03:00
Андреев Кирилл
d58882685f
Merge pull request #68 from serokell/slowpnir/anchors-in-headers
[#62] Add anchor recognition in headers
2021-10-04 13:34:45 +03:00
Андреев Кирилл
80a8c7dbfd
[#62] Fix tests failing after rebase
Problem:  The "edge-case" is now a normal case, and should be
          recognized.
Solution: Make test to expect it to be recognised.
2021-10-04 14:27:47 +04:00
Kirill Andreev
a61defd917
[#62] [INT-141] Add to changelog, update version 2021-10-04 14:12:09 +04:00
Kirill Andreev
7a2dce17fd
[#62] [INT-141] Add anchor recognition in headers
Problem:  Subtrees of header are ignored.

Solution: add subtrees of header to the traversal.
2021-10-04 14:12:02 +04:00
Zhenya Vinogradov
c8842472bc
Merge pull request #84 from serokell/zhenya/ops1269-ci-bump
CI: bump dependencies
2021-09-16 11:54:02 +03:00
Zhenya Vinogradov
eb5c241ba0
CI: bump dependencies 2021-09-16 11:52:30 +03:00
Konstantin Ivanov
a301339ecc
Merge pull request #80 from serokell/breakerzirconia/#72-remove-header-leading-spaces
[#72] Fix anchor generation of headers with spaces
2021-09-04 21:31:54 +03:00
Constantine Ter-Matevosian
be09345c72
[#72] Fix anchor generation of headers with spaces
Problem: A header name with its custom anchor appended after the
octothorpe symbol(s) is parsed with the leading spaces present, thus
generating an anchor from it will result in having a leading hyphen
prepended to its beginning.

Solution: Strip the header name to ensure the absence of the leading
hyphen in the later generated anchor.
2021-09-03 09:19:45 +03:00
Diogo Castro
7648d7c21e
Merge pull request #70 from serokell/worm2fed/fix-indentions
Fix indentions
2021-07-26 13:02:06 +01:00
Andrey Demidenko
91db52dd8d
Fix indentions
Problem:
Our style guide requires two spaces indention, but in some places we have four or even more spaces.

Solution:
Delete spaces where it contradicts our style guide.
2021-07-26 12:58:26 +01:00
Diogo Castro
cb9c35308a
Merge pull request #69 from serokell/worm2fed/#67-cabal-support
[#67] Add cabal usage note
2021-07-22 08:39:41 +01:00
Andrey Demidenko
5b6308982c
Add note about cabal usage
Problem:
I've met problem with one package version. I use cabal to build project and cabal for some reason decided to use old version of this package. With stack everything fine.
So, I think not only me, but other people prefer cabal over stack.

Solution:
Add note to our README.md that in case of cabal usage it's required to run `stack2cabal` first.
Also ignore all cabal staff so it can't be accidentally added to repo.
2021-07-22 10:06:55 +03:00
Arseniy Seroka
dd0ad17f9c
Merge pull request #65 from serokell/martoon/prepare-release
Make 0.2 release
2021-05-04 15:56:49 +03:00
martoon
06a39de707
Make 0.2 release 2021-05-04 15:51:28 +03:00