This commit is contained in:
isseysandei 2025-01-12 18:07:13 +01:00
parent 00e354a8ad
commit a84f19ca51
13 changed files with 105 additions and 111 deletions

View File

@ -1,2 +0,0 @@
[bandit]
skips = B101

View File

@ -1,6 +0,0 @@
Language: Cpp
IndentWidth: 4
ColumnLimit: 130
PointerAlignment: Right
BreakBeforeBraces: Linux
AllowShortFunctionsOnASingleLine: Inline

View File

@ -1,3 +0,0 @@
# Autoformatter friendly flake8 config (all formatting rules disabled)
[flake8]
extend-ignore = D1, D2, E1, E2, E3, E501, W1, W2, W3, W5

View File

@ -1,4 +0,0 @@
# Following source doesn't work in most setups
ignored:
- SC1090
- SC1091

View File

@ -1,2 +0,0 @@
[settings]
profile=black

View File

@ -1,10 +0,0 @@
# Autoformatter friendly markdownlint config (all formatting rules disabled)
default: true
blank_lines: false
bullet: false
html: false
indentation: false
line_length: false
spaces: false
url: false
whitespace: false

View File

@ -1,10 +0,0 @@
enable=all
source-path=SCRIPTDIR
disable=SC2154
disable=SC2248
disable=SC2250
# If you're having issues with shellcheck following source, disable the errors via:
# disable=SC1090
# disable=SC1091
#

View File

@ -1,10 +0,0 @@
rules:
quoted-strings:
required: only-when-needed
extra-allowed: ["{|}"]
empty-values:
forbid-in-block-mappings: false
forbid-in-flow-mappings: true
key-duplicates: {}
octal-values:
forbid-implicit-octal: true

View File

@ -1,5 +0,0 @@
# Generic, formatter-friendly config.
select = ["B", "D3", "D4", "E", "F"]
# Never enforce `E501` (line length violations). This should be handled by formatters.
ignore = ["E501"]

View File

@ -1,14 +0,0 @@
module.exports = {
plugins: [
{
name: "preset-default",
params: {
overrides: {
removeViewBox: false, // https://github.com/svg/svgo/issues/1128
sortAttrs: true,
removeOffCanvasPaths: true,
},
},
},
],
};

View File

@ -1,50 +1,11 @@
# 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.22.8
version: 1.22.2
# Trunk provides extensibility via plugins. (https://docs.trunk.io/plugins)
plugins:
sources:
- id: trunk
ref: v1.6.6
uri: https://github.com/trunk-io/plugins
lint:
enabled:
- prettier@3.4.2
- trufflehog@3.86.1
- yamllint@1.35.1
- bandit@1.8.0
- checkov@3.2.334
- terrascan@1.19.9
- trivy@0.58.0
#- trufflehog@3.63.2-rc0
- taplo@0.9.3
- ruff@0.8.3
- isort@5.13.2
- markdownlint@0.43.0
- oxipng@9.1.3
- svgo@3.3.2
- actionlint@1.7.4
- flake8@7.1.1
- hadolint@2.12.1-beta
- shfmt@3.6.0
- shellcheck@0.10.0
- black@24.10.0
- git-diff-check
- gitleaks@8.21.2
- clang-format@16.0.3
#- prettier@3.3.3
ignore:
- linters: [ALL]
paths:
- bin/**
runtimes:
enabled:
- python@3.10.8
- go@1.21.0
- node@18.20.5
actions:
disabled:
- trunk-announce
enabled:
- trunk-fmt-pre-commit
- trunk-check-pre-push
- trunk-upgrade-available
ref: v1.6.1
uri: https://github.com/trunk-io/plugins

27
package.json Normal file
View File

@ -0,0 +1,27 @@
{
"name": "firmware",
"version": "1.0.0",
"description": "![GitHub release downloads](https://img.shields.io/github/downloads/meshtastic/firmware/total) [![CI](https://img.shields.io/github/actions/workflow/status/meshtastic/firmware/main_matrix.yml?branch=master&label=actions&logo=github&color=yellow)](https://github.com/meshtastic/firmware/actions/workflows/ci.yml) [![CLA assistant](https://cla-assistant.io/readme/badge/meshtastic/firmware)](https://cla-assistant.io/meshtastic/firmware) [![Fiscal Contributors](https://opencollective.com/meshtastic/tiers/badge.svg?label=Fiscal%20Contributors&color=deeppink)](https://opencollective.com/meshtastic/) [![Vercel](https://img.shields.io/static/v1?label=Powered%20by&message=Vercel&style=flat&logo=vercel&color=000000)](https://vercel.com?utm_source=meshtastic&utm_campaign=oss)",
"main": "index.js",
"directories": {
"test": "test"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"trunk": "trunk",
"lint": "trunk check",
"fmt": "trunk fmt"
},
"repository": {
"type": "git",
"url": "git+https://github.com/isseysandei/firmware.git"
},
"keywords": [],
"author": "",
"license": "ISC",
"bugs": {
"url": "https://github.com/isseysandei/firmware/issues"
},
"homepage": "https://github.com/isseysandei/firmware#readme"
}

72
trunk.ps1 Normal file
View File

@ -0,0 +1,72 @@
$ErrorActionPreference = 'Stop'
$Env:TRUNK_LAUNCHER_VERSION="1.3.4" # warning: this line is auto-updated
$Env:TRUNK_LAUNCHER_PATH = $PSCommandPath
# Try to get the version from trunk.yaml.
function TryGetTrunkVersion {
$currentDir = (Get-Location).Path
while ($currentDir -ne '') {
$trunkYamlPath = "$currentDir\.trunk\trunk.yaml"
if (Test-Path "$trunkYamlPath") {
$yamlContent = Get-Content "$trunkYamlPath" -Raw
return $yamlContent -replace '(?s).*\s+version:\s*([0-9a-z.-]+).*','$1'
}
$currentDir = Split-Path $currentDir -Parent
}
return $null
}
# Get the latest version of trunk.
function GetLatestTrunkVersion {
$latestReleaseInfo = Invoke-RestMethod 'https://trunk.io/releases/latest' -UseBasicParsing
return $latestReleaseInfo -replace '(?s).*version:\s*([0-9a-z.-]+).*','$1'
}
# Download a particular version of trunk to the specified directory.
function DownloadTrunk($version, $trunkDir) {
$null = New-Item -Type Directory -Force -Path (Split-Path $trunkDir -Parent)
$guid = [System.Guid]::NewGuid()
$downloadPath = "$trunkDir.$guid.zip"
$destinationPath = "$trunkDir.$guid"
try {
# Download the zip file.
$zipFile = "trunk-$version.windows.zip"
$zipFilePath = "$tempDir\$zipFile"
$downloadUrl = "https://trunk.io/releases/$version/$zipFile"
Invoke-RestMethod -Uri $downloadUrl -OutFile $downloadPath
# Extract the zip file to a uniquely named directory.
Expand-Archive -Path $downloadPath -DestinationPath $destinationPath
# Remove the trunk directory if it already exists.
if (Test-Path $trunkDir) {
Remove-Item -Path $trunkDir -Recurse -Force
}
# Move the uniquely named trunk directory to the final location.
Move-Item -Path $destinationPath -Destination $trunkDir
}
finally {
# Cleanup.
Remove-Item -Path $downloadPath -Force -ea 0
Remove-Item -Path $destinationPath -Recurse -Force -ea 0
}
}
# Get the version to run.
$version = TryGetTrunkVersion
if ($version -eq $null) {
$version = GetLatestTrunkVersion
}
# Determine the expected path to trunk.exe.
$localApplicationData = [Environment]::GetFolderPath('LocalApplicationData')
$trunkDir = "$localApplicationData\trunk\cli\trunk-${version}-windows"
$trunkExe = "$trunkDir\trunk.exe"
# Download trunk.exe if it doesn't exist.
if (!(Test-Path $trunkExe)) {
DownloadTrunk $version $trunkDir
}
# Execute trunk with all arguments
& $trunkExe $args
exit $LastExitCode