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

[core] Allow numeric properties in XML to be within an unbounded range #1204

Closed
oowekyala opened this issue Jun 24, 2018 · 0 comments · Fixed by #4380
Closed

[core] Allow numeric properties in XML to be within an unbounded range #1204

oowekyala opened this issue Jun 24, 2018 · 0 comments · Fixed by #4380
Labels
an:enhancement An improvement on existing features / rules
Milestone

Comments

@oowekyala
Copy link
Member

oowekyala commented Jun 24, 2018

Report thresholds for metrics for example usually only have the constraint that they must be positive. It makes no sense to artificially restrict that, and it obliges us to take an arbitrary decision ("is 2000 enough? should I add a zero?"). We could add some methods mustBeAbove and mustBeBelow to the property builders and implement some logic in the NumericPropertyModule to have unbounded intervals.

  • When defining a property programmatically, one can use NumericConstraint.positive()
  • But when defining a property in XML, you always have to provide min and max:
<property name="intProp" type="Integer" value="3" min="1" max="20" description="An IntegerProperty."/>
  • this will always build a range constraint
@oowekyala oowekyala added the an:enhancement An improvement on existing features / rules label Jun 24, 2018
@oowekyala oowekyala mentioned this issue Apr 11, 2022
55 tasks
@adangel adangel added this to the 7.0.0 milestone Jan 11, 2023
@adangel adangel changed the title [core] Allow numeric properties to be within an unbounded range [core] Allow numeric properties in XML to be within an unbounded range Jan 11, 2023
@adangel adangel modified the milestones: 7.0.0, 7.x Jan 23, 2023
@oowekyala oowekyala modified the milestones: 7.x, 7.0.0 Feb 7, 2023
@oowekyala oowekyala linked a pull request Feb 8, 2023 that will close this issue
8 tasks
adangel added a commit to oowekyala/pmd that referenced this issue Aug 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
an:enhancement An improvement on existing features / rules
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants