Skip to content

Commit f496f97

Browse files
authored
Merge pull request #111 from codacy/cli-config-file
fix: add cli config file to condition CY-7560
2 parents d95f64a + ab2e613 commit f496f97

3 files changed

Lines changed: 11 additions & 10 deletions

File tree

.codacy/.gitignore

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
*.sh
2-
*.yaml
3-
4-
# tools-config folder
1+
# Codacy CLI
52
tools-configs/
6-
logs/
7-
3+
.gitignore
4+
cli-config.yaml
5+
*.sh

.codacy/codacy.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
runtimes:
22
- node@22.2.0
33
tools:
4-
- trivy@0.59.1
5-
- pmd@6.55.0
64
- semgrep@1.78.0
75
- eslint@8.57.0
6+
- trivy@0.59.1
7+
- pmd@6.55.0

src/cli/MacCodacyCli.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,11 +120,14 @@ export class MacCodacyCli extends CodacyCli {
120120
public async initialize(): Promise<void> {
121121
// Check if the configuration files exist
122122
const configFilePath = path.join(this.rootPath, CODACY_FOLDER_NAME, 'codacy.yaml')
123+
const cliConfigFilePath = path.join(this.rootPath, CODACY_FOLDER_NAME, 'cli-config.yaml')
123124
const toolsFolderPath = path.join(this.rootPath, CODACY_FOLDER_NAME, 'tools-configs')
124125

125-
let needsInitialization = !fs.existsSync(configFilePath) || !fs.existsSync(toolsFolderPath)
126+
const initFilesOk =
127+
fs.existsSync(configFilePath) && fs.existsSync(cliConfigFilePath) && fs.existsSync(toolsFolderPath)
128+
let needsInitialization = !initFilesOk
126129

127-
if (!needsInitialization) {
130+
if (initFilesOk) {
128131
// Check if the mode matches the current properties
129132
const cliConfig = fs.readFileSync(path.join(this.rootPath, CODACY_FOLDER_NAME, 'cli-config.yaml'), 'utf-8')
130133

0 commit comments

Comments
 (0)