diff --git a/src/Xrefcheck/Config.hs b/src/Xrefcheck/Config.hs index 38b92e46..e2161890 100644 --- a/src/Xrefcheck/Config.hs +++ b/src/Xrefcheck/Config.hs @@ -225,23 +225,18 @@ overrideConfig config overrideVerify verifyConfig = VerifyConfig - { vcAnchorSimilarityThreshold = fromMaybe (vcAnchorSimilarityThreshold defVerification) - $ vcAnchorSimilarityThreshold verifyConfig - , vcExternalRefCheckTimeout = fromMaybe (vcExternalRefCheckTimeout defVerification) - $ vcExternalRefCheckTimeout verifyConfig - , vcVirtualFiles = fromMaybe (vcVirtualFiles defVerification) - $ vcVirtualFiles verifyConfig - , vcNotScanned = fromMaybe (vcNotScanned defVerification) - $ vcNotScanned verifyConfig - , vcIgnoreRefs = fromMaybe (vcIgnoreRefs defVerification) - $ vcIgnoreRefs verifyConfig - , vcIgnoreAuthFailures = fromMaybe (vcIgnoreAuthFailures defVerification) - $ vcIgnoreAuthFailures verifyConfig - , vcDefaultRetryAfter = fromMaybe (vcDefaultRetryAfter defVerification) - $ vcDefaultRetryAfter verifyConfig - , vcMaxRetries = fromMaybe (vcMaxRetries defVerification) - $ vcMaxRetries verifyConfig + { vcAnchorSimilarityThreshold = overrideField vcAnchorSimilarityThreshold + , vcExternalRefCheckTimeout = overrideField vcExternalRefCheckTimeout + , vcVirtualFiles = overrideField vcVirtualFiles + , vcNotScanned = overrideField vcNotScanned + , vcIgnoreRefs = overrideField vcIgnoreRefs + , vcIgnoreAuthFailures = overrideField vcIgnoreAuthFailures + , vcDefaultRetryAfter = overrideField vcDefaultRetryAfter + , vcMaxRetries = overrideField vcMaxRetries } + where + overrideField :: (forall f. VerifyConfig' f -> Field f a) -> a + overrideField field = fromMaybe (field defVerification) $ field verifyConfig ----------------------------------------------------------- -- Yaml instances diff --git a/tests/golden/check-cli/config-no-scan-ignored.yaml b/tests/golden/check-cli/config-no-scan-ignored.yaml index 3c3d7f55..f494ff77 100644 --- a/tests/golden/check-cli/config-no-scan-ignored.yaml +++ b/tests/golden/check-cli/config-no-scan-ignored.yaml @@ -2,19 +2,5 @@ # # SPDX-License-Identifier: Unlicense -traversal: - ignored: [] - verification: - anchorSimilarityThreshold: 0.5 - externalRefCheckTimeout: 10s notScanned: [ "to-ignore/broken-link.md" ] - virtualFiles: [] - ignoreRefs: [] - ignoreAuthFailures: true - defaultRetryAfter: 30s - maxRetries: 3 - -scanners: - markdown: - flavor: GitHub diff --git a/tests/golden/check-ignoreRefs/config-check-disabled.yaml b/tests/golden/check-ignoreRefs/config-check-disabled.yaml index 731ef955..35a20d15 100644 --- a/tests/golden/check-ignoreRefs/config-check-disabled.yaml +++ b/tests/golden/check-ignoreRefs/config-check-disabled.yaml @@ -2,20 +2,6 @@ # # SPDX-License-Identifier: Unlicense -traversal: - ignored: [] - verification: - anchorSimilarityThreshold: 0.5 - externalRefCheckTimeout: 10s - notScanned: [] - virtualFiles: [] ignoreRefs: - ^(https?|ftps?)://(localhost|127\.0\.0\.1).* - ignoreAuthFailures: true - defaultRetryAfter: 30s - maxRetries: 3 - -scanners: - markdown: - flavor: GitHub diff --git a/tests/golden/check-ignoreRefs/config-check-enabled.yaml b/tests/golden/check-ignoreRefs/config-check-enabled.yaml index 3eefdd01..2fe0cf0e 100644 --- a/tests/golden/check-ignoreRefs/config-check-enabled.yaml +++ b/tests/golden/check-ignoreRefs/config-check-enabled.yaml @@ -2,19 +2,5 @@ # # SPDX-License-Identifier: Unlicense -traversal: - ignored: [] - verification: - anchorSimilarityThreshold: 0.5 - externalRefCheckTimeout: 10s - notScanned: [] - virtualFiles: [] ignoreRefs: [] - ignoreAuthFailures: true - defaultRetryAfter: 30s - maxRetries: 3 - -scanners: - markdown: - flavor: GitHub diff --git a/tests/golden/check-ignored/config-ignored.yaml b/tests/golden/check-ignored/config-ignored.yaml index cf03582e..b911b566 100644 --- a/tests/golden/check-ignored/config-ignored.yaml +++ b/tests/golden/check-ignored/config-ignored.yaml @@ -5,17 +5,3 @@ traversal: ignored: - ./to-ignore/inner-directory/broken_annotation.md - -verification: - anchorSimilarityThreshold: 0.5 - externalRefCheckTimeout: 10s - notScanned: [] - virtualFiles: [] - ignoreRefs: [] - ignoreAuthFailures: true - defaultRetryAfter: 30s - maxRetries: 3 - -scanners: - markdown: - flavor: GitHub diff --git a/tests/golden/check-notScanned/config-directory.yaml b/tests/golden/check-notScanned/config-directory.yaml index 4067c9c5..7bd99eaa 100644 --- a/tests/golden/check-notScanned/config-directory.yaml +++ b/tests/golden/check-notScanned/config-directory.yaml @@ -2,20 +2,6 @@ # # SPDX-License-Identifier: Unlicense -traversal: - ignored: [] - verification: - anchorSimilarityThreshold: 0.5 - externalRefCheckTimeout: 10s notScanned: - notScanned/inner-directory - virtualFiles: [] - ignoreRefs: [] - ignoreAuthFailures: true - defaultRetryAfter: 30s - maxRetries: 3 - -scanners: - markdown: - flavor: GitHub diff --git a/tests/golden/check-notScanned/config-full-path.yaml b/tests/golden/check-notScanned/config-full-path.yaml index e08d534d..a0529839 100644 --- a/tests/golden/check-notScanned/config-full-path.yaml +++ b/tests/golden/check-notScanned/config-full-path.yaml @@ -2,20 +2,6 @@ # # SPDX-License-Identifier: Unlicense -traversal: - ignored: [] - verification: - anchorSimilarityThreshold: 0.5 - externalRefCheckTimeout: 10s notScanned: - ./notScanned/inner-directory/bad-reference.md - virtualFiles: [] - ignoreRefs: [] - ignoreAuthFailures: true - defaultRetryAfter: 30s - maxRetries: 3 - -scanners: - markdown: - flavor: GitHub diff --git a/tests/golden/check-notScanned/config-nested-directories.yaml b/tests/golden/check-notScanned/config-nested-directories.yaml index f646a3a0..c8eb3a4e 100644 --- a/tests/golden/check-notScanned/config-nested-directories.yaml +++ b/tests/golden/check-notScanned/config-nested-directories.yaml @@ -2,20 +2,6 @@ # # SPDX-License-Identifier: Unlicense -traversal: - ignored: [] - verification: - anchorSimilarityThreshold: 0.5 - externalRefCheckTimeout: 10s notScanned: - ./**/* - virtualFiles: [] - ignoreRefs: [] - ignoreAuthFailures: true - defaultRetryAfter: 30s - maxRetries: 3 - -scanners: - markdown: - flavor: GitHub diff --git a/tests/golden/check-notScanned/config-wildcard.yaml b/tests/golden/check-notScanned/config-wildcard.yaml index c35c8144..f867ff81 100644 --- a/tests/golden/check-notScanned/config-wildcard.yaml +++ b/tests/golden/check-notScanned/config-wildcard.yaml @@ -2,20 +2,6 @@ # # SPDX-License-Identifier: Unlicense -traversal: - ignored: [] - verification: - anchorSimilarityThreshold: 0.5 - externalRefCheckTimeout: 10s notScanned: - ./notScanned/inner-directory/* - virtualFiles: [] - ignoreRefs: [] - ignoreAuthFailures: true - defaultRetryAfter: 30s - maxRetries: 3 - -scanners: - markdown: - flavor: GitHub diff --git a/tests/golden/check-virtualFiles/config-virtualFiles.yaml b/tests/golden/check-virtualFiles/config-virtualFiles.yaml index 7304377d..65ecf5f1 100644 --- a/tests/golden/check-virtualFiles/config-virtualFiles.yaml +++ b/tests/golden/check-virtualFiles/config-virtualFiles.yaml @@ -2,22 +2,8 @@ # # SPDX-License-Identifier: Unlicense -traversal: - ignored: [] - verification: - anchorSimilarityThreshold: 0.5 - externalRefCheckTimeout: 10s - notScanned: [] virtualFiles: - ./one/a.md - ./two/* - ./three/**/* - ignoreRefs: [] - ignoreAuthFailures: true - defaultRetryAfter: 30s - maxRetries: 3 - -scanners: - markdown: - flavor: GitHub