Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
  • Loading branch information
RahulGautamSingh and viceice authored Apr 24, 2024
1 parent 9b299d5 commit f92d2e0
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
6 changes: 3 additions & 3 deletions lib/modules/versioning/same-major/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,12 @@ describe('modules/versioning/same-major/index', () => {

describe('.isLessThanRange(version, range)', () => {
it('should return true', () => {
expect(sameMajor.isLessThanRange?.('2.0.2', '3.0.0')).toBeTrue();
expect(sameMajor.isLessThanRange('2.0.2', '3.0.0')).toBeTrue();

Check failure on line 49 in lib/modules/versioning/same-major/index.spec.ts

View workflow job for this annotation

GitHub Actions / lint-other

Cannot invoke an object which is possibly 'undefined'.
});

it('should return false', () => {
expect(sameMajor.isLessThanRange?.('4.0.0', '3.0.0')).toBeFalse();
expect(sameMajor.isLessThanRange?.('3.1.0', '3.0.0')).toBeFalse();
expect(sameMajor.isLessThanRange('4.0.0', '3.0.0')).toBeFalse();

Check failure on line 53 in lib/modules/versioning/same-major/index.spec.ts

View workflow job for this annotation

GitHub Actions / lint-other

Cannot invoke an object which is possibly 'undefined'.
expect(sameMajor.isLessThanRange('3.1.0', '3.0.0')).toBeFalse();

Check failure on line 54 in lib/modules/versioning/same-major/index.spec.ts

View workflow job for this annotation

GitHub Actions / lint-other

Cannot invoke an object which is possibly 'undefined'.
});
});
});
2 changes: 1 addition & 1 deletion lib/modules/versioning/same-major/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export const supportsRanges = false;

/**
*
* Converts input to range if it's a version. eg. X.Y.Z -> '>=X.Y.Z <X+1.0.0'
* Converts input to range if it's a version. eg. X.Y.Z -> '>=X.Y.Z <X+1'
* If the input is already a range, it returns the input.
*/
function massageVersion(input: string): string {
Expand Down
10 changes: 6 additions & 4 deletions lib/modules/versioning/same-major/readme.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
Renovate's 'Same Major' versioning is specifically designed to address scenarios where version specifications, denoted as X.Y.Z, signify a range of compatibility from greater than or equal to X.Y.Z to less than X+1.Y.Z. In essence, each individual version is to be treated as a constraint.
Renovate's 'Same Major' versioning is specifically designed to address scenarios where version specifications, denoted as X.Y.Z, signify a range of compatibility from greater than or equal to X.Y.Z to less than X+1.
In essence, each individual version is to be treated as a constraint.

This method is handy when managing dependencies like dotnet-sdk's rollForward settings. Let's say a project uses dotnet-sdk version 3.1.0. It needs to be compatible with any version in the 3.x.x range but not with versions in the next major version, like 4.x.x.
This method is handy when managing dependencies like dotnet-sdk's rollForward settings.
Let's say a project uses dotnet-sdk version 3.1.0.
It needs to be compatible with any version in the 3.x.x range but not with versions in the next major version, like 4.x.x.

This process employs Semver-Coerced versioning beneath the surface, wherein single versions (e.g., `X.Y.Z`) are converted to a range like
`X+1.0.0` and then passed to the corresponding semver-coerced method.
This process employs Semver-Coerced versioning beneath the surface, wherein single versions (e.g., `X.Y.Z`) are converted to a range like `X+1` and then passed to the corresponding semver-coerced method.

0 comments on commit f92d2e0

Please sign in to comment.