Giter Club home page Giter Club logo

plugins's Introduction

Trunk.io

docs contributing testing guide slack vscode openssf

Welcome

This repository is the official Trunk.io repo containing Trunk's integrations for linters, formatters, security tools, githooks, and default configs. By default, all Trunk users import this repo as a plugin, via this snippet in .trunk/trunk.yaml:

plugins:
  sources:
    - id: trunk
      uri: https://github.com/trunk-io/plugins
      ref: v1.5.0

This repo is open to contributions! See our contribution guidelines and join our slack community for help. If you're adding new tools, please see our testing guide as well!

Supported Linters, Formatters, and Security Tools

Enable the following tools via:

trunk check enable {linter}
Technology Linters
All codespell, cspell, gitleaks, git-diff-check, pre-commit-hooks, trunk-toolbox, vale
Ansible ansible-lint
Apex pmd
Bash shellcheck, shfmt
Bazel, Starlark buildifier
C, C++ clang-format, clang-tidy, include-what-you-use, pragma-once
C# dotnet-format
CircleCI Config circleci
Cloudformation cfnlint, checkov
CMake cmake-format
CSS, SCSS stylelint, prettier
Cue cue-fmt
Dart dart
Docker hadolint, checkov
Dotenv dotenv-linter
GitHub actionlint
Go gofmt, gofumpt, goimports, gokart, golangci-lint, golines, semgrep
GraphQL graphql-schema-linter, prettier
HAML haml-lint
HTML Templates djlint
Java google-java-format, pmd, semgrep
Javascript biome, deno, eslint, prettier, rome, semgrep
JSON biome, deno, eslint, prettier, semgrep
Kotlin detekt, ktlint
Kubernetes kube-linter
Lua stylua
Markdown deno, markdownlint, markdown-link-check, markdown-table-prettify, prettier, remark-lint
Nix nixpkgs-fmt
package.json sort-package-json
Perl perlcritic, perltidy
PHP php-cs-fixer, phpstan
PNG oxipng
PowerShell psscriptanalyzer
Prisma prisma
Protobuf buf (breaking, lint, and format), clang-format, clang-tidy
Python autopep8, bandit, black, flake8, isort, mypy, pylint, pyright, semgrep, yapf, ruff, sourcery
Rego regal, opa
Renovate renovate
Ruby brakeman, rubocop, rufo, semgrep, standardrb
Rust clippy, rustfmt
Scala scalafmt
Security checkov, dustilock, nancy, osv-scanner, tfsec, trivy, trufflehog, terrascan
SQL sqlfluff, sqlfmt, sql-formatter
SVG svgo
Swift stringslint, swiftlint, swiftformat
Terraform terraform (validate and fmt), checkov, tflint, tfsec, terrascan, tofu
Terragrunt terragrunt
Textproto txtpbfmt
TOML taplo
Typescript deno, eslint, prettier, rome, semgrep
YAML prettier, semgrep, yamllint

Supported Trunk Actions

You can think of Trunk Actions as IFTTT for your repository. An action is a command that is run in reaction to a specified trigger. Triggers can be git-hooks, file modifications, time-based, or manually run. See docs for more details.

Enable trunk actions via:

trunk actions enable {action}
action description
buf-gen run buf on .proto file change
commitizen enforce conventional commits and manage releases
commitlint enforce conventional commit message for your local commits
go-mod-tidy automatically tidy go.mod file
go-mod-tidy-vendor automatically tidy and vendor go.mod file
git-blame-ignore-revs automatically configure git to use .git-blame-ignore-revs
npm-check check whether NPM installation is up to date
poetry-check, poetry-lock, poetry-export, poetry-install hooks to enforce poetry configuration
yarn-check check whether Yarn installation is up to date

Supported Tools

This repository also defines configuration for Trunk Tools, which provides hermetic management of different CLI tools. You can run trunk tools list to view all supported tools. Check out our docs.

Mission

Our goal is to make engineering faster, more efficient and dare we say - more fun. This repository will hopefully allow our community to share ideas on the best tools and best practices/workflows to make everyone's job of building code a little bit easier, a little bit faster, and maybe in the process - a little bit more fun. Read more about Trunk Check.

Additional Reference

Some linters provide built-in formatters or autofix options that don't always produce ideal outputs, especially in conjunction with other formatters. Trunk supports defining autofix options for these linters, but has their formatting turned off by default. An example of this is sqlfluff:

- name: sqlfluff
  files: [sql, sql-j2, dml, ddl]
  runtime: python
  package: sqlfluff
  direct_configs:
    - .sqlfluff
  commands:
    - name: lint
      run: sqlfluff lint ${target} --format json --dialect ansi --nofail
      output: sarif
      success_codes: [0]
      read_output_from: stdout
      parser:
        runtime: python
        run: ${plugin}/linters/sqlfluff/sqlfluff_to_sarif.py
    - name: fix
      run: sqlfluff fix ${target} --dialect ansi --disable-progress-bar --force
      output: rewrite
      formatter: true
      in_place: true
      success_codes: [0]
      enabled: false

The fix subcommand has enabled: false, so when you run trunk check enable sqlfluff, only the lint subcommand is enabled. To override this behavior, specify in your trunk.yaml:

lint:
  enabled:
    - sqlfluff@<version>:
        commands: [lint, fix]

plugins's People

Contributors

andreilgeorgescu avatar dapirian avatar dependabot[bot] avatar det avatar dex4er avatar elischleifer avatar error9900 avatar fergusdixon avatar fsargent avatar gejustin avatar ivan-toriya avatar joshmarinacci avatar kathlam avatar laurit17 avatar matthewbaggett avatar natescherer avatar pat-trunk-io avatar puzzler7 avatar renovate[bot] avatar rriski avatar ryang20718 avatar sheldonhull avatar siddharthab avatar sxlijin avatar tconbeer avatar tmpsantos avatar tomlazar avatar trunk-open-pr-bot[bot] avatar tylerjang27 avatar yu-iskw avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

plugins's Issues

Problem with trunk-check-pre-push

I'm not sure if this is the right repository to report this issue, but when trunk-check-pre-push is enabled, I cannot use git push --delete <remote> <revspec> syntax.

πŸ•™ 11:05:00 quickprice ❯ git push --delete origin uno
βœ– Git Error: revspec '(delete)' not found
βœ– Push blocked by failing hook 'trunk-check-pre-push'
error: failed to push some refs to '...'

`extra_packages` should append, not replace.

It'd be great to have a mechanism which allows extending a set of dependencies for a given tool rather than replacing them. E.g.

Suppose you have

for one of your configs. Then

      extra_packages:
        - [email protected]

will replace all of them.

Use case:

  1. Your organization uses ESLint and has a global config.
  2. A local project has specific-requirements requiring another ESLint plugin not defined in the global config.

It's likely that extra_packages will always be additive, so it may be worth just making extra_packages additive without another mechanism.

Trivy dependency not found due to `PATH` override

Issue

When running trivy through trunks plugin, I'm getting a failure on all files due to trivy hitting problems surrounding being invoked. Here is the copy / pasta of the stderr:

        2023-06-21T14:06:56.666-0600	οΏ½[34mINFOοΏ½[0m	Need to update DB
        2023-06-21T14:06:56.666-0600	οΏ½[34mINFOοΏ½[0m	DB Repository: ghcr.io/aquasecurity/trivy-db
        2023-06-21T14:06:56.666-0600	οΏ½[34mINFOοΏ½[0m	Downloading DB...
        2023-06-21T14:06:56.666-0600	οΏ½[31mFATALοΏ½[0m	init error: DB error: failed to download vulnerability DB: database download error: OCI repository error: 1 error occurred:
        	* error getting credentials - err: exec: "docker-credential-osxkeychain": executable file not found in $PATH, out: ``

This is due to trunk setting the PATH to only the linter in the environment as seen here: https://github.com/trunk-io/plugins/blob/main/linters/trivy/plugin.yaml#L56-L58

This seems to be an artifact of trivy having an implicit dependency on docker-credential-osxkeychain.

I have the tool on my system, but it is not PATH set by trivy.

See screenshot of the full error report:

CleanShot 2023-06-21 at 14 21 35

Expected

I would expect trunk to either download ALL dependencies for their plugins so they run in an isolated fashion. This would be preferred and would get around this issue.

The other option is to provide a workaround so users like myself can better override the environment / PATH set for the plugin. That would allow me to specify the correct PATH so that trivy can execute as part of trunk. This has major issues as it is likely that setting the PATH in something like trunk.yaml would not be portable to other team members machines and would be fragile.

Notes

If we have a suggested plan of action for this issue, then I'd be happy to implement it as I don't believe the fix should be a major one. Maybe adding an additional downloads entry for the docker-credential-osxkeychain tool so that is installed alongside trivy?

clang-tidy: broken URLs for help-links, needs only small adaption

The help-URLs of clang-tidy need a / instead a - at the first occasion in the replacement here:

issue_url_format: https://clang.llvm.org/extra/clang-tidy/checks/{}.html

E.g. for cppcoreguidelines-pro-type-vararg:

image

Support standard paths to config files of linters

Motivation

Config files of linters are located at the path specialized to trunk.io under .trunk/configs. Some extensions or plugins of IDEs as VS code and IntelliJ don't recognize the config files, because those expect the default location of each linter. We can use a function to format code on IDE with config files using extensions and plugins. If we can seamlessly share or synchronize config files between Trunk and IDE, that would be awesome.

Ideas

Plan 1: Use symbolic links between paths for Trunk and default paths

I usually create some symbolic links to make Trunk and the IDE recognize. If I already have a config file of a linter before introducing Trunk, I create a symbolic link from the existing file in .trunk/configs. On the contrary, if I first introduce a new linter by Trunk, I create the symbolic link to the default path which the linter expects. We can also implement a sub command to manage symbolic links between Trunk and default paths of linters.

Plan 2: Trunk tris to load a config file of a linter from the default path

As far as I know, we define paths of config files so that Trunk can load. For instance, the default config path of autopep8 in Trunk is .pep8. We can also make Trunk load config files from default paths of linters.

direct_configs: [.pep8]

What's the best apporach for dealing with 3rd party failurers?

I'm seeing terrascan failing, due to lack of support for a terraform feature I'm using. This causes trunk to report failure to run as well. What would be the suggest appraoch for dealing with the scenario where upstream has a known bug that is causing one of the plugins to fail?

I'd prefer trunk to understand that for 3rd praty plugin version X, it will fail on this fail and thus should be set to skip it up until the next version is released (after which resume scanning..)

Reference tenable/terrascan#1642 (comment)

trunk fmt does not surface `biome format` errors

πŸ‘‹ hullo!

trunk doesn't appear to surface biome format errors, not sure why, haven't dug into it. still on WSL.

here's a malformed biome config that complains correctly when run with pnpm biome format .:

❯ cat biome.json
{
        "$schema": "https://biomejs.dev/schemas/1.7.3/schema.json",
        "organizeImports": {
                "enabled": true
        },
        "linter": {
                "enabled": true,
                "rules": {
                        "recommended": true
                }
        },
        "formatter": {
                "enabled": true,
                "rules": {
                        "recommended": true,
                        "formatWithErrors": true,
                        "indentStyle": "spaces",
                        "indentWidth": 2,
                        "lineEnding": "lf",
                        "lineWidth": 120
                }
        },
        "javascript": {
                "formatter": {
                        "quoteStyle": "single",
                        "jsxQuoteStyle": "single",
                        "semicolons": "asNeeded",
                        "trailingComma": "all"
                }
        }
}

Integrity checks for downloaded linters

Can we include some integrity checks for the linters configured in this repo?

The schema for trunk.yaml allows a shasum attribute, but the problem is that the URLs are parametrized by version for most linters configured in this repo, and so there is no one fixed shasum. Instead, we could have a central map/registry of all known download URLs to their shasums, and then if a user is using a download URL with an unavailable shasum, warn them and show them how to extend the shasum registry for their repo.

Filing it here for consideration. Apologies if this already happens in some way.

commitlint is silent

(I am using yarn 3)

If I add commitlint as an action to my project it fails silently. If I use the commitlint cli, the output is helpful.

suggestion: stylua formatter for Lua

I added a stylua linter to my .trunk.yaml and thought it worth inclusion.

I don't have the time to massage it into shape for a PR but it mostly works.

Here are the relavant parts:

version: 0.1
cli:
  version: 1.6.1
lint:
  files:
    - name: lua
      extensions:
        - lua
      shebangs:
        - lua
  downloads:
    - name: stylua
      version: 0.17.0
      downloads:
        - os:
            linux: linux
            macos: macos
          cpu:
            x86_64: x86_64
            arm_64: aarch64
          url: https://github.com/JohnnyMorganz/StyLua/releases/download/v${version}/stylua-${os}-${cpu}.zip
  enabled:
    - [email protected]
  definitions:
    - name: stylua
      files: [lua]
      download: stylua
      commands:
        - formatter: true
          output: rewrite
          run: stylua --verify --search-parent-directories --stdin-filepath ${target} -
          stdin: true
          success_codes: [0, 1]
      run_linter_from: workspace
      good_without_config: true
      direct_configs:
        - .stylua.toml
      environment:
        - name: PATH
          list: ["${linter}"]
      version_command:
        parse_regex: ${semver}
        run: stylua --version

Trunk+VSCode keeps my coffee warm

Hello,

Thanks for the awesome "master-linter" - the UI/UX is great, it's very useful.

Just a little feedback, share by other dev friends : it's heavy on the processor, and we had to uninstall it (at least from VSCode) to solve the issue. After 5 minutes of code, compute usage would shoot to 100%, and my MacBook Air 2021 would get very, very warm.

I think the VSCode plugin is at fault, however the behavior persisted after I removed it, and stopped when I did a clean uninstallation. I reinstalled only the CLI tool after, which solved the problem.

Thanks for the good work, I hope this feedback helps :-)

perltidy isn't installed when enabled

When using perltidy, it fails if it isn't installed on the host system.

This is problematic in CI:

Example:

https://github.com/docwhat/bashables/actions/runs/9483902974/job/26132129649

# .trunk/out/ppqBs.yaml
  trunk_cli_version: 1.22.1
  title: "Error while executing: tests/test_helper/pseudo-tty.pl"
  report:
    - message: Unable to find binary in PATH
      binary: perltidy
      PATH:
        - /home/runner/.local/share/bats/bin
        - /snap/bin
        - /home/runner/.local/bin
        - /opt/pipx_bin
        - /home/runner/.cargo/bin
        - /home/runner/.config/composer/vendor/bin
        - /usr/local/.ghcup/bin
        - /home/runner/.dotnet/tools
        - /usr/local/sbin
        - /usr/local/bin
        - /usr/sbin
        - /usr/bin
        - /sbin
        - /bin
        - /usr/games
        - /usr/local/games
        - /snap/bin
    - linter:
        command: |
  
        stdin_path: (none)
        run_from: ""
        timeout: 0
        rerun: ""
        exit_status: exited
        exit_code: 0
        stdout: (none)
        stderr: (none)
      parser: |
        (none)

The commit message for 097a7d3 says this was done deliberately.

I can be convinced that we don't need to install a local perl runtime, but the command should be installed at the very least with a custom, trunk-specific PERL5LIB.

Auto release every change (continuous delivery)

I propose that this repository moves to a continuous delivery model where every change/commit accepted into main and passes all the CI tests will trigger a release automatically.

This should be possible now that there is test coverage and good linting (trunk!).

The use case for this is PR #237, which breaks hadolint on arm64 macOS systems. Not that big a deal if updating, but on a new project is a pain and is confusing. A CD setup would have this fixed within minutes of #237 being approved and merged.

A quick estimate of the work required:

  1. Ensure the branch protections are up-to-date.
  2. Ensure the test coverage is sufficient for confidence.
  3. Write a CI workflow to tag and release a version based on comments. Something like Release Please could be used with conventional commits.
  4. Write documentation.
  5. Profit!

psscriptanalyzer hanging

I'm on latest version of trunk 1.22.2 and plugins were just updated v1.6.1.
I love that there is a psscriptanalyzer option, but this is the second time I've tried to use and both had timeouts.

Never seems to return and just hangs.

config that seems relevant.
Any idea what might be causing this?

version: '0.1'
cli:
  version: 1.22.2
  shell_hooks:
    path_add:
      - '${workspace}/tools'
plugins:
  sources:
    - id: trunk
      ref: v1.6.1
      uri: https://github.com/trunk-io/plugins
lint:
  enabled:
    - [email protected]
tools:
  enabled:
    - [email protected]
    - [email protected]

CleanShot 2024-08-05 at 18 38 41

CleanShot 2024-08-05 at 18 40 57

This also applied when I tried to run trunk fmt first, and it kept hanging.

Handle empty commit gracefully

There is a special ref, 0000000000000000000000000000000000000000, that is the NULL commit. It is the first parent commit in any new repository.

push.sh should detect and handle this gracefully, either with --all or by just quitting with exit code 0.

Example output from https://github.com/docwhat/gamelist-xml-util/actions/runs/3897696813/jobs/6655627435

Run # Run trunk check on push
  # Run trunk check on push
  ${GITHUB_ACTION_PATH}/push.sh
  shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
  env:
    TRUNK_TMPDIR: /tmp/tmp.mPY6YzZiZU
    TRUNK_PATH: /tmp/tmp.mPY6YzZiZU/trunk
    TRUNK_CHECK_MODE: push
    MSYS: winsymlinks:nativestrict
    GITHUB_EVENT_AFTER: 2e5cacb1cd3e93e5c1553[40](https://github.com/docwhat/gamelist-xml-util/actions/runs/3897696813/jobs/6655627435#step:3:44)3359772213eb98c83
    GITHUB_EVENT_BEFORE: 0000000000000000000000000000000000000000
    GITHUB_REF_NAME: remove-renovate
    GITHUB_REPOSITORY: docwhat/gamelist-xml-util
    GITHUB_TOKEN: ***
    INPUT_ARGUMENTS: 
    INPUT_LABEL: 
fatal: remote error: upload-pack: not our ref 0000000000000000000000000000000000000000
Error: Process completed with exit code 128.

N.B. The NULL commit is also a blob as well. You can see that with renames. However, that doesn't apply here.

[Trunk Check VSCode extension] plugin load failed; expected plugin.yaml to be present in plugin root

I need some guidance in solving this issue.

I have an unexpected (for me) new issue after working with this extension for a couple of months now within .trunk/trunk.yaml:

image

So I tested out the command (found on https://github.com/trunk-io/docs/tree/main/check/advanced-setup/plugins) in the root of my project to force a configuration update and ultimately the creation of missing plugin.yaml.

trunk plugins add https://github.com/trunk-io/plugins v1.2.6 --id=trunk

but the command also returns an error:

> trunk plugins add https://github.com/trunk-io/plugins v1.5.0 --id=trunk1
βœ– plugin operations require a valid trunk config

Details

  • Force updated to latest trunk --version: 1.21.0
  • Force updated VSCode extension: Trunk Check v3.18.0
  • VSCode: v1.90.0 (on Windows remote SSH into Ubuntu)

How to run txtpbfmt on text proto files?

I've enabled txtpbfmt linter and the trunk.yaml now contains - [email protected].
However, when I try to format a pbtxt or txtpb file in VSCode it does nothing.
The same happens when executing directly:

❯ trunk fmt path/to/myfile.txtpb
Checking 100% [===========================================================================================>]  4/4  1.0s

Found no applicable linters for the requested path

I've tried modifying the lint section, in the plugin.yaml file for txtpbfmt, as instructed by the documentation:

version: 0.1
tools:
  definitions:
    - name: txtpbfmt
      runtime: go
      package: github.com/protocolbuffers/txtpbfmt/cmd/txtpbfmt
      shims: [txtpbfmt]
      known_good_version: 0.0.0-20230412060525-fa9f017c0ded
lint:
  files:
    - name: textproto2
      extensions:
        - pbtxt
        - txtpb
        - textpb
        - textproto
  definitions:
    - name: txtpbfmt
      files: [textproto2]
      tools: [txtpbfmt]
      description: A formatter for textproto files
      commands:
        - name: format
          output: rewrite
          run: txtpbfmt ${target}
          success_codes: [0]
          in_place: true
          batch: true
          formatter: true
      suggest_if: files_present
      known_good_version: 0.0.0-20230412060525-fa9f017c0ded

but it hasn't changed anything.

Originally, this file has [textproto] in its files node but I couldn't find any corresponding definition of what file extensions it actually involves.

Anyway, running the tool directly formats the file as expected:

cd ~/.cache/trunk/tools/txtpbfmt/0.0.0-20230412060525-fa9f017c0ded-94ed989503ec614c4f8140258ed9defd/bin
./txtpbfmt path/to/myfile.txtpb

Clearly, something is wrong with the configuration of this tool in trunk.

Which options is cspell being run with?

trunk check --all --filter cspell checks 187 files.

cspell --gitignore . checks 163 files.
cspell --gitignore "**" checks 163 files.

Can't figure out how to get 187 files when running cspell directly, so curious how trunk is running it...

Fix codespaces not building

Problem

When attempting to create a codespace from this repository's main branch, the codespace fails to complete building.

Steps To Reproduce

  1. Open Visual Studio Code (attempted through GitHub UI as well)
  2. Run command Codespaces: Create New Codespace...
  3. Select trunk-io/pluginsusing the official GitHub Repositories extension
  4. Wait for Setting up remote connection: Building codespace... to enter into a recovery container

Expected Result

A codespace to be built and usable.

Actual Result

Setting up remote connection: Building codespace... spins indefinitely.

Suggested Solution

The .devcontainer.json file contains the configuration for any built codespaces, so the issue is most likely in this file. The image key seems to be using an outdated image of "mcr.microsoft.com/devcontainers/typescript-node:0-18" based on its documentation, so replacing it with a newer image might fix the issue. It is important that semantic versioning is still used along with the same Node and Debian versions so as to not introduce more issues.

The issue might also be related to the keys git-lfs or onCreateCommand.

Ruff trunk_to_sarif.py key error

        Traceback (most recent call last):
          File "/home/ryang/.cache/trunk/plugins/https---github-com-trunk-io-plugins/v0.0.11-7784b17d1d8ff658/linters/ruff/ruff_to_sarif.py", line 59, in <module>
            "deletedRegion": get_region(fix),
          File "/home/ryang/.cache/trunk/plugins/https---github-com-trunk-io-plugins/v0.0.11-7784b17d1d8ff658/linters/ruff/ruff_to_sarif.py", line 10, in get_region
            location = entry["location"]
        KeyError: 'location'

When running ruff on 0.0.272 with .ruff.toml

# Enable flake8-pyinterface, pylint error, pylint warning
select = ["PYI", "PLE", "PLW"]
ignore = ["B905", "PLW0603", "PLW2901", "B018", "B028"]
# Full list of error codes https://beta.ruff.rs/docs/rules/
# Disable Bugbear zip
# Pylint warning of global
# Overwritten variables
# pointless setement
# stacklevel not added to log.warning

# Allow autofix for all enabled rules (when `--fix`) is provided.
fixable = [
  "A",
  "B",
  "C",
  "D",
  "E",
  "F",
  "G",
  "I",
  "N",
  "Q",
  "S",
  "T",
  "W",
  "ANN",
  "ARG",
  "BLE",
  "COM",
  "DJ",
  "DTZ",
  "EM",
  "ERA",
  "EXE",
  "FBT",
  "ICN",
  "INP",
  "ISC",
  "NPY",
  "PD",
  "PGH",
  "PIE",
  "PL",
  "PT",
  "PTH",
  "PYI",
  "RET",
  "RSE",
  "RUF",
  "SIM",
  "SLF",
  "TCH",
  "TID",
  "TRY",
  "UP",
  "YTT",
]
unfixable = []

# Exclude a variety of commonly ignored directories.
exclude = [
  ".keys",
  ".cache",
  ".vscode",
  ".git",
  ".git-rewrite",
  ".hg",
  ".mypy_cache",
  ".nox",
  ".pants.d",
  ".pytype",
  ".ruff_cache",
  ".svn",
  ".tox",
]
per-file-ignores = {}

line-length = 120

target-version = "py310"

How to disable crash reporter?

Hello, I'm using vscode trunk extension and I find that the binary ~/.cache/trunk/cli/1.19.0-darwin-arm64/crashpad_handler will be run in the background from time to time, which triggered my firewall. How to disable this behavior? I can't find any settings in vscode.

Clang-tidy doesn't work from VSCode

trunk_cli_version: 1.15.0
title: "Error while executing: Querying compile commands"
report:
  - "[json.exception.type_error.302] type must be string, but is number"

I tried to place compile_commands.json in:

  1. root workspace
  2. folder build in root workspace
  3. folder with current cpp file

Anything does not work

VS Code warning about soon-to-be-dropped code action

Quick fixes have stopped working for me.

VS Code saying β€œChecking for quick fixes...”

Now I just get stuck on β€œChecking for quick fixes...” and the following warning in the Extension Host console:

[warning] trunk.io - Code actions of kind 'quickfix 'requested but returned code action is of kind 'source.fixAll'. 
Code action will be dropped. Please check 'CodeActionContext.only' to only return requested code actions.
cli:
  version: 1.21.0
plugins:
  sources:
    - id: trunk
      ref: v1.4.5

Support terraform-docs

Hey!

This issue is a feature request to add support for terraform-docs, a tool that automatically generates documentation from Terraform modules.

Currently, we use pre-commit to ensure that our Terraform documentation stays in sync with the code, but it would be great to have just one tool that contains all the typical Terraform plugins.

I believe this feature would be a valuable addition to the plugins library and would greatly benefit Terraform users.

Thank you for considering this! 🌟

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Rate-Limited

These updates are currently rate-limited. Click on a checkbox below to force their creation now.

  • chore(deps): update actions/setup-node action to v4
  • chore(deps): update dependency @types/node to v20
  • chore(deps): update dependency eslint-config-prettier to v9
  • fix(deps): update commitlint monorepo to v18 (major) (@commitlint/cli, @commitlint/config-conventional)
  • πŸ” Create all rate-limited PRs at once πŸ”

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

github-actions
.github/actions/linter_tests/action.yaml
  • actions/setup-node v3
  • trunk-io/breakpoint v1
.github/actions/tool_tests/action.yaml
  • actions/setup-node v3
  • trunk-io/breakpoint v1
.github/workflows/annotate_pr.yaml
  • actions/checkout v3.6.0@f43a0e5ff2bd294095638e18286ca9a3d1956744
  • trunk-io/trunk-action v1.1.9@97ecd21fe6c743bf7a606791584b683a7995c70e
.github/workflows/codeql.yml
  • actions/checkout v3.6.0@f43a0e5ff2bd294095638e18286ca9a3d1956744
  • github/codeql-action v2.22.5@74483a38d39275f33fcff5f35b679b5ca4a26a99
  • github/codeql-action v2.22.5@74483a38d39275f33fcff5f35b679b5ca4a26a99
  • github/codeql-action v2.22.5@74483a38d39275f33fcff5f35b679b5ca4a26a99
.github/workflows/nightly.yaml
  • actions/checkout v3.6.0@f43a0e5ff2bd294095638e18286ca9a3d1956744
  • actions/cache v3.3.2@704facf57e6136b1bc63b828d79edcd491f0ee84
  • actions/checkout v3.6.0@f43a0e5ff2bd294095638e18286ca9a3d1956744
  • WyriHaximus/github-action-get-previous-tag v1.3.0@385a2a0b6abf6c2efeb95adfac83d96d6f968e0c
  • actions/checkout v3.6.0@f43a0e5ff2bd294095638e18286ca9a3d1956744
  • actions/cache v3.3.2@704facf57e6136b1bc63b828d79edcd491f0ee84
  • actions/upload-artifact v3.1.3@a8a3f3ad30e3422c9c7b888a15615d19a852ae32
  • actions/checkout v3.6.0@f43a0e5ff2bd294095638e18286ca9a3d1956744
  • actions/download-artifact v3.0.2@9bc31d5ccc31df68ecc42ccf4149144866c47d8a
  • actions/download-artifact v3.0.2@9bc31d5ccc31df68ecc42ccf4149144866c47d8a
  • actions/download-artifact v3.0.2@9bc31d5ccc31df68ecc42ccf4149144866c47d8a
  • slackapi/slack-github-action v1.24.0@e28cf165c92ffef168d23c5c9000cffc8a25e117
  • actions/setup-node v3.8.2@1a4442cacd436585916779262731d5b162bc6ec7
  • slackapi/slack-github-action v1.24.0@e28cf165c92ffef168d23c5c9000cffc8a25e117
  • slackapi/slack-github-action v1.24.0@e28cf165c92ffef168d23c5c9000cffc8a25e117
  • slackapi/slack-github-action v1.24.0@e28cf165c92ffef168d23c5c9000cffc8a25e117
  • actions/checkout v3.6.0@f43a0e5ff2bd294095638e18286ca9a3d1956744
.github/workflows/pr.yaml
  • actions/checkout v3.6.0@f43a0e5ff2bd294095638e18286ca9a3d1956744
  • dorny/paths-filter v2.11.1@4512585405083f25c027a35db413c2b3b9006d50
  • actions/checkout v3.6.0@f43a0e5ff2bd294095638e18286ca9a3d1956744
  • actions/checkout v3.6.0@f43a0e5ff2bd294095638e18286ca9a3d1956744
  • actions/checkout v3
  • trunk-io/trunk-action e92f97fdf03e4187a317da955e6f5bdb0a606c6f
  • actions/checkout v3.6.0@f43a0e5ff2bd294095638e18286ca9a3d1956744
  • actions/cache v3.3.2@704facf57e6136b1bc63b828d79edcd491f0ee84
  • actions/checkout v3.6.0@f43a0e5ff2bd294095638e18286ca9a3d1956744
  • actions/cache v3.3.2@704facf57e6136b1bc63b828d79edcd491f0ee84
.github/workflows/repo_tests.reusable.yaml
  • actions/checkout v3.6.0@f43a0e5ff2bd294095638e18286ca9a3d1956744
  • actions/setup-node v3.8.2@1a4442cacd436585916779262731d5b162bc6ec7
.github/workflows/scorecard.yml
  • actions/checkout v3.6.0@f43a0e5ff2bd294095638e18286ca9a3d1956744
  • ossf/scorecard-action v2.3.1@0864cf19026789058feabb7e87baa5f140aac736
  • actions/upload-artifact v3.1.3@a8a3f3ad30e3422c9c7b888a15615d19a852ae32
  • github/codeql-action v2.22.5@74483a38d39275f33fcff5f35b679b5ca4a26a99
.github/workflows/windows_nightly.yaml
  • actions/checkout v3.6.0@f43a0e5ff2bd294095638e18286ca9a3d1956744
  • actions/cache v3.3.2@704facf57e6136b1bc63b828d79edcd491f0ee84
  • actions/checkout v3.6.0@f43a0e5ff2bd294095638e18286ca9a3d1956744
  • actions/cache v3.3.2@704facf57e6136b1bc63b828d79edcd491f0ee84
.trunk/setup-ci/action.yaml
  • actions/setup-node v3.8.2@1a4442cacd436585916779262731d5b162bc6ec7
npm
actions/commitlint/package.json
  • @commitlint/cli ^17.0
  • @commitlint/config-conventional ^17.0
actions/npm-check-pre-push/package.json
  • chalk ^5.0.0
  • npm-check ^6.0.1
actions/npm-check/package.json
  • npm-check ^6.0.1
actions/yarn-check/package.json
  • yarn-check ^0.0.3
package.json
  • @jest/console ^29.4.1
  • @jest/reporters ^29.4.1
  • @jest/test-result ^29.4.1
  • @trunkio/launcher ^1.2.4
  • @types/caller ^1.0.0
  • @types/debug ^4.1.7
  • @types/jest ^29.2.4
  • @types/jest-specific-snapshot ^0.5.6
  • @types/node ^18.11.18
  • @typescript-eslint/eslint-plugin ^6.0.0
  • @typescript-eslint/parser ^6.0.0
  • caller ^1.1.0
  • debug ^4.3.4
  • eslint ^8.45.0
  • eslint-config-prettier ^8.5.0
  • eslint-import-resolver-typescript ^3.5.2
  • eslint-plugin-import ^2.26.0
  • eslint-plugin-jest ^27.1.7
  • eslint-plugin-node ^11.1.0
  • eslint-plugin-prefer-arrow-functions ^3.1.4
  • eslint-plugin-prettier ^5.0.0
  • eslint-plugin-simple-import-sort ^10.0.0
  • fast-sort ^3.2.0
  • jest ^29.3.1
  • jest-specific-snapshot ^8.0.0
  • semver ^7.3.8
  • simple-git ^3.15.1
  • ts-jest ^29.0.3
  • ts-node ^10.9.1
  • tsconfig-paths ^4.1.2
  • typescript ^5.0.0
  • yaml ^2.2.0
  • node >=16
pip_requirements
actions/hello-world/python/requirements.txt
  • colorama ==0.4.6
repo-tools/linter-test-helper/requirements.txt
  • click ==8.1.7
repo-tools/tool-test-helper/requirements.txt
  • click ==8.1.7

  • Check this box to trigger a request for Renovate to run again on this repository

trufflehog freezes

Hi,

I downloaded "trufflehog" with the latest update, however it seems to fail when processing the trunk.yaml files.

Capture d’écran 2023-06-30 aΜ€ 23 11 27

trunk version : 1.11.1

clippy fails without Cargo.lock present

Hello,

Was trying trunk out on a rust library and per best practices for libraries, Cargo.lock is not part of the repository. So while trunk runs fine locally after I have built the library once, it fails in CI. It also fails locally if I delete Cargo.lock first. This happens because the command for the clippy linter has "--locked" as part of the command which doesn't permit changing (or creating by extension?) the Cargo.lock file. And because of this, clippy errors.

I looked through your documentation but what I saw about configuring plugins appeared to be only what options are defined in the plugin.yaml file. However, the locked flag is hard-coded and not affected by any values that I saw when looking in the plugins repo.

If I'm missing something, I apologize but I did investigate as best I could.

trunk output:

trunk_cli_version: 1.18.1
title: "Error while executing: lib"
report:
  - Unable to find lib for Cargo.lock in any parent directory of /Volumes/LaCie/Repos/dfraw_json_parser/lib
  - linter:
      command: |
        /Users/nwesterhausen/.cache/trunk/tools/rust/1.65.0-e995c0a94cbb3cb0410a49183f3ef2b7/bin/cargo clippy --message-format json --locked -- --cap-lints=warn --no-deps
      stdin_path: (none)
      run_from: /Volumes/LaCie/Repos/dfraw_json_parser/lib
      timeout: 10m
      rerun: (cd /Volumes/LaCie/Repos/dfraw_json_parser/lib; env -i PATH=/Users/nwesterhausen/.cache/trunk/tools/rust/1.65.0-e995c0a94cbb3cb0410a49183f3ef2b7/bin:/Users/nwesterhausen/.opam/default/bin:/Users/nwesterhausen/.bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Library/Apple/usr/bin:/Users/nwesterhausen/.opam/default/bin:/Users/nwesterhausen/Library/pnpm:/Users/nwesterhausen/.bin:/opt/homebrew/bin:/opt/homebrew/sbin:/Users/nwesterhausen/.cargo/bin CARGO_TARGET_DIR=/Users/nwesterhausen/.cache/trunk/repos/a3e74e59ed19111a76af0d59e8fcaafe/results/clippy-current/cargo_target_dir CARGO_HOME=/Users/nwesterhausen/.cache/trunk/repos/a3e74e59ed19111a76af0d59e8fcaafe/results/clippy-current/cargo_home HOME=/Users/nwesterhausen /Users/nwesterhausen/.cache/trunk/tools/rust/1.65.0-e995c0a94cbb3cb0410a49183f3ef2b7/bin/cargo clippy --message-format json --locked -- --cap-lints=warn --no-deps)
      affects_cache:
        - Cargo.toml
      direct_configs:
        []
      exit_status: exited
      exit_code: 101
      stdout: (none)
      stderr: |
            Updating crates.io index
        error: the lock file /Volumes/LaCie/Repos/dfraw_json_parser/Cargo.lock needs to be updated but --locked was passed to prevent this
        If you want to try to generate the lock file without accessing the network, remove the --locked flag and use --offline instead.

    parser: |
      (none)

Trunk+VSCode on raspberry Pi 4 aarch64 fails

Hello,

I'm trying to use Trunk+VSCode in remote mode on a headless Pi 4 4GB and I get a mmap crash.

uname -m
aarch64
command -v trunk
/home/etu/.cache/trunk/launcher/trunk
trunk init
external/tcmalloc/tcmalloc/system-alloc.cc:662] MmapAligned() failed - unable to allocate with tag (hint, size, alignment) - is something limiting address placement? 0x241a40000000 1073741824 1073741824 @ 0x556cf3caa8 0x556cf3a740 0x556cf3a324 0x556cf29a78 0x556cf37638 0x556cf25ba0 0x556ca8230c 0x556bd3e618 0x556bd0b848 0x7fb427783c
external/tcmalloc/tcmalloc/arena.cc:64] FATAL ERROR: Out of memory trying to allocate internal tcmalloc data (bytes, object-size); is something preventing mmap from succeeding (sandbox, VSS limitations)? 131072 640 @ 0x556cf3d328 0x556cf29af4 0x556cf37638 0x556cf25ba0 0x556ca8230c 0x556bd3e618 0x556bd0b848 0x7fb427783c

Has anyone met the same issue ?

TIA,

Shared local config doesn't work with parent dir or unexpanded paths

I have a config like this:

version: 0.1
cli:
  version: 1.22.2
plugins:
  sources:
    - id: trunk
      ref: v1.6.1
      uri: https://github.com/trunk-io/plugins
    - id: skoti
      local: ../shared

the ../shared contains plugin.yaml and it works.

However, it stops working as soon as I change the local path to either:

  • .. or ../ - to simply indicate the parent directory
  • ~/configs/trunk or $HOME/configs/trunk - to point to the home directory via tilde expansion or env variable

Is this something that could/should be supported?
It works with ../shared or absolute paths like: /Users/skoti/configs/trunk so might be not worth adding.


If not then it should be fixed to return a proper error.

As .. or ../ makes trunk to hang for infinity ♾️ .

And the tilde expansion returns:

.trunk/trunk.yaml:9:7
 9:7  high  [skoti] '~/configs/trunk' does not exist  trunk/config-error

Unable to run check due to invalid config

Which is not true because the file exists, so I would expect something like an unrecognized path error or if we can be specific unsupported path expansion.

Interestingly, if I put a symlink ../shared/plugin.yaml to point to ~/configs/trunk/plugin.yaml via tilde expansion then it works. So looks like only the configured path is significant.

Bazel cache Problem

Hi,

I am using trunk in a Bazel project. It works nicely so far, the only issue that I have is that the Bazel calls by trunk constantly invalidate the cache of the Bazel server. That means that I have to recompile every dependency, when I want to run a file (takes about 1 minute, instead of an incremental build taking 10 secs).

Maybe this issue is caused by the env being different for my zsh shell and trunk. Are there any advises on how to fix this?

Best,

Henrik

markdownlint config doesn't seem to be respected

Trunk doesn't seem to honor the markdownlint config changes I've made.

link to example of mapping.

I've tried a lot of variations but I can't get trunk to honor .markdownlint.yaml
I run the markdownlint vscode plugin and it honors the file, but in repo when I tweak it seems to ignore the file.

For example changing indentation level to 12, it works with markdownlint tool itself, but then using trunk as my formatter it seems to go back to standard config and not honor it.
I've tried both .markdownlint.yaml and .markdownlint.jsonc and neither seems to be picked up.
I've also tried placing in root of repo and copying to .trunk/configs and no change in behavior.

image

Trunk config

version: '0.1'
cli:
  version: 1.22.1
plugins:
  sources:
    - id: trunk
      ref: v1.5.0
      uri: https://github.com/trunk-io/plugins
lint:
  enabled:
    - [email protected]

.markdownlint.yaml

$schema: https://raw.githubusercontent.com/DavidAnson/markdownlint/main/schema/markdownlint-config-schema.json
MD007:
  indent: 12
  start_indented: false
  start_indent: 4
- [ ] one
  - _In use by:_
    - this
- [ ] more detail
  - _the result_
    - more
    - foo
- [ ] one
            - _In use by:_
                        - this
- [ ] more detail
            - _the result_
                        - more
                        - foo

`direct_configs` doesn't work for `tflint`

I have custom tflint config in the root of my git repository. What I've noticed, is that tflint doesn't use it, if i try to specify it via direct_configs like this

lint:
  definitions:
    - name: tflint
      direct_configs: 
       - .tflint.hcl
       - ${workspace}/.tflint.hcl # doesn't work

tbh, I haven't find any clear description for direct_configs attribute, so still not sure that this is proper place to specify custom config location

Current workaround for me is to specify config dir via env variable

lint:
  definitions:
    - name: tflint
      environment:
        - name: TFLINT_CONFIG_FILE
          value: ${workspace}/.tflint.hcl

or via --config argument

lint:
  definitions:
    - name: tflint
      commands:
        - name: lint
          run: tflint --format=sarif --chdir=${target} --force --config=${workspace}/.tflint.hcl

Info

paths:

  • ${workspace}/.trunk/trunk.yaml
  • ${workspace}/.tflint.hcl

versions

Is there a way to use a bandit.yaml with the bandit linter?

I'd like to disable B101 for tests per:

https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html#module-bandit.plugins.asserts

You can configure files that skip this check. This is often useful when you use assert statements in test cases.

assert_used:
  skips: ['*_test.py', '*test_*.py']

Right now, if I understand correctly, we can only use a .bandit ini file. As far as I can tell only has the ability to skip files or disable checks across for the entire repo.

https://github.com/trunk-io/plugins/blob/main/linters/bandit/plugin.yaml#L20

Custom Dictionaries seem to break `cspell`

I'm running this command for all 3 scenarios:

trunk check --all --filter cspell

Scenario 1

cspell.yaml:

version: "0.2"
suggestionsTimeout: 5000

Result: 94 issues


Scenario 2

cspell.yaml:

version: "0.2"
suggestionsTimeout: 5000
dictionaries:
  - python

Result: 69 issues


Scenario 3

cspell.yaml:

version: "0.2"
suggestionsTimeout: 5000
dictionaryDefinitions:
  - name: cspell-custom-dict
    path: ./cspell-custom-dict.txt
dictionaries:
  - cspell-custom-dict

Result: No issues1


Other Info

Reference Config:


trunk.yaml:

---
# This file controls the behavior of Trunk: https://docs.trunk.io/cli
# To learn more about the format of this file,
# see https://docs.trunk.io/reference/trunk-yaml
version: 0.1
cli:
  version: 1.17.1
plugins:
  sources:
    - id: trunk
      ref: v1.2.6
      uri: https://github.com/trunk-io/plugins
runtimes:
  definitions:
    - type: python
      system_version: allowed
lint:
  disabled:
    - autopep8
    - checkov
    - pyright
    - sourcery
    - yapf
  enabled:
    - [email protected]
    - [email protected]
    - [email protected]
    - [email protected]
    - [email protected]
    - [email protected]
    - git-diff-check
    - [email protected]
    - [email protected]
    - [email protected]
    - [email protected]
    - [email protected]
    - [email protected]
    - [email protected]
    - [email protected]
    - [email protected]
    - [email protected]
    - [email protected]
    - [email protected]
    - [email protected]
    - [email protected]
    - [email protected]
actions:
  disabled:
    - commitlint
    - trunk-announce
    - trunk-check-pre-push
    - trunk-fmt-pre-commit
  enabled:
    - trufflehog-pre-commit
    - trunk-upgrade-available

Footnotes

  1. This happens with an empty cspell-custom-dict.txt, and also with a single word in it. ↩

Add markdown-table-prettify plugin

The markdown-table-prettify tool formats markdown tables.

I don't know if this type of formatting can be done with prettier or any other plugin already listed, but I would really appreciate you guys adding this since it's pretty (pun intended) useful.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.