Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: check dead links and broken file references #1448

Merged
merged 6 commits into from
Jan 21, 2025
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions .github/workflows/external-links.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Link check

on:
workflow_dispatch: # on demand launches, if needed
schedule:
- cron: "0 0 * * 2" # 00:00 on Tuesday, near the dependabot.yml

jobs:
linkcheck:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: (docs) Check broken HTTPS links
uses: lycheeverse/lychee-action@v2
id: lychee
with:
args: >
-n -s https --exclude-path docs/node_modules
--base 'https://docs.tact-lang.org'
--exclude '.*?\\.(?:jpg|png)'
docs/README.md './docs/**/*.mdx'
output: "./out.md"
novusnota marked this conversation as resolved.
Show resolved Hide resolved
fail: false
failIfEmpty: false

- name: (dev-docs) Check broken HTTPS links
uses: lycheeverse/lychee-action@v2
id: lychee_dev
with:
args: >
-n -s https --exclude-path node_modules --exclude-path docs
'./**/*.md'
output: "./out_dev.md"
fail: false
failIfEmpty: false
9 changes: 9 additions & 0 deletions .github/workflows/tact-docs-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,15 @@ jobs:
working-directory: docs
run: yarn deps

- name: Check broken file references in README
if: runner.os != 'macOS' # it's enough to check on Windows and Linux
uses: lycheeverse/lychee-action@v2
with:
args: "-n -s file docs/README.md"
output: "/dev/null"
fail: true
failIfEmpty: false

- name: Build the site
working-directory: docs
run: yarn build
9 changes: 9 additions & 0 deletions .github/workflows/tact.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,15 @@ jobs:
run: |
yarn knip

- name: Check broken file references in internal documentation
if: runner.os != 'macOS' # it's enough to check on Windows and Linux
uses: lycheeverse/lychee-action@v2
with:
args: "-n -s file --exclude-path node_modules --exclude-path docs './**/*.md'"
output: "/dev/null"
fail: true
failIfEmpty: false

- name: Show an example .pkg file on Windows
if: runner.os == 'Windows'
run: |
Expand Down
2 changes: 2 additions & 0 deletions .lycheeignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# https://github.com/lycheeverse/lychee-action#excluding-links-from-getting-checked
https://www.certik.com/resources/blog/secure-smart-contract-programming-in-tact-popular-mistakes-in-the-ton
8 changes: 4 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ yarn test -u spec-name-pattern1 spec-name-pattern2

## Code quality

To pass review, code has to conform to our [styleguide](/STYLEGUIDE.md).
To pass review, code has to conform to our [styleguide](./STYLEGUIDE.md).

## Linting

Expand Down Expand Up @@ -117,11 +117,11 @@ Some CLI tests can be found in [.github/workflows/tact.yml](./.github/workflows/

### Parser

The [src/grammar/grammar.ohm](./src/grammar/grammar.ohm) file contains the Tact grammar expressed in the PEG-like language of the [Ohm.js](https://ohmjs.org) parser generator.
The [src/grammar/grammar.ohm](./src/grammar/prev/grammar.ohm) file contains the Tact grammar expressed in the PEG-like language of the [Ohm.js](https://ohmjs.org) parser generator.

The helper file [src/grammar/grammar.ts](./src/grammar/grammar.ts) contains the logic that transforms concrete syntax trees produced with the help of the Ohm.js-generated parser into abstract syntax trees (ASTs) defined in [src/ast/ast.ts](./src/ast/ast.ts). The grammar.ts file also does a bit of grammar validation, like checking that function or constant attributes are not duplicated or that user identifiers do not start with certain reserved prefixes.
The helper file [src/grammar/grammar.ts](./src/grammar/prev/grammar.ts) contains the logic that transforms concrete syntax trees produced with the help of the Ohm.js-generated parser into abstract syntax trees (ASTs) defined in [src/ast/ast.ts](./src/ast/ast.ts). The grammar.ts file also does a bit of grammar validation, like checking that function or constant attributes are not duplicated or that user identifiers do not start with certain reserved prefixes.

The [src/grammar/test](./src/grammar/test) folder contains Tact files that are supposed to be parsed without any issues, and the [src/grammar/test-failed](./src/grammar/test-failed) folder contains grammatically incorrect test files which should result in parser errors. The parser error messages and the locations they point to are fixed in the [src/grammar/**snapshots**/grammar.spec.ts.snap](./src/grammar/__snapshots__/grammar.spec.ts.snap) Jest snapshot file.
The [src/grammar/test](./src/grammar/test) folder contains Tact files that are supposed to be parsed without any issues, and the [src/grammar/test-failed](./src/grammar/test-failed) folder contains grammatically incorrect test files which should result in parser errors. The parser error messages and the locations they point to are fixed in the [src/grammar/**snapshots**/grammar.spec.ts.snap](./src/grammar/prev/__snapshots__/grammar.spec.ts.snap) Jest snapshot file.

### Typechecker

Expand Down
6 changes: 3 additions & 3 deletions docs/src/content/docs/book/compile.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ This section shows a [Mermaid][mm] diagram of [contract](/book/contracts) depend

If the contract has no dependencies, only its name is displayed:

![Contract dependency diagram without dependencies](../../..//assets/contract-dependency-diagram.png)
![Contract dependency diagram without dependencies](../../../assets/contract-dependency-diagram.png)

However, if the contract, say `FirstOne`, somewhere in its code computes the [initial state](/book/expressions#initof) of another contract, say `SecondOne`, such a relationship is shown in the diagram:

Expand All @@ -150,5 +150,5 @@ Thus, the following dependency diagram is produced:
[tlb]: https://docs.ton.org/develop/data-formats/tl-b-language
[mm]: https://mermaid.js.org/

[code-jetton-wallet]: https://github.com/tact-lang/jetton/blob/ef802f95c967f2fd37e80893845c3c3ed7c34c78/sources/jetton_wallet.tact
[code-jetton-minter]: https://github.com/tact-lang/jetton/blob/ef802f95c967f2fd37e80893845c3c3ed7c34c78/sources/jetton_minter_discoverable.tact
[code-jetton-wallet]: https://github.com/tact-lang/jetton/blob/70f6c9c51755fcab4b451da0cd2f2016476271cc/sources/jetton_wallet.tact
[code-jetton-minter]: https://github.com/tact-lang/jetton/blob/70f6c9c51755fcab4b451da0cd2f2016476271cc/sources/jetton_minter_discoverable.tact
2 changes: 1 addition & 1 deletion docs/src/content/docs/ref/core-advanced.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -590,7 +590,7 @@ parsedVarAddr.address.loadUint(123); // 345
[nanotoncoin]: /book/integers#nanotoncoin

[tvm]: https://docs.ton.org/learn/tvm-instructions/tvm-overview
[basechain]: https://docs.ton.org/v3/concepts/ton-blockchain/smart-contract-addresses#address-components
[basechain]: https://docs.ton.org/v3/documentation/smart-contracts/addresses#workchain-id
[deduplication]: https://docs.ton.org/v3/documentation/data-formats/tlb/library-cells

[storage-fee]: https://docs.ton.org/v3/documentation/smart-contracts/transaction-fees/fees-low-level#storage-fee
Expand Down
11 changes: 5 additions & 6 deletions docs/src/content/docs/zh-cn/ecosystem/misti.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,18 @@
title: Misti 静态分析仪
---

[Misti](https://nowarp.github.io/tools/misti/)是一款支持 Tact 的静态程序分析工具。
[Misti](https://nowarp.io/tools/misti/)是一款支持 Tact 的静态程序分析工具。

## 米斯蒂是什么?

- **静态程序分析**:Misti 在不执行代码的情况下对代码进行分析,通过检查结构和语法来扫描[漏洞和安全缺陷](https://nowarp.github.io/tools/misti/docs/detectors)。 这种方法可以及早发现问题,防止问题影响生产。
- **静态程序分析**:Misti 在不执行代码的情况下对代码进行分析,通过检查结构和语法来扫描[漏洞和安全缺陷](https://nowarp.io/tools/misti/docs/detectors)。 这种方法可以及早发现问题,防止问题影响生产。

- **自定义探测器**:创建 [自定义探测器](https://nowarp.github.io/tools/misti/docs/hacking/custom-detector),根据您的特定需求定制 Misti。 这有助于识别通用工具可能会遗漏的漏洞,确保对代码进行彻底审查。
- **自定义探测器**:创建 [自定义探测器](https://nowarp.io/tools/misti/docs/hacking/custom-detector),根据您的特定需求定制 Misti。 这有助于识别通用工具可能会遗漏的漏洞,确保对代码进行彻底审查。

- **CI/CD 集成**:[集成](https://nowarp.github.io/tools/misti/docs/tutorial/ci-cd) Misti 到您的 CI/CD 管道中,以确保持续的代码质量检查,在问题进入生产之前将其捕获。
- **CI/CD 集成**:[集成](https://nowarp.io/tools/misti/docs/tutorial/ci-cd) Misti 到您的 CI/CD 管道中,以确保持续的代码质量检查,在问题进入生产之前将其捕获。

## 资源

- [Github](https://github.com/nowarp/misti)
- [电报社区](https://t.me/misti_dev)
- [Misti文档](https://nowarp.github.io/docs/misti/)
- [Misti应用程序接口参考](https://nowarp.github.io/docs/misti/api)
- [Misti文档](https://nowarp.io/tools/misti/)
Loading