Skip to content

Commit

Permalink
feat: tealer integration (#56)
Browse files Browse the repository at this point in the history
* feat: tealer integration

* chore: apply tweaks

Co-authored-by: Neil Campbell <neil.campbell@makerx.com.au>

* refactor: addressing pr comments

* chore: updating gitignore

* chore: updating gitignore

* chore: bump min version of algokit cli

---------

Co-authored-by: Neil Campbell <neil.campbell@makerx.com.au>
  • Loading branch information
aorumbayev and neilcampbell committed Jan 24, 2024
1 parent 9c58809 commit f75a831
Show file tree
Hide file tree
Showing 80 changed files with 454 additions and 18 deletions.
2 changes: 1 addition & 1 deletion template_content/.algokit.toml.jinja
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[algokit]
min_version = "v1.8.0"
min_version = "v1.10.0"

[deploy]
{%- if deployment_language == 'python' %}
Expand Down
2 changes: 2 additions & 0 deletions template_content/.gitignore.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -176,3 +176,5 @@ node_modules

# AlgoKit
debug_traces/

.algokit/static-analysis/tealer/
5 changes: 5 additions & 0 deletions template_content/README.md.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -165,3 +165,8 @@ This project makes use of Python to build Algorand smart contracts. The followin
{% if ide_vscode %}
It has also been configured to have a productive dev experience out of the box in [VS Code](https://code.visualstudio.com/), see the [.vscode](./.vscode) folder.
{%- endif %}
- [AlgoKit Tealer Integration](https://github.com/algorandfoundation/algokit-cli/blob/main/docs/features/tasks/analyze.md): AlgoKit Tealer Integration is a feature in the CLI that allows you to run [Tealer](https://github.com/crytic/tealer) static analyzer on your TEAL
source code. The invocation of this command is included in:
- The github actions workflow file.
- A VSCode task ('Shift+CMD|CTRL+P' and search for 'Tasks: Run Task' and select 'Analyze TEAL contracts with AlgoKit Tealer integration').
- A `pre-commit` hook (if you have enabled `pre-commit` in your project).
15 changes: 15 additions & 0 deletions template_content/{% if ide_vscode %}.vscode{% endif %}/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,21 @@
"cwd": "${workspaceFolder}"
},
"problemMatcher": []
},
{
"label": "Analyze TEAL contracts with AlgoKit Tealer integration",
"command": "algokit",
"args": [
"task",
"analyze",
"${workspaceFolder}/.algokit",
"--recursive",
"--force"
],
"options": {
"cwd": "${workspaceFolder}"
},
"problemMatcher": []
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,9 @@ jobs:
run: npm run test
{%- endif %}

- name: Scan TEAL files for issues
run: algokit task analyze .algokit --recursive --force # add --diff flag if you want output stability checks instead

- name: Check output stability of the smart contracts
shell: bash
run: |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,13 @@ repos:
minimum_pre_commit_version: '2.9.2'
files: '^(src|tests)/'
{% endif %}
- id: tealer
name: tealer
description: "Run AlgoKit `Tealer` for TEAL static analysis"
entry: algokit
language: system
args: [task, analyze, ".algokit", "--recursive", "--force"]
require_serial: false
additional_dependencies: []
minimum_pre_commit_version: "0"
files: '^.*\.teal$'
2 changes: 1 addition & 1 deletion tests_generated/test_default_parameters/.algokit.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[algokit]
min_version = "v1.8.0"
min_version = "v1.10.0"

[deploy]
command = "poetry run python -m smart_contracts deploy"
Expand Down
2 changes: 2 additions & 0 deletions tests_generated/test_default_parameters/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -176,3 +176,5 @@ node_modules

# AlgoKit
debug_traces/

.algokit/static-analysis/tealer/
15 changes: 15 additions & 0 deletions tests_generated/test_default_parameters/.vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,21 @@
"cwd": "${workspaceFolder}"
},
"problemMatcher": []
},
{
"label": "Analyze TEAL contracts with AlgoKit Tealer integration",
"command": "algokit",
"args": [
"task",
"analyze",
"${workspaceFolder}/.algokit",
"--recursive",
"--force"
],
"options": {
"cwd": "${workspaceFolder}"
},
"problemMatcher": []
}
]
}
5 changes: 5 additions & 0 deletions tests_generated/test_default_parameters/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,8 @@ This project makes use of Python to build Algorand smart contracts. The followin
- [pip-audit](https://pypi.org/project/pip-audit/): Tool for scanning Python environments for packages with known vulnerabilities.

It has also been configured to have a productive dev experience out of the box in [VS Code](https://code.visualstudio.com/), see the [.vscode](./.vscode) folder.
- [AlgoKit Tealer Integration](https://github.com/algorandfoundation/algokit-cli/blob/main/docs/features/tasks/analyze.md): AlgoKit Tealer Integration is a feature in the CLI that allows you to run [Tealer](https://github.com/crytic/tealer) static analyzer on your TEAL
source code. The invocation of this command is included in:
- The github actions workflow file.
- A VSCode task ('Shift+CMD|CTRL+P' and search for 'Tasks: Run Task' and select 'Analyze TEAL contracts with AlgoKit Tealer integration').
- A `pre-commit` hook (if you have enabled `pre-commit` in your project).
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[algokit]
min_version = "v1.8.0"
min_version = "v1.10.0"

[deploy]
command = "poetry run python -m smart_contracts deploy"
Expand Down
2 changes: 2 additions & 0 deletions tests_generated/test_deployment_language-python/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -176,3 +176,5 @@ node_modules

# AlgoKit
debug_traces/

.algokit/static-analysis/tealer/
15 changes: 15 additions & 0 deletions tests_generated/test_deployment_language-python/.vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,21 @@
"cwd": "${workspaceFolder}"
},
"problemMatcher": []
},
{
"label": "Analyze TEAL contracts with AlgoKit Tealer integration",
"command": "algokit",
"args": [
"task",
"analyze",
"${workspaceFolder}/.algokit",
"--recursive",
"--force"
],
"options": {
"cwd": "${workspaceFolder}"
},
"problemMatcher": []
}
]
}
5 changes: 5 additions & 0 deletions tests_generated/test_deployment_language-python/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,8 @@ This project makes use of Python to build Algorand smart contracts. The followin
- [pip-audit](https://pypi.org/project/pip-audit/): Tool for scanning Python environments for packages with known vulnerabilities.

It has also been configured to have a productive dev experience out of the box in [VS Code](https://code.visualstudio.com/), see the [.vscode](./.vscode) folder.
- [AlgoKit Tealer Integration](https://github.com/algorandfoundation/algokit-cli/blob/main/docs/features/tasks/analyze.md): AlgoKit Tealer Integration is a feature in the CLI that allows you to run [Tealer](https://github.com/crytic/tealer) static analyzer on your TEAL
source code. The invocation of this command is included in:
- The github actions workflow file.
- A VSCode task ('Shift+CMD|CTRL+P' and search for 'Tasks: Run Task' and select 'Analyze TEAL contracts with AlgoKit Tealer integration').
- A `pre-commit` hook (if you have enabled `pre-commit` in your project).
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[algokit]
min_version = "v1.8.0"
min_version = "v1.10.0"

[deploy]
command = "npm run deploy:ci"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,3 +176,5 @@ node_modules

# AlgoKit
debug_traces/

.algokit/static-analysis/tealer/
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,21 @@
"cwd": "${workspaceFolder}"
},
"problemMatcher": []
},
{
"label": "Analyze TEAL contracts with AlgoKit Tealer integration",
"command": "algokit",
"args": [
"task",
"analyze",
"${workspaceFolder}/.algokit",
"--recursive",
"--force"
],
"options": {
"cwd": "${workspaceFolder}"
},
"problemMatcher": []
}
]
}
5 changes: 5 additions & 0 deletions tests_generated/test_deployment_language-typescript/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,8 @@ This project makes use of Python to build Algorand smart contracts. The followin
- [Jest](https://jestjs.io/): Automated testing.

It has also been configured to have a productive dev experience out of the box in [VS Code](https://code.visualstudio.com/), see the [.vscode](./.vscode) folder.
- [AlgoKit Tealer Integration](https://github.com/algorandfoundation/algokit-cli/blob/main/docs/features/tasks/analyze.md): AlgoKit Tealer Integration is a feature in the CLI that allows you to run [Tealer](https://github.com/crytic/tealer) static analyzer on your TEAL
source code. The invocation of this command is included in:
- The github actions workflow file.
- A VSCode task ('Shift+CMD|CTRL+P' and search for 'Tasks: Run Task' and select 'Analyze TEAL contracts with AlgoKit Tealer integration').
- A `pre-commit` hook (if you have enabled `pre-commit` in your project).
2 changes: 1 addition & 1 deletion tests_generated/test_ide_jetbrains-False/.algokit.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[algokit]
min_version = "v1.8.0"
min_version = "v1.10.0"

[deploy]
command = "poetry run python -m smart_contracts deploy"
Expand Down
2 changes: 2 additions & 0 deletions tests_generated/test_ide_jetbrains-False/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -176,3 +176,5 @@ node_modules

# AlgoKit
debug_traces/

.algokit/static-analysis/tealer/
15 changes: 15 additions & 0 deletions tests_generated/test_ide_jetbrains-False/.vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,21 @@
"cwd": "${workspaceFolder}"
},
"problemMatcher": []
},
{
"label": "Analyze TEAL contracts with AlgoKit Tealer integration",
"command": "algokit",
"args": [
"task",
"analyze",
"${workspaceFolder}/.algokit",
"--recursive",
"--force"
],
"options": {
"cwd": "${workspaceFolder}"
},
"problemMatcher": []
}
]
}
5 changes: 5 additions & 0 deletions tests_generated/test_ide_jetbrains-False/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,8 @@ This project makes use of Python to build Algorand smart contracts. The followin
- [pip-audit](https://pypi.org/project/pip-audit/): Tool for scanning Python environments for packages with known vulnerabilities.

It has also been configured to have a productive dev experience out of the box in [VS Code](https://code.visualstudio.com/), see the [.vscode](./.vscode) folder.
- [AlgoKit Tealer Integration](https://github.com/algorandfoundation/algokit-cli/blob/main/docs/features/tasks/analyze.md): AlgoKit Tealer Integration is a feature in the CLI that allows you to run [Tealer](https://github.com/crytic/tealer) static analyzer on your TEAL
source code. The invocation of this command is included in:
- The github actions workflow file.
- A VSCode task ('Shift+CMD|CTRL+P' and search for 'Tasks: Run Task' and select 'Analyze TEAL contracts with AlgoKit Tealer integration').
- A `pre-commit` hook (if you have enabled `pre-commit` in your project).
2 changes: 1 addition & 1 deletion tests_generated/test_ide_jetbrains-True/.algokit.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[algokit]
min_version = "v1.8.0"
min_version = "v1.10.0"

[deploy]
command = "poetry run python -m smart_contracts deploy"
Expand Down
2 changes: 2 additions & 0 deletions tests_generated/test_ide_jetbrains-True/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -176,3 +176,5 @@ node_modules

# AlgoKit
debug_traces/

.algokit/static-analysis/tealer/
15 changes: 15 additions & 0 deletions tests_generated/test_ide_jetbrains-True/.vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,21 @@
"cwd": "${workspaceFolder}"
},
"problemMatcher": []
},
{
"label": "Analyze TEAL contracts with AlgoKit Tealer integration",
"command": "algokit",
"args": [
"task",
"analyze",
"${workspaceFolder}/.algokit",
"--recursive",
"--force"
],
"options": {
"cwd": "${workspaceFolder}"
},
"problemMatcher": []
}
]
}
5 changes: 5 additions & 0 deletions tests_generated/test_ide_jetbrains-True/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,8 @@ This project makes use of Python to build Algorand smart contracts. The followin
- [pip-audit](https://pypi.org/project/pip-audit/): Tool for scanning Python environments for packages with known vulnerabilities.

It has also been configured to have a productive dev experience out of the box in [VS Code](https://code.visualstudio.com/), see the [.vscode](./.vscode) folder.
- [AlgoKit Tealer Integration](https://github.com/algorandfoundation/algokit-cli/blob/main/docs/features/tasks/analyze.md): AlgoKit Tealer Integration is a feature in the CLI that allows you to run [Tealer](https://github.com/crytic/tealer) static analyzer on your TEAL
source code. The invocation of this command is included in:
- The github actions workflow file.
- A VSCode task ('Shift+CMD|CTRL+P' and search for 'Tasks: Run Task' and select 'Analyze TEAL contracts with AlgoKit Tealer integration').
- A `pre-commit` hook (if you have enabled `pre-commit` in your project).
2 changes: 1 addition & 1 deletion tests_generated/test_ide_vscode-False/.algokit.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[algokit]
min_version = "v1.8.0"
min_version = "v1.10.0"

[deploy]
command = "poetry run python -m smart_contracts deploy"
Expand Down
2 changes: 2 additions & 0 deletions tests_generated/test_ide_vscode-False/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -176,3 +176,5 @@ node_modules

# AlgoKit
debug_traces/

.algokit/static-analysis/tealer/
5 changes: 5 additions & 0 deletions tests_generated/test_ide_vscode-False/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,8 @@ This project makes use of Python to build Algorand smart contracts. The followin
- [pytest](https://docs.pytest.org/): Automated testing.
- [pip-audit](https://pypi.org/project/pip-audit/): Tool for scanning Python environments for packages with known vulnerabilities.

- [AlgoKit Tealer Integration](https://github.com/algorandfoundation/algokit-cli/blob/main/docs/features/tasks/analyze.md): AlgoKit Tealer Integration is a feature in the CLI that allows you to run [Tealer](https://github.com/crytic/tealer) static analyzer on your TEAL
source code. The invocation of this command is included in:
- The github actions workflow file.
- A VSCode task ('Shift+CMD|CTRL+P' and search for 'Tasks: Run Task' and select 'Analyze TEAL contracts with AlgoKit Tealer integration').
- A `pre-commit` hook (if you have enabled `pre-commit` in your project).
2 changes: 1 addition & 1 deletion tests_generated/test_ide_vscode-True/.algokit.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[algokit]
min_version = "v1.8.0"
min_version = "v1.10.0"

[deploy]
command = "poetry run python -m smart_contracts deploy"
Expand Down
2 changes: 2 additions & 0 deletions tests_generated/test_ide_vscode-True/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -176,3 +176,5 @@ node_modules

# AlgoKit
debug_traces/

.algokit/static-analysis/tealer/
15 changes: 15 additions & 0 deletions tests_generated/test_ide_vscode-True/.vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,21 @@
"cwd": "${workspaceFolder}"
},
"problemMatcher": []
},
{
"label": "Analyze TEAL contracts with AlgoKit Tealer integration",
"command": "algokit",
"args": [
"task",
"analyze",
"${workspaceFolder}/.algokit",
"--recursive",
"--force"
],
"options": {
"cwd": "${workspaceFolder}"
},
"problemMatcher": []
}
]
}
5 changes: 5 additions & 0 deletions tests_generated/test_ide_vscode-True/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,8 @@ This project makes use of Python to build Algorand smart contracts. The followin
- [pip-audit](https://pypi.org/project/pip-audit/): Tool for scanning Python environments for packages with known vulnerabilities.

It has also been configured to have a productive dev experience out of the box in [VS Code](https://code.visualstudio.com/), see the [.vscode](./.vscode) folder.
- [AlgoKit Tealer Integration](https://github.com/algorandfoundation/algokit-cli/blob/main/docs/features/tasks/analyze.md): AlgoKit Tealer Integration is a feature in the CLI that allows you to run [Tealer](https://github.com/crytic/tealer) static analyzer on your TEAL
source code. The invocation of this command is included in:
- The github actions workflow file.
- A VSCode task ('Shift+CMD|CTRL+P' and search for 'Tasks: Run Task' and select 'Analyze TEAL contracts with AlgoKit Tealer integration').
- A `pre-commit` hook (if you have enabled `pre-commit` in your project).
2 changes: 1 addition & 1 deletion tests_generated/test_preset_name-production/.algokit.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[algokit]
min_version = "v1.8.0"
min_version = "v1.10.0"

[deploy]
command = "poetry run python -m smart_contracts deploy"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ jobs:
set -o pipefail
poetry run pytest --junitxml=pytest-junit.xml
- name: Scan TEAL files for issues
run: algokit task analyze .algokit --recursive --force # add --diff flag if you want output stability checks instead

- name: Check output stability of the smart contracts
shell: bash
run: |
Expand Down
2 changes: 2 additions & 0 deletions tests_generated/test_preset_name-production/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -176,3 +176,5 @@ node_modules

# AlgoKit
debug_traces/

.algokit/static-analysis/tealer/
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,13 @@ repos:
minimum_pre_commit_version: '2.9.2'
files: '^(src|tests)/'

- id: tealer
name: tealer
description: "Run AlgoKit `Tealer` for TEAL static analysis"
entry: algokit
language: system
args: [task, analyze, ".algokit", "--recursive", "--force"]
require_serial: false
additional_dependencies: []
minimum_pre_commit_version: "0"
files: '^.*\.teal$'
Loading

0 comments on commit f75a831

Please sign in to comment.