Skip to content

Pluto 1382 change tools configs location #59

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Apr 8, 2025

Conversation

andrzej-janczak
Copy link
Contributor

No description provided.

- Added cli-v2 and cli-config.yaml to .gitignore.
- Downgraded ESLint version in codacy.yaml from 9.3.0 to 8.57.0.
- Updated file creation paths in init.go to use localCodacyDir for ESLint, Trivy, and PMD configuration files, ensuring they are saved in the correct directory.
- Removed cli-config.yaml from the repository and updated .gitignore accordingly.
- Added ESLint and Trivy configuration files to the tools-configs directory.
- Modified ESLint and Trivy runner functions to utilize the new configuration files.
- Cleaned up PMD runner to default to the new ruleset configuration if none is specified.
@andrzej-janczak andrzej-janczak requested a review from Copilot April 7, 2025 15:24
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 11 out of 13 changed files in this pull request and generated no comments.

Files not reviewed (2)
  • .codacy/cli-config.yaml: Language not supported
  • tools/testdata/repositories/test1/expected.sarif: Language not supported
Comments suppressed due to low confidence (3)

tools/trivyRunner.go:14

  • Consider using the ToolsConfigDirectory accessor from the config package instead of hardcoding '.codacy/tools-configs', to ensure consistency if the directory path ever needs to change.
configFile := filepath.Join(".codacy", "tools-configs", "trivy.yaml")

tools/pmdRunner.go:27

  • Consider retrieving the tools configuration directory via the config package rather than hardcoding '.codacy/tools-configs' here, to improve consistency across the codebase.
configFile := filepath.Join(".codacy", "tools-configs", "pmd-ruleset.xml")

tools/eslintRunner.go:23

  • Consider using the config package's ToolsConfigDirectory accessor here in place of the hardcoded '.codacy/tools-configs', to centralize configuration path management.
configFile := filepath.Join(".codacy", "tools-configs", "eslint.config.mjs")

Copy link

codacy-production bot commented Apr 7, 2025

Coverage summary from Codacy

See diff coverage on Codacy

Coverage variation Diff coverage
-0.01% 33.77%
Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (6ed461d) 2218 589 26.56%
Head commit (ed8f3b7) 2260 (+42) 600 (+11) 26.55% (-0.01%)

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#59) 77 26 33.77%

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

See your quality gate settings    Change summary preferences

@andrzej-janczak andrzej-janczak changed the title Pluto 1382 change tool configs location Pluto 1382 change tools configs location Apr 7, 2025
cmd/init.go Outdated
toolsConfigDir := config.Config.ToolsConfigDirectory()

// Create tools-configs directory if it doesn't exist
if err := os.MkdirAll(toolsConfigDir, 0777); err != nil {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trying to give less permission seems cool

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done, added constants

cmd := exec.Command(pmdBinary, "pmd")

// Add config file from tools-configs directory if not specified
if rulesetFile == "" {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see that we pass always "" is this a WIP, or suppose to be like this on the scope of this PR? I see you removed a setting witch was PMD only (which makes sense for me to be removed). So maybe we don't even want this argument if this if is just a fake?

Meaning, instead of deciding this here, assuming that we were passing some kind of default, is to generate a file with the defaults as needed?

Copy link
Contributor Author

@andrzej-janczak andrzej-janczak Apr 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not always, in test I use a specific file and In this case it's ok.

Generally, If in future we want to be able to pass smth like analyze --config xyz.file - like ovveride, then it can stay.
If not we can delete 🤷‍♂️

- Implemented a function to create a .gitignore file during the initialization of Codacy configuration.
- Updated .gitignore to include cli-v2 and removed unnecessary entries.
- Ensured the .gitignore file contains relevant entries for Codacy CLI tools.
- Updated file creation functions to use `utils.DefaultRW` for read/write permissions instead of hardcoded values.
- Ensured consistency in permission settings across PMD and Trivy configuration file creation.
@machadoit machadoit merged commit 93219d2 into main Apr 8, 2025
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants