Skip to content

Commit bc0d2a3

Browse files
resolved conflicts, hardcoded Pyrefly file extension since it's not in the API
2 parents 11311ee + 6c9c7f2 commit bc0d2a3

File tree

84 files changed

+39723
-1246
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

84 files changed

+39723
-1246
lines changed

.codacy/codacy.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
runtimes:
22
3+
34
45
56
@@ -10,5 +11,6 @@ tools:
1011
1112
1213
14+
1315
1416

.github/workflows/it-test.yml

Lines changed: 2 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -93,34 +93,8 @@ jobs:
9393
continue-on-error: true
9494
shell: bash
9595
run: |
96-
# Make the script executable
97-
chmod +x run-tool-tests.sh
98-
99-
# Initialize failed tools file
100-
rm -f /tmp/failed_tools.txt
101-
touch /tmp/failed_tools.txt
102-
103-
# Run tests for each tool directory
104-
for tool_dir in plugins/tools/*/; do
105-
tool_name=$(basename "$tool_dir")
106-
if [ -d "$tool_dir/test/src" ]; then
107-
echo "Running tests for $tool_name..."
108-
./run-tool-tests.sh "$tool_name" || {
109-
echo "❌ Test failed for $tool_name"
110-
echo "$tool_name" >> /tmp/failed_tools.txt
111-
}
112-
fi
113-
done
114-
115-
# Check if any tools failed
116-
if [ -s /tmp/failed_tools.txt ] && [ "$(wc -l < /tmp/failed_tools.txt)" -gt 0 ]; then
117-
echo -e "\n❌ The following tools failed their tests:"
118-
cat /tmp/failed_tools.txt
119-
echo "::error::Some tool tests failed. Please check the logs above for details."
120-
exit 1
121-
else
122-
echo "✅ All tool tests passed successfully!"
123-
fi
96+
chmod +x integration-tests/test-tools.sh
97+
./integration-tests/test-tools.sh
12498
12599
- name: Check test results
126100
if: always()

README.md

Lines changed: 46 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,46 @@ Bootstraps the CLI configuration in your project's folder. This command creates
7171
- `--organization` (string): Organization name, required with `--api-token`
7272
- `--repository` (string): Repository name, required with `--api-token`
7373

74+
### `config reset` — Reset Configuration
75+
76+
Resets the Codacy configuration files and tool-specific configurations. This command overwrites existing configuration with either local default configurations or repository-specific configurations from Codacy.
77+
78+
```bash
79+
# Reset to local default configurations
80+
codacy-cli config reset
81+
82+
# Reset to repository-specific configurations from Codacy
83+
codacy-cli config reset --api-token <token> --provider <gh|gl|bb> --organization <org> --repository <repo>
84+
```
85+
86+
**Behavior:**
87+
- **Local mode**: Creates default configurations for all available tools
88+
- **Remote mode**: Fetches and applies repository-specific configurations from Codacy
89+
- Prevents accidental mode switching (remote to local requires explicit flags)
90+
- Overwrites existing `.codacy/codacy.yaml` and tool configurations
91+
- Creates or updates `.codacy/.gitignore` file
92+
93+
**Flags:** Same as `init` command (api-token, provider, organization, repository)
94+
95+
### `config discover` — Discover Project Languages
96+
97+
Scans a project directory to detect programming languages and automatically configures appropriate static analysis tools. This command updates both `languages-config.yaml` and `codacy.yaml` with relevant tools for detected languages.
98+
99+
```bash
100+
# Discover languages in current directory
101+
codacy-cli config discover .
102+
103+
# Discover languages in specific project path
104+
codacy-cli config discover /path/to/project
105+
```
106+
107+
**Features:**
108+
- Automatically detects file extensions and maps them to programming languages
109+
- Updates `.codacy/tools-configs/languages-config.yaml` with discovered languages
110+
- Enables relevant tools in `codacy.yaml` based on detected languages
111+
- Creates tool-specific configuration files for discovered tools
112+
- Works in both local and cloud modes
113+
74114
### `install` — Install Runtimes and Tools
75115

76116
Installs all runtimes and tools specified in `.codacy/codacy.yaml`:
@@ -172,14 +212,17 @@ codacy-cli init
172212
# or
173213
codacy-cli init --api-token <token> --provider gh --organization my-org --repository my-repo
174214

175-
# 2. Install all required runtimes and tools
215+
# 2. (Optional) Discover languages and configure tools automatically
216+
codacy-cli config discover .
217+
218+
# 3. Install all required runtimes and tools
176219
codacy-cli install
177220

178-
# 3. Run analysis (all tools or specific tool)
221+
# 4. Run analysis (all tools or specific tool)
179222
codacy-cli analyze
180223
codacy-cli analyze --tool eslint
181224

182-
# 4. Upload results to Codacy
225+
# 5. Upload results to Codacy
183226
codacy-cli upload -s eslint.sarif -c <commit-uuid> -t <project-token>
184227
```
185228

cli-v2.go

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,13 @@ func main() {
3939
}
4040
}
4141

42-
// Check if command is init/update
43-
if len(os.Args) > 1 && (os.Args[1] == "init" || os.Args[1] == "update") {
44-
cmd.Execute()
45-
return
42+
// Check if command is init/update/version/help - these don't require configuration
43+
if len(os.Args) > 1 {
44+
cmdName := os.Args[1]
45+
if cmdName == "init" || cmdName == "update" || cmdName == "version" || cmdName == "help" {
46+
cmd.Execute()
47+
return
48+
}
4649
}
4750

4851
// All other commands require a configuration file

0 commit comments

Comments
 (0)