Skip to content

Report a compilation error for invalid placeholders [Part II]#217

Merged
yevhenii-nadtochii merged 20 commits intomasterfrom
report-illegal-placeholders-2
Apr 29, 2025
Merged

Report a compilation error for invalid placeholders [Part II]#217
yevhenii-nadtochii merged 20 commits intomasterfrom
report-illegal-placeholders-2

Conversation

@yevhenii-nadtochii
Copy link
Copy Markdown
Contributor

@yevhenii-nadtochii yevhenii-nadtochii commented Apr 28, 2025

This PR is a continuation of #216.

It completes #213 by adding the requested check to the remaining options.

Now, checkPlaceholders() function is shared among all options. It has three overloadings due to the fact that we have options for fields, oneofs and messages.

For some options, I have also added basic tests to check compilation errors upon unsupported field types.

@yevhenii-nadtochii yevhenii-nadtochii self-assigned this Apr 28, 2025
@yevhenii-nadtochii yevhenii-nadtochii changed the base branch from master to report-illegal-placeholders April 28, 2025 15:32
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 28, 2025

Codecov Report

Attention: Patch coverage is 72.07207% with 31 lines in your changes missing coverage. Please review.

Project coverage is 28.21%. Comparing base (976d3bf) to head (90350e0).
Report is 21 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff              @@
##             master     #217      +/-   ##
============================================
+ Coverage     26.14%   28.21%   +2.07%     
- Complexity      241      242       +1     
============================================
  Files           137      138       +1     
  Lines          3236     3314      +78     
  Branches        247      247              
============================================
+ Hits            846      935      +89     
+ Misses         2351     2327      -24     
- Partials         39       52      +13     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Base automatically changed from report-illegal-placeholders to master April 29, 2025 09:44
@yevhenii-nadtochii yevhenii-nadtochii marked this pull request as ready for review April 29, 2025 11:03
@yevhenii-nadtochii
Copy link
Copy Markdown
Contributor Author

@armiol @alexander-yevsyukov PTAL

Copy link
Copy Markdown
Collaborator

@armiol armiol left a comment

Choose a reason for hiding this comment

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

@yevhenii-nadtochii please see my comments.

@@ -1,5 +1,5 @@
/*
` * Copyright 2024, TeamDev. All rights reserved.
* Copyright 2024, TeamDev. All rights reserved.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

In which case, it's 2025.

string string_value = 2;

bool bool_value = 3;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This line is redundant.

@yevhenii-nadtochii
Copy link
Copy Markdown
Contributor Author

@armiol PTAL

Copy link
Copy Markdown
Collaborator

@alexander-yevsyukov alexander-yevsyukov left a comment

Choose a reason for hiding this comment

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

Please see my comment.

Copy link
Copy Markdown
Collaborator

@alexander-yevsyukov alexander-yevsyukov left a comment

Choose a reason for hiding this comment

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

LGTM, with the comments regarding the code layout to consider.

It is better to have the sets given as vertical lists for easier reading.

public val FieldType.isSingularString: Boolean
get() = primitive == TYPE_STRING

private val SUPPORTED_PLACEHOLDERS =
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Please have the values line by line, and alphabetically sorted.

}

private val SUPPORTED_PLACEHOLDERS =
setOf(FIELD_PATH, FIELD_VALUE, FIELD_TYPE, PARENT_TYPE, WHEN_IN)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Please have the values line by line, and alphabetically sorted.


private val DELIMITER = Regex("""(?<=\d)\s?\.\.\s?(?=[\d-+])""")

private val SUPPORTED_PLACEHOLDERS =
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Please have the values line by line, and alphabetically sorted.

}
}

private val SUPPORTED_PLACEHOLDERS = setOf(MESSAGE_TYPE, REQUIRE_FIELDS)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Please have the values line by line, and alphabetically sorted.

@yevhenii-nadtochii yevhenii-nadtochii merged commit 21343cd into master Apr 29, 2025
7 checks passed
@yevhenii-nadtochii yevhenii-nadtochii deleted the report-illegal-placeholders-2 branch April 29, 2025 15:09
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.

Make policies check the error message placeholders

3 participants