Skip to content

Commit

Permalink
feat: add lychee for links checking (#18)
Browse files Browse the repository at this point in the history
# 📥 Pull Request

## ❓ What are you trying to address

This pull request includes several changes aimed at enhancing link
checking, updating documentation URLs, and adding new tasks to the
`Taskfile.yml`.

## ✨ Description of new changes

### Enhancements to Link Checking:

*
[`.github/linters/.lychee.toml`](diffhunk://#diff-d53c9e019d73fc3bda93f75a4b570fbe903dc96ecd9323994e69f5afb1b769ecR1-R60):
Added a new configuration file for the `lychee` link checker to enable
caching, set runtime parameters, customize request headers, and exclude
certain IP ranges from checking.
*
[`Taskfile.yml`](diffhunk://#diff-cd2d359855d0301ce190f1ec3b4c572ea690c83747f6df61c9340720e3d2425eR115-R119):
Added a new task `lint:links` to run the `lychee` link checker using the
new configuration file.
*
[`Taskfile.yml`](diffhunk://#diff-cd2d359855d0301ce190f1ec3b4c572ea690c83747f6df61c9340720e3d2425eR510-R519):
Added a new task `install:lychee` to install the `lychee` link checker
on different platforms (Windows, Linux, macOS).

### Documentation Updates:

*
[`docs/data-sources/sql_endpoints.md`](diffhunk://#diff-904fe1b73249f39b87ee39717d940ffb8d00c90b68492672b1fbe2a8deb6c37dL7-R15):
Updated URLs to point to the correct Microsoft documentation for SQL
Endpoints.
*
[`internal/services/sqlendpoint/base.go`](diffhunk://#diff-a9c55265911b97ea793122858cedc6ff408fb66e30d5f75e8e01840332b601d5L19-R19):
Updated the `ItemDocsURL` constant to reflect the new URL for SQL
Endpoints documentation.

### Minor Fixes:

*
[`DEVELOPER.md`](diffhunk://#diff-35ea617bfbf0780bfbc554348314c5b11ba478a4d98fd92d33d45cdd54bf326aL362-R362):
Fixed a relative link to the `ghpages.yml` GitHub workflow.
  • Loading branch information
DariuszPorowski authored Sep 26, 2024
1 parent d666361 commit a5c7944
Show file tree
Hide file tree
Showing 6 changed files with 80 additions and 4 deletions.
60 changes: 60 additions & 0 deletions .github/linters/.lychee.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# https://lychee.cli.rs/#/usage/config
# Example config: https://github.com/lycheeverse/lychee/blob/master/lychee.example.toml


############################# Cache ###############################

# Enable link caching. This can be helpful to avoid checking the same links on multiple runs.
cache = true

# Discard all cached requests older than this duration.
max_cache_age = "1d"

############################# Runtime #############################

# Maximum number of allowed redirects.
max_redirects = 6

# Maximum number of allowed retries before a link is declared dead.
max_retries = 2

# Maximum number of concurrent link checks.
# max_concurrency = 2

############################# Requests ############################

# User agent to send with each request.
user_agent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36 Edg/129.0.0.0"

# Website timeout from connect to response finished.
timeout = 45

# Minimum wait time in seconds between retries of failed requests.
retry_wait_time = 2

# Comma-separated list of accepted status codes for valid links.
accept = ["200", "206", "301", "429"]

# Only test links with the given schemes (e.g. https).
# Omit to check links with any scheme.
scheme = ["https", "http", "file"]

# Custom request headers
headers = ['Accept-Encoding: deflate, compress, gzip, br, zstd']

############################# Exclusions ##########################

# Ignore case of paths when matching glob patterns.
glob_ignore_case = true

# Exclude all private IPs from checking.
exclude_all_private = true

# Exclude private IP address ranges from checking.
exclude_private = true

# Exclude link-local IP address range from checking.
exclude_link_local = true

# Exclude loopback IP address range and localhost from checking.
exclude_loopback = true
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ testresults.xml
golangci-report.xml
.wellknown.json
changie.md
.lycheecache

# Terraform
.terraform/
Expand Down
2 changes: 1 addition & 1 deletion DEVELOPER.md
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ User documentation markdown files in [./docs](./docs/) are auto-generated by the
task docs
```

User documentation is temporarily served on GitHub Pages which requires the [ghpages.yml GitHub workflow](/.github/workflows/ghpages.yml) to transform [./docs](./docs/) markdown files into a static website. Once this provider is published to the Terraform registry, documentation will be hosted on the registry instead.
User documentation is temporarily served on GitHub Pages which requires the [ghpages.yml GitHub workflow](./.github/workflows/ghpages.yml) to transform [./docs](./docs/) markdown files into a static website. Once this provider is published to the Terraform registry, documentation will be hosted on the registry instead.

## Release

Expand Down
15 changes: 15 additions & 0 deletions Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,11 @@ tasks:
cmds:
- markdownlint-cli2 "./**/*.md" --config "./.github/linters/.markdownlint-cli2.yaml" --fix

lint:links:
desc: Run link checkers
cmds:
- lychee --config ./.github/linters/.lychee.toml .

tools:
desc: Install required tools
cmds:
Expand Down Expand Up @@ -502,3 +507,13 @@ tasks:
msg: "First install pipx: https://pipx.pypa.io/"
cmds:
- pipx install --force yamllint

install:lychee:
desc: Install lychee
cmds:
- cmd: winget install lycheeverse.lychee
platforms: [windows]
- cmd: cargo install lychee
platforms: [linux]
- cmd: brew install lychee
platforms: [darwin]
4 changes: 2 additions & 2 deletions docs/data-sources/sql_endpoints.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ page_title: "fabric_sql_endpoints Data Source - terraform-provider-fabric"
subcategory: ""
description: |-
List a Fabric SQL Endpoints.
Use this data source to list SQL Endpoints https://learn.microsoft.com/power-bi/transform-model/sqlendpoints/sqlendpoints-overview.
Use this data source to list SQL Endpoints https://learn.microsoft.com/fabric/data-warehouse/data-warehousing#sql-analytics-endpoint-of-the-lakehouse.
-> This item does not support Service Principal. Please use a User context authentication.
---

# fabric_sql_endpoints (Data Source)

List a Fabric SQL Endpoints.

Use this data source to list [SQL Endpoints](https://learn.microsoft.com/power-bi/transform-model/sqlendpoints/sqlendpoints-overview).
Use this data source to list [SQL Endpoints](https://learn.microsoft.com/fabric/data-warehouse/data-warehousing#sql-analytics-endpoint-of-the-lakehouse).

-> This item does not support Service Principal. Please use a User context authentication.

Expand Down
2 changes: 1 addition & 1 deletion internal/services/sqlendpoint/base.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ const (
ItemsTFName = "sql_endpoints"
ItemType = fabcore.ItemTypeSQLEndpoint
ItemDocsSPNSupport = common.DocsSPNNotSupported
ItemDocsURL = "https://learn.microsoft.com/power-bi/transform-model/sqlendpoints/sqlendpoints-overview"
ItemDocsURL = "https://learn.microsoft.com/fabric/data-warehouse/data-warehousing#sql-analytics-endpoint-of-the-lakehouse"
)

0 comments on commit a5c7944

Please sign in to comment.