Skip to content

Conversation

mkurz
Copy link
Contributor

@mkurz mkurz commented Jul 10, 2023

Without the leading dot (not hidden),

Now that the config can be located inside the already hidden .github and .config folder (#3033) there is not need for the config file to be hidden as well inside that folders.
To stay backward compatible a hidden config .scala-steward.conf will always be preferred, only when such a hidden file can't be found anywhere, only then we try to read the "unhidden" scala-steward.conf in the same search order (root, .github, .config folders)

See #3033 (comment)

@mkurz mkurz changed the title Support scala-steward.conf (makes sense in .github and .config folder) Support scala-steward.conf (makes sense in .github and .config folder) Jul 10, 2023
@mkurz mkurz force-pushed the unprefixed-scala-steward.conf branch from c09fce1 to ebd63e0 Compare July 11, 2023 08:24
val configFileCandidates: F[List[File]] = (repoConfigFileSearchPath
.map(_ :+ repoConfigBasename) ++
repoConfigFileSearchPath
.map(_ :+ repoConfigBasename.substring(1)))
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The fix is here: The .substring(1) removes the leading dot from the filename.
As you can see I just append the possible non-hidden config file locations to the end of the list, which later will be searched for the first existing config file.

Copy link
Contributor

Choose a reason for hiding this comment

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

Would it make sense to change the repoConfigBasename to be without the . instead, and then add the dot here? substring use here adds a bit of a mental overhead.

PS: not associated with the project, but got a notification because of my PR and had to look at the code! Feel free to ignore :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The repoConfigBasename variable is publicly accessible therefore I don't want to change it's value for backwards compatibility.

Copy link
Contributor

Choose a reason for hiding this comment

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

makes sense!

Copy link
Member

Choose a reason for hiding this comment

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

In line 46 of this file it maybe good to use the actual filename (activeConfigFile) instead of repoConfigBasename

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@mzuehlke Done and pushed, thanks!

assert(fileAlg.isRegularFile(dotGithubConfigFile).unsafeRunSync())

assert(config.maybeRepoConfig.isDefined)
}
Copy link
Contributor Author

@mkurz mkurz Jul 11, 2023

Choose a reason for hiding this comment

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

The tests I added are basically just duplicates of the preceding test(s), just with the dot removed from the filename.

@mkurz
Copy link
Contributor Author

mkurz commented Jul 11, 2023

@fthomas @alejandrohdezma @mzuehlke if one of you can review, I think the PR is very straight forward, tests are all green, would love to see it merged, thanks!

Copy link
Member

@mzuehlke mzuehlke left a comment

Choose a reason for hiding this comment

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

Small comment for a better exception message.

val configFileCandidates: F[List[File]] = (repoConfigFileSearchPath
.map(_ :+ repoConfigBasename) ++
repoConfigFileSearchPath
.map(_ :+ repoConfigBasename.substring(1)))
Copy link
Member

Choose a reason for hiding this comment

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

In line 46 of this file it maybe good to use the actual filename (activeConfigFile) instead of repoConfigBasename

@mkurz mkurz force-pushed the unprefixed-scala-steward.conf branch from ebd63e0 to bff84e2 Compare July 11, 2023 20:27
@codecov
Copy link

codecov bot commented Jul 11, 2023

Codecov Report

Patch coverage: 100.00% and no project coverage change.

Comparison is base (b83aae5) 91.03% compared to head (bff84e2) 91.03%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3115   +/-   ##
=======================================
  Coverage   91.03%   91.03%           
=======================================
  Files         162      162           
  Lines        3404     3404           
  Branches      311      311           
=======================================
  Hits         3099     3099           
  Misses        305      305           
Impacted Files Coverage Δ
...g/scalasteward/core/repoconfig/RepoConfigAlg.scala 100.00% <100.00%> (ø)

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cat:repo-config enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants