Skip to content

Conversation

@machadoit
Copy link
Contributor

@machadoit machadoit commented Apr 7, 2025

The tools now should rely on the ConfigFileExists at configUtils to check and propagate the correct configuration file. That method will give preference to the generated file

@machadoit machadoit requested a review from a team April 7, 2025 16:41
@codacy-production
Copy link

codacy-production bot commented Apr 7, 2025

Coverage summary from Codacy

See diff coverage on Codacy

Coverage variation Diff coverage
-0.16% 27.42%
Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (d0b14b3) 2541 690 27.15%
Head commit (cbca7b2) 2571 (+30) 694 (+4) 26.99% (-0.16%)

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 (#60) 62 17 27.42%

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

@machadoit machadoit changed the base branch from PLUTO-1382-change-tool-configs-location to main April 8, 2025 09:28
@machadoit machadoit force-pushed the pick-right-config-PLUTO-1383 branch 2 times, most recently from eadba8d to dceec5a Compare April 9, 2025 13:59
…ative tool PLUTO-1383

Still needs updates on PMD
@machadoit machadoit force-pushed the pick-right-config-PLUTO-1383 branch from dceec5a to 278f68d Compare April 9, 2025 14:12
If a config file is generated (exists inside the .codacy) then rely on it
It also updates PMD to receive the configuration to be able to test it

func (c *ConfigType) setupCodacyPaths() {
c.globalCacheDirectory = filepath.Join(c.homePath, ".cache", "codacy")
func NewConfigType(repositoryDirectory string, repositoryCache string, globalCache string) *ConfigType {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Created a builder, so it can used both on the Global initialization and tests

return c
}

// TODO: Consider not having a global config and instead pass the config object around
Copy link
Contributor Author

Choose a reason for hiding this comment

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

For now, let's keep it, but it is now easier to remove, as it only depends at the NewConfigType method to generate the values for the config

// Returns:
// - string: The relative path to the configuration file (for cmd args)
// - bool: True if the file exists, false otherwise
func ConfigFileExists(conf config.ConfigType, fileName string) (string, bool) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Each tool runner should now depend on this when generating its command to pass a configuration file

@machadoit machadoit merged commit 0142cac into main Apr 10, 2025
7 checks passed
@alerizzo alerizzo deleted the pick-right-config-PLUTO-1383 branch June 3, 2025 09:45
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.

3 participants