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

Add constraint support for number of digits #102

Merged
merged 14 commits into from
Oct 27, 2023
Merged

Conversation

TharmiganK
Copy link
Contributor

@TharmiganK TharmiganK commented Oct 26, 2023

Purpose

$Subject

Fixes: ballerina-platform/ballerina-library#5081

Examples

@constraint:Int {maxDigits: 4}
type Integer int;

@constraint:Float {maxIntegerDigits: 3, maxFractionDigits: 2}
type Float float;

@constraint:Number {maxFractionDigits: 3}
type Number int|decimal;

Checklist

  • Linked to an issue
  • Updated the changelog
  • Added tests
  • Updated the spec
  • Checked native-image compatibility

@codecov
Copy link

codecov bot commented Oct 26, 2023

Codecov Report

Attention: 13 lines in your changes are missing coverage. Please review.

Comparison is base (4b09a00) 86.73% compared to head (af9e9ef) 87.92%.

Additional details and impacted files
@@             Coverage Diff              @@
##               main     #102      +/-   ##
============================================
+ Coverage     86.73%   87.92%   +1.18%     
- Complexity      202      315     +113     
============================================
  Files            21       38      +17     
  Lines           460      712     +252     
  Branches         84      136      +52     
============================================
+ Hits            399      626     +227     
- Misses           44       56      +12     
- Partials         17       30      +13     
Files Coverage Δ
ballerina/constraint.bal 57.14% <100.00%> (+7.14%) ⬆️
...traint/compiler/ConstraintCompatibilityMatrix.java 100.00% <100.00%> (ø)
...traint/compiler/ConstraintCompilerPluginUtils.java 97.40% <100.00%> (ø)
...constraint/compiler/ConstraintDiagnosticCodes.java 100.00% <100.00%> (ø)
...nt/compiler/annotation/tag/AnnotationTagFloat.java 100.00% <100.00%> (ø)
...aint/compiler/annotation/tag/AnnotationTagInt.java 100.00% <100.00%> (ø)
...t/compiler/annotation/tag/AnnotationTagNumber.java 100.00% <100.00%> (ø)
...java/io/ballerina/stdlib/constraint/Constants.java 100.00% <ø> (ø)
...onstraint/validators/FloatConstraintValidator.java 100.00% <100.00%> (ø)
...annotation/tag/DigitsConstrainedAnnotationTag.java 66.66% <66.66%> (ø)
... and 3 more

... and 10 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@TharmiganK TharmiganK force-pushed the add-digits-constraint branch from b722bf2 to 02d17de Compare October 26, 2023 08:53
@TharmiganK TharmiganK force-pushed the add-digits-constraint branch from ecc1419 to 0780714 Compare October 26, 2023 09:05
@TharmiganK TharmiganK marked this pull request as ready for review October 26, 2023 11:08
ThisaruGuruge
ThisaruGuruge previously approved these changes Oct 27, 2023
Copy link
Member

@ThisaruGuruge ThisaruGuruge left a comment

Choose a reason for hiding this comment

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

LGTM

@sonarqubecloud
Copy link

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
0.0% 0.0% Duplication

@TharmiganK TharmiganK merged commit 8ec0020 into main Oct 27, 2023
6 of 7 checks passed
@TharmiganK TharmiganK deleted the add-digits-constraint branch October 27, 2023 08:56
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.

Add support for Constraint on the floating point count
2 participants