Skip to content
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

Fix OutputFileHandler not ignoring a correctly named gz filename #2989

Merged

Conversation

MW-Friedrich
Copy link
Contributor

Fix OutputFileHandler not ignoring a correctly named gz filename

Issue: #2800

Description

Addendum to PR #2914 to fix a bug that was discovered after the merge :(

Refactor a method for better readability
Fix missing '#' in changelog
#2800
@MW-Friedrich MW-Friedrich self-assigned this Aug 19, 2022
@sonarcloud
Copy link

sonarcloud bot commented Aug 19, 2022

[CodeCharta Analysis] Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

100.0% 100.0% Coverage
0.0% 0.0% Duplication

@sonarcloud
Copy link

sonarcloud bot commented Aug 19, 2022

[CodeCharta Visualization] Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

Copy link
Contributor

@knoffi knoffi left a comment

Choose a reason for hiding this comment

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

LGTM! 🚀

@MW-Friedrich MW-Friedrich merged commit 44282b8 into main Aug 19, 2022
@MW-Friedrich MW-Friedrich deleted the fix/2800/correctly-named-gz-files-still-get-corrected branch August 19, 2022 09:33
@@ -19,16 +19,20 @@ object OutputFileHandler {
}

fun checkAndFixFileExtension(outputName: String): String {
if (outputName.endsWith("cc.json")) {
if (outputName.endsWith("cc.json") || outputName.endsWith(".cc.json.gz")) {
Copy link
Member

Choose a reason for hiding this comment

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

I would just use a regular expression for cases like these. That way it's a single check with optional parts. I would also handle the .cc optional (and our logic here is somewhat flawed as it would match files like abcc.json. I would accept it as it's a json file but it's just inconsistent right now.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think I remember @ce-bo saying that we should only consider .cc.json as valid, but thanks a lot for the hint with the regEx!
@phanlezz also noticed that we append .gz again, even if the user already specified it (so test.cc.json.gz becomes test.cc.json.gz.gz)
Should we/I open a new ticket for this or continue this here?

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.

Improving CLI output name handling by adding file extensions if necessary
3 participants