stacklink 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- stacklink-0.1.0/.claude/settings.local.json +13 -0
- stacklink-0.1.0/.codacy/.gitignore +5 -0
- stacklink-0.1.0/.codacy/cli-config.yaml +1 -0
- stacklink-0.1.0/.codacy/cli.sh +149 -0
- stacklink-0.1.0/.codacy/codacy.yaml +15 -0
- stacklink-0.1.0/.codacy/logs/codacy-cli.log +668 -0
- stacklink-0.1.0/.codacy/tools-configs/analysis_options.yaml +222 -0
- stacklink-0.1.0/.codacy/tools-configs/eslint.config.mjs +68 -0
- stacklink-0.1.0/.codacy/tools-configs/languages-config.yaml +33 -0
- stacklink-0.1.0/.codacy/tools-configs/lizard.yaml +50 -0
- stacklink-0.1.0/.codacy/tools-configs/pylint.rc +9 -0
- stacklink-0.1.0/.codacy/tools-configs/revive.toml +56 -0
- stacklink-0.1.0/.codacy/tools-configs/ruleset.xml +167 -0
- stacklink-0.1.0/.codacy/tools-configs/semgrep.yaml +34557 -0
- stacklink-0.1.0/.codacy/tools-configs/trivy.yaml +10 -0
- stacklink-0.1.0/.env.example +3 -0
- stacklink-0.1.0/.gitignore +19 -0
- stacklink-0.1.0/LICENSE +21 -0
- stacklink-0.1.0/PKG-INFO +149 -0
- stacklink-0.1.0/README.md +115 -0
- stacklink-0.1.0/docs/config.md +110 -0
- stacklink-0.1.0/docs/health.md +124 -0
- stacklink-0.1.0/docs/logger.md +109 -0
- stacklink-0.1.0/examples/basic_fastapi/.env.example +4 -0
- stacklink-0.1.0/examples/basic_fastapi/main.py +27 -0
- stacklink-0.1.0/pyproject.toml +57 -0
- stacklink-0.1.0/stacklink/__init__.py +16 -0
- stacklink-0.1.0/stacklink/config.py +162 -0
- stacklink-0.1.0/stacklink/health.py +103 -0
- stacklink-0.1.0/stacklink/logger.py +168 -0
- stacklink-0.1.0/stacklink-plan.md +421 -0
- stacklink-0.1.0/stacklink-practices.md +386 -0
- stacklink-0.1.0/tests/__init__.py +0 -0
- stacklink-0.1.0/tests/test_config.py +212 -0
- stacklink-0.1.0/tests/test_health.py +197 -0
- stacklink-0.1.0/tests/test_logger.py +104 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
mode: local
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
set -e +o pipefail
|
|
5
|
+
|
|
6
|
+
# Set up paths first
|
|
7
|
+
bin_name="codacy-cli-v2"
|
|
8
|
+
|
|
9
|
+
# Determine OS-specific paths
|
|
10
|
+
os_name=$(uname)
|
|
11
|
+
arch=$(uname -m)
|
|
12
|
+
|
|
13
|
+
case "$arch" in
|
|
14
|
+
"x86_64")
|
|
15
|
+
arch="amd64"
|
|
16
|
+
;;
|
|
17
|
+
"x86")
|
|
18
|
+
arch="386"
|
|
19
|
+
;;
|
|
20
|
+
"aarch64"|"arm64")
|
|
21
|
+
arch="arm64"
|
|
22
|
+
;;
|
|
23
|
+
esac
|
|
24
|
+
|
|
25
|
+
if [ -z "$CODACY_CLI_V2_TMP_FOLDER" ]; then
|
|
26
|
+
if [ "$(uname)" = "Linux" ]; then
|
|
27
|
+
CODACY_CLI_V2_TMP_FOLDER="$HOME/.cache/codacy/codacy-cli-v2"
|
|
28
|
+
elif [ "$(uname)" = "Darwin" ]; then
|
|
29
|
+
CODACY_CLI_V2_TMP_FOLDER="$HOME/Library/Caches/Codacy/codacy-cli-v2"
|
|
30
|
+
else
|
|
31
|
+
CODACY_CLI_V2_TMP_FOLDER=".codacy-cli-v2"
|
|
32
|
+
fi
|
|
33
|
+
fi
|
|
34
|
+
|
|
35
|
+
version_file="$CODACY_CLI_V2_TMP_FOLDER/version.yaml"
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
get_version_from_yaml() {
|
|
39
|
+
if [ -f "$version_file" ]; then
|
|
40
|
+
local version=$(grep -o 'version: *"[^"]*"' "$version_file" | cut -d'"' -f2)
|
|
41
|
+
if [ -n "$version" ]; then
|
|
42
|
+
echo "$version"
|
|
43
|
+
return 0
|
|
44
|
+
fi
|
|
45
|
+
fi
|
|
46
|
+
return 1
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
get_latest_version() {
|
|
50
|
+
local response
|
|
51
|
+
if [ -n "$GH_TOKEN" ]; then
|
|
52
|
+
response=$(curl -Lq --header "Authorization: Bearer $GH_TOKEN" "https://api.github.com/repos/codacy/codacy-cli-v2/releases/latest" 2>/dev/null)
|
|
53
|
+
else
|
|
54
|
+
response=$(curl -Lq "https://api.github.com/repos/codacy/codacy-cli-v2/releases/latest" 2>/dev/null)
|
|
55
|
+
fi
|
|
56
|
+
|
|
57
|
+
handle_rate_limit "$response"
|
|
58
|
+
local version=$(echo "$response" | grep -m 1 tag_name | cut -d'"' -f4)
|
|
59
|
+
echo "$version"
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
handle_rate_limit() {
|
|
63
|
+
local response="$1"
|
|
64
|
+
if echo "$response" | grep -q "API rate limit exceeded"; then
|
|
65
|
+
fatal "Error: GitHub API rate limit exceeded. Please try again later"
|
|
66
|
+
fi
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
download_file() {
|
|
70
|
+
local url="$1"
|
|
71
|
+
|
|
72
|
+
echo "Downloading from URL: ${url}"
|
|
73
|
+
if command -v curl > /dev/null 2>&1; then
|
|
74
|
+
curl -# -LS "$url" -O
|
|
75
|
+
elif command -v wget > /dev/null 2>&1; then
|
|
76
|
+
wget "$url"
|
|
77
|
+
else
|
|
78
|
+
fatal "Error: Could not find curl or wget, please install one."
|
|
79
|
+
fi
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
download() {
|
|
83
|
+
local url="$1"
|
|
84
|
+
local output_folder="$2"
|
|
85
|
+
|
|
86
|
+
( cd "$output_folder" && download_file "$url" )
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
download_cli() {
|
|
90
|
+
# OS name lower case
|
|
91
|
+
suffix=$(echo "$os_name" | tr '[:upper:]' '[:lower:]')
|
|
92
|
+
|
|
93
|
+
local bin_folder="$1"
|
|
94
|
+
local bin_path="$2"
|
|
95
|
+
local version="$3"
|
|
96
|
+
|
|
97
|
+
if [ ! -f "$bin_path" ]; then
|
|
98
|
+
echo "📥 Downloading CLI version $version..."
|
|
99
|
+
|
|
100
|
+
remote_file="codacy-cli-v2_${version}_${suffix}_${arch}.tar.gz"
|
|
101
|
+
url="https://github.com/codacy/codacy-cli-v2/releases/download/${version}/${remote_file}"
|
|
102
|
+
|
|
103
|
+
download "$url" "$bin_folder"
|
|
104
|
+
tar xzfv "${bin_folder}/${remote_file}" -C "${bin_folder}"
|
|
105
|
+
fi
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
# Warn if CODACY_CLI_V2_VERSION is set and update is requested
|
|
109
|
+
if [ -n "$CODACY_CLI_V2_VERSION" ] && [ "$1" = "update" ]; then
|
|
110
|
+
echo "⚠️ Warning: Performing update with forced version $CODACY_CLI_V2_VERSION"
|
|
111
|
+
echo " Unset CODACY_CLI_V2_VERSION to use the latest version"
|
|
112
|
+
fi
|
|
113
|
+
|
|
114
|
+
# Ensure version.yaml exists and is up to date
|
|
115
|
+
if [ ! -f "$version_file" ] || [ "$1" = "update" ]; then
|
|
116
|
+
echo "ℹ️ Fetching latest version..."
|
|
117
|
+
version=$(get_latest_version)
|
|
118
|
+
mkdir -p "$CODACY_CLI_V2_TMP_FOLDER"
|
|
119
|
+
echo "version: \"$version\"" > "$version_file"
|
|
120
|
+
fi
|
|
121
|
+
|
|
122
|
+
# Set the version to use
|
|
123
|
+
if [ -n "$CODACY_CLI_V2_VERSION" ]; then
|
|
124
|
+
version="$CODACY_CLI_V2_VERSION"
|
|
125
|
+
else
|
|
126
|
+
version=$(get_version_from_yaml)
|
|
127
|
+
fi
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
# Set up version-specific paths
|
|
131
|
+
bin_folder="${CODACY_CLI_V2_TMP_FOLDER}/${version}"
|
|
132
|
+
|
|
133
|
+
mkdir -p "$bin_folder"
|
|
134
|
+
bin_path="$bin_folder"/"$bin_name"
|
|
135
|
+
|
|
136
|
+
# Download the tool if not already installed
|
|
137
|
+
download_cli "$bin_folder" "$bin_path" "$version"
|
|
138
|
+
chmod +x "$bin_path"
|
|
139
|
+
|
|
140
|
+
run_command="$bin_path"
|
|
141
|
+
if [ -z "$run_command" ]; then
|
|
142
|
+
fatal "Codacy cli v2 binary could not be found."
|
|
143
|
+
fi
|
|
144
|
+
|
|
145
|
+
if [ "$#" -eq 1 ] && [ "$1" = "download" ]; then
|
|
146
|
+
echo "Codacy cli v2 download succeeded"
|
|
147
|
+
else
|
|
148
|
+
eval "$run_command $*"
|
|
149
|
+
fi
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
runtimes:
|
|
2
|
+
- dart@3.7.2
|
|
3
|
+
- go@1.24.13
|
|
4
|
+
- java@17.0.10
|
|
5
|
+
- node@22.2.0
|
|
6
|
+
- python@3.11.11
|
|
7
|
+
tools:
|
|
8
|
+
- dartanalyzer@3.7.2
|
|
9
|
+
- eslint@8.57.0
|
|
10
|
+
- lizard@1.17.31
|
|
11
|
+
- opengrep@1.16.4
|
|
12
|
+
- pmd@7.11.0
|
|
13
|
+
- pylint@3.3.6
|
|
14
|
+
- revive@1.7.0
|
|
15
|
+
- trivy@0.69.3
|