Skip to content

Commit 770ac84

Browse files
AnakinPtHugo Dias
and
Hugo Dias
authored
Fixes Sonar and update Readme [patch] (#1)
* Fix Sonar issues. Fir README * Fix Sonar issues. Fir README Co-authored-by: Hugo Dias <[email protected]>
1 parent 9e1ba9f commit 770ac84

File tree

3 files changed

+29
-4
lines changed

3 files changed

+29
-4
lines changed

README.md

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Gradle Git Versioner
2-
[![Plugin Portal](https://img.shields.io/maven-metadata/v?label=plugin%20portal&logo=gradle&metadataUrl=https%3A%2F%2Fplugins.gradle.org%2Fplugin%2Fpt.com.hugo-dias.git-versioner%2Fmaven-metadata.xml&style=for-the-badge)](https://img.shields.io/gradle-plugin-portal/v/pt.com.hugo-dias.git-versioner)
2+
[![Plugin Portal](https://img.shields.io/gradle-plugin-portal/v/pt.com.hugo-dias.git-versioner?logo=gradle&style=for-the-badge)](https://plugins.gradle.org/plugin/pt.com.hugo-dias.git-versioner)
33
[![Release Date](https://img.shields.io/github/release-date/AnakinPt/git-versioner?logo=gradle&style=for-the-badge)](https://plugins.gradle.org/plugin/pt.com.hugo-dias.git-versioner)
44
[![Build Status](https://img.shields.io/github/workflow/status/AnakinPt/git-versioner/Build?logo=github&style=for-the-badge)](https://github.com/AnakinPt/git-versioner/actions?query=workflow%3Abuild)
55

@@ -23,7 +23,7 @@ It's customisable too- you can decide what to look for to decide whether somethi
2323
## How do I migrate to using Git Versioner?
2424
That's really simple too.
2525

26-
1. Find us on the [Gradle Plugin Portal](https://plugins.gradle.org/plugin/pt.com.hugodias.git-versioner).
26+
1. Find us on the [Gradle Plugin Portal](https://plugins.gradle.org/plugin/pt.com.hugo-dias.git-versioner).
2727

2828
2. Apply the plugin using your preferred syntax.
2929

@@ -270,6 +270,30 @@ task version2() {
270270
}
271271
```
272272

273+
## I use kotlin to configure gradle, how can I use this plugin?
274+
If you use the build.gradle.kts file, there's a small change in the configuration of the plugin. You should use this format, instead:
275+
```kotlin
276+
versioner {
277+
startFrom {
278+
major.set(1)
279+
minor.set(1)
280+
patch.set(1)
281+
}
282+
match {
283+
major.set("trex")
284+
minor.set("stego")
285+
patch.set("compy")
286+
}
287+
tag {
288+
prefix.set("x")
289+
}
290+
pattern {
291+
pattern.set("%M.%m.%p(-%c)")
292+
}
293+
}
294+
295+
```
296+
273297
## This is so cool, how do I contribute?
274298
I know right? You should check out the [contribution guide](CONTRIBUTING.md).
275299

src/main/java/pt/com/hugodias/gradle/gitversioner/tasks/PrintVersionTask.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ public abstract class PrintVersionTask extends DefaultTask {
1111
public abstract Property<String> getVersion();
1212

1313
@TaskAction
14+
@SuppressWarnings("java:S106")
1415
public void printVersion() {
1516
System.out.println(getVersion().get());
1617
}

src/test/java/pt/com/hugodias/gradle/gitversioner/version/VersionTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,13 @@ class VersionTest {
4444
"%M.%m.%p(-SNAPSHOT),1.2.3-SNAPSHOT"
4545
})
4646
@DisplayName("prints version correctly according to pattern")
47-
public void testWithCommit(String pattern, String expected) {
47+
void testWithCommit(String pattern, String expected) {
4848
assertThat(versionWithCommit.print(pattern)).isEqualTo(expected);
4949
}
5050

5151
@ParameterizedTest(name = "{index} pattern {0} prints the version correctly")
5252
@CsvSource(value = {"%M.%m.%p(-%b),1.2.3", "%M.%m.%p(-SNAPSHOT),1.2.3"})
53-
public void testWithoutCommit(String pattern, String expected) {
53+
void testWithoutCommit(String pattern, String expected) {
5454
assertThat(versionWithoutCommit.print(pattern)).isEqualTo(expected);
5555
}
5656
}

0 commit comments

Comments
 (0)