diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 5cc7ae4c..7169689b 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -13,7 +13,7 @@ jobs: steps: - uses: actions/checkout@v4 - name: Set up JDK ${{ matrix.java_version }} - uses: actions/setup-java@v4.2.1 + uses: actions/setup-java@v4.5.0 with: java-version: ${{ matrix.java_version }} distribution: 'adopt' diff --git a/.github/workflows/night_build.yml b/.github/workflows/night_build.yml index d9b2c58e..8230bfdb 100644 --- a/.github/workflows/night_build.yml +++ b/.github/workflows/night_build.yml @@ -17,7 +17,7 @@ jobs: with: ref: nigth_build - name: Set up JDK - uses: actions/setup-java@v4.2.1 + uses: actions/setup-java@v4.5.0 with: java-version: 17 distribution: 'adopt' @@ -28,7 +28,7 @@ jobs: - name: Save current date run: echo "PLUGIN_CURRENT_DATE=$(date +'%Y%m%d')" >> $GITHUB_ENV - name: Deploy build - uses: WebFreak001/deploy-nightly@v3.1.0 + uses: WebFreak001/deploy-nightly@v3.2.0 with: upload_url: https://uploads.github.com/repos/1c-syntax/sonar-bsl-plugin-community/releases/51033599/assets{?name,label} # find out this value by opening https://api.github.com/repos///releases in your browser and copy the full "upload_url" value including the {?name,label} part release_id: 51033599 # same as above (id can just be taken out the upload_url, it's used to find old releases) diff --git a/.github/workflows/qa.yml b/.github/workflows/qa.yml index cea9fef3..d7c15793 100644 --- a/.github/workflows/qa.yml +++ b/.github/workflows/qa.yml @@ -17,7 +17,7 @@ jobs: - run: | git fetch --prune --unshallow - name: Set up JDK 17 - uses: actions/setup-java@v4.2.1 + uses: actions/setup-java@v4.5.0 with: java-version: 17 distribution: 'adopt' diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6e749527..9098dc7c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -14,7 +14,7 @@ jobs: - name: Checkout source uses: actions/checkout@v4 - name: Set up JDK - uses: actions/setup-java@v4.2.1 + uses: actions/setup-java@v4.5.0 with: java-version: 17 distribution: 'adopt' diff --git a/build.gradle.kts b/build.gradle.kts index dceed79c..48135983 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -5,12 +5,12 @@ plugins { jacoco java `maven-publish` - id("org.sonarqube") version "5.1.0.4882" + id("org.sonarqube") version "6.0.1.5171" id("org.cadixdev.licenser") version "0.6.1" id("com.github.johnrengelman.shadow") version ("7.0.0") id("com.github.ben-manes.versions") version "0.51.0" id("com.github.gradle-git-version-calculator") version "1.1.0" - id("io.freefair.lombok") version "8.6" + id("io.freefair.lombok") version "8.11" } group = "io.github.1c-syntax" diff --git a/src/main/java/com/github/_1c_syntax/bsl/sonar/BSLCoreSensor.java b/src/main/java/com/github/_1c_syntax/bsl/sonar/BSLCoreSensor.java index 7688ab6c..300d2e2b 100644 --- a/src/main/java/com/github/_1c_syntax/bsl/sonar/BSLCoreSensor.java +++ b/src/main/java/com/github/_1c_syntax/bsl/sonar/BSLCoreSensor.java @@ -227,7 +227,7 @@ private void saveCpd(InputFile inputFile, DocumentContext documentContext) { line, charPositionInLine, line, - charPositionInLine + tokenText.length(), + charPositionInLine + (int) tokenText.codePoints().count(), tokenText ); } diff --git a/src/main/java/com/github/_1c_syntax/bsl/sonar/BSLHighlighter.java b/src/main/java/com/github/_1c_syntax/bsl/sonar/BSLHighlighter.java index 01f9b2cd..56377b47 100644 --- a/src/main/java/com/github/_1c_syntax/bsl/sonar/BSLHighlighter.java +++ b/src/main/java/com/github/_1c_syntax/bsl/sonar/BSLHighlighter.java @@ -201,7 +201,7 @@ public void highlightToken( line, charPositionInLine, line, - charPositionInLine + tokenText.length() + charPositionInLine + (int) tokenText.codePoints().count() ); var data = new HighlightingData( diff --git a/src/test/java/com/github/_1c_syntax/bsl/sonar/BSLCoreSensorTest.java b/src/test/java/com/github/_1c_syntax/bsl/sonar/BSLCoreSensorTest.java index dc13037b..542857bc 100644 --- a/src/test/java/com/github/_1c_syntax/bsl/sonar/BSLCoreSensorTest.java +++ b/src/test/java/com/github/_1c_syntax/bsl/sonar/BSLCoreSensorTest.java @@ -205,7 +205,7 @@ void testComplexity() { // todo надо как-то нормально ключ компонента определить var componentKey = "moduleKey:" + FILE_NAME; assertThat(context.measures(componentKey)).isNotEmpty(); - assertThat(context.measure(componentKey, CoreMetrics.COMPLEXITY).value()).isEqualTo(3); + assertThat(context.measure(componentKey, CoreMetrics.COMPLEXITY).value()).isEqualTo(5); assertThat(context.measure(componentKey, CoreMetrics.COGNITIVE_COMPLEXITY).value()).isEqualTo(1); } @@ -225,7 +225,7 @@ void testCPD() { var componentKey = "moduleKey:" + FILE_NAME; assertThat(context.cpdTokens(componentKey)) .isNotNull() - .hasSize(13); + .hasSize(19); assertThat(context.cpdTokens(componentKey)) .filteredOn(tok -> tok.getValue().startsWith("ОставшийсяТокен")) .hasSize(1); diff --git a/src/test/resources/examples/src/test.bsl b/src/test/resources/examples/src/test.bsl index 275bc30d..6f2128ed 100644 --- a/src/test/resources/examples/src/test.bsl +++ b/src/test/resources/examples/src/test.bsl @@ -15,6 +15,14 @@ #КонецВставки КонецПроцедуры +Функция ФункцияКотораяДолжнаНеУпасть() + Возврат "🟡"; +КонецФункции + +Функция ФункцияКотораяНеУпадет() + Возврат "✅"; +КонецФункции + #Область Тест Проверка = Истина;