Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 21 additions & 3 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,26 @@ jobs:
- name: Build with Gradle
run: ./gradlew check --stacktrace
- name: Archive test results
if: failure()
if: always()
uses: actions/upload-artifact@v5
with:
name: junit_report_${{ matrix.os }}_${{ matrix.java_version }}
path: build/reports/tests/test
name: Test Results (Java ${{ matrix.java_version }}.${{ matrix.os }})
path: "**/test-results/test/**/*.xml"
publish-test-results:
needs: [gatekeeper, check-pr-exists, build]
runs-on: ubuntu-latest
permissions:
checks: write
pull-requests: write
contents: read
issues: read
if: always()
steps:
- name: Download Artifacts
uses: actions/download-artifact@v6
with:
path: artifacts
- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action@v2
with:
junit_files: "artifacts/**/*.xml"
Comment on lines +56 to +73
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Replace deprecated junit_files input with files.

The new publish-test-results job is well-structured with proper permissions and dependencies. However, the action uses a deprecated input parameter.

Apply this diff to use the current action API:

      - name: Publish Test Results
        uses: EnricoMi/publish-unit-test-result-action@v2
        with:
-         junit_files: "artifacts/**/*.xml"
+         files: "artifacts/**/*.xml"

This aligns with the latest EnricoMi/publish-unit-test-result-action@v2 API and avoids potential breaking changes in future versions.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
publish-test-results:
needs: [gatekeeper, check-pr-exists, build]
runs-on: ubuntu-latest
permissions:
checks: write
pull-requests: write
contents: read
issues: read
if: always()
steps:
- name: Download Artifacts
uses: actions/download-artifact@v6
with:
path: artifacts
- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action@v2
with:
junit_files: "artifacts/**/*.xml"
publish-test-results:
needs: [gatekeeper, check-pr-exists, build]
runs-on: ubuntu-latest
permissions:
checks: write
pull-requests: write
contents: read
issues: read
if: always()
steps:
- name: Download Artifacts
uses: actions/download-artifact@v6
with:
path: artifacts
- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action@v2
with:
files: "artifacts/**/*.xml"
🧰 Tools
🪛 actionlint (1.7.9)

73-73: avoid using deprecated input "junit_files" in action "EnricoMi/publish-unit-test-result-action@v2": Use "files" option instead

(action)

🤖 Prompt for AI Agents
.github/workflows/gradle.yml around lines 56 to 73: the
publish-unit-test-result-action usage still uses the deprecated input parameter
`junit_files`; update the action call to replace `junit_files:
"artifacts/**/*.xml"` with the current `files: "artifacts/**/*.xml"` input
(preserve the same glob pattern), and verify the action version remains @v2 so
no other input changes are required.

2 changes: 2 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -453,6 +453,8 @@ tasks.withType<GenerateModuleMetadata> {
}

tasks.register("updateLicenses") {
description = "Wrapper for licenseFormat"
group = "license"
dependsOn(tasks.licenseFormat)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
import org.eclipse.lsp4j.services.LanguageServer;
import org.eclipse.lsp4j.services.TextDocumentService;
import org.eclipse.lsp4j.services.WorkspaceService;
import org.jspecify.annotations.Nullable;
import org.springframework.stereotype.Component;

import java.io.File;
Expand Down Expand Up @@ -106,7 +107,7 @@ public class BSLLanguageServer implements LanguageServer, ProtocolExtension {
public CompletableFuture<InitializeResult> initialize(InitializeParams params) {

clientCapabilitiesHolder.setCapabilities(params.getCapabilities());

setConfigurationRoot(params);

var capabilities = new ServerCapabilities();
Expand Down Expand Up @@ -142,7 +143,7 @@ private void setConfigurationRoot(InitializeParams params) {
return;
}

String rootUri = workspaceFolders.get(0).getUri();
var rootUri = workspaceFolders.get(0).getUri();
Path rootPath;
try {
rootPath = new File(new URI(rootUri).getPath()).getCanonicalFile().toPath();
Expand All @@ -151,7 +152,7 @@ private void setConfigurationRoot(InitializeParams params) {
return;
}

Path configurationRoot = LanguageServerConfiguration.getCustomConfigurationRoot(
var configurationRoot = LanguageServerConfiguration.getCustomConfigurationRoot(
configuration,
rootPath);
context.setConfigurationRoot(configurationRoot);
Expand All @@ -163,7 +164,7 @@ public void initialized(InitializedParams params) {
var executorService = new ForkJoinPool(ForkJoinPool.getCommonPoolParallelism(), factory, null, true);
CompletableFuture
.runAsync(context::populateContext, executorService)
.whenComplete((unused, throwable) -> {
.whenComplete((Void unused, @Nullable Throwable throwable) -> {
executorService.shutdown();
if (throwable != null) {
LOGGER.error("Error populating context", throwable);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,10 @@
import org.eclipse.lsp4j.ReferenceParams;
import org.eclipse.lsp4j.RelatedFullDocumentDiagnosticReport;
import org.eclipse.lsp4j.RenameParams;
import org.eclipse.lsp4j.SemanticTokens;
import org.eclipse.lsp4j.SemanticTokensParams;
import org.eclipse.lsp4j.SelectionRange;
import org.eclipse.lsp4j.SelectionRangeParams;
import org.eclipse.lsp4j.SemanticTokens;
import org.eclipse.lsp4j.SemanticTokensParams;
import org.eclipse.lsp4j.SymbolInformation;
import org.eclipse.lsp4j.TextDocumentClientCapabilities;
import org.eclipse.lsp4j.TextDocumentContentChangeEvent;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import lombok.ToString;
import org.eclipse.lsp4j.ClientCapabilities;
import org.eclipse.lsp4j.InitializeParams;
import org.jspecify.annotations.Nullable;
import org.springframework.stereotype.Component;

import java.util.Optional;
Expand All @@ -46,7 +47,7 @@ public class ClientCapabilitiesHolder {
* Возможности клиента.
*/
@Setter
private ClientCapabilities capabilities;
private @Nullable ClientCapabilities capabilities;

/**
* Получить возможности клиента, если было произведено подключение клиента к серверу.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@
*/
package com.github._1c_syntax.bsl.languageserver;

import org.jspecify.annotations.Nullable;
import lombok.NoArgsConstructor;
import org.eclipse.lsp4j.services.LanguageClient;
import org.eclipse.lsp4j.services.LanguageClientAware;
import org.jspecify.annotations.Nullable;
import org.springframework.stereotype.Component;

import java.util.Optional;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import org.aspectj.lang.annotation.Aspect;
import org.eclipse.lsp4j.InitializeParams;
import org.eclipse.lsp4j.services.LanguageServer;
import org.jspecify.annotations.Nullable;
import org.springframework.context.ApplicationEvent;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.context.ApplicationEventPublisherAware;
Expand All @@ -57,6 +58,7 @@
public class EventPublisherAspect implements ApplicationEventPublisherAware {

private boolean active;
@SuppressWarnings("NullAway.Init")

Check warning on line 61 in src/main/java/com/github/_1c_syntax/bsl/languageserver/aop/EventPublisherAspect.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Suppressing warnings is not allowed

See more on https://sonarcloud.io/project/issues?id=1c-syntax_bsl-language-server&issues=AZsRGsgyNjNj9hSO1CaA&open=AZsRGsgyNjNj9hSO1CaA&pullRequest=3657
private ApplicationEventPublisher applicationEventPublisher;

@PreDestroy
Expand Down Expand Up @@ -100,7 +102,7 @@
}

private void publishEvent(ApplicationEvent event) {
if (!active) {
if (!active || applicationEventPublisher == null) {
LOGGER.warn("Trying to send event in not active event publisher.");
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.jspecify.annotations.Nullable;
import org.springframework.beans.factory.annotation.Autowired;

import java.io.File;
Expand All @@ -50,7 +51,7 @@
public class MeasuresAspect {

@Setter(onMethod = @__({@Autowired}))
private MeasureCollector measureCollector;
private @Nullable MeasureCollector measureCollector;

@PreDestroy
void destroy() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@

import com.github._1c_syntax.bsl.languageserver.LanguageClientHolder;
import com.github._1c_syntax.bsl.languageserver.utils.Resources;
import org.jspecify.annotations.Nullable;
import io.sentry.Sentry;
import io.sentry.protocol.SentryId;
import jakarta.annotation.PostConstruct;
Expand All @@ -34,6 +33,7 @@
import org.aspectj.lang.annotation.Aspect;
import org.eclipse.lsp4j.MessageParams;
import org.eclipse.lsp4j.MessageType;
import org.jspecify.annotations.Nullable;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.concurrent.CustomizableThreadFactory;

Expand Down Expand Up @@ -82,19 +82,21 @@ public void logThrowingLSPCall(Throwable ex) {

private void logException(Throwable ex) {
CompletableFuture.runAsync(() -> {
SentryId sentryId = Sentry.captureException(ex);
if (sentryId.equals(SentryId.EMPTY_ID)) {
return;
}
if (languageClientHolder == null) {
return;
}
var messageType = MessageType.Info;
var message = resources.getResourceString(getClass(), "logMessage", sentryId);
var messageParams = new MessageParams(messageType, message);
var sentryId = Sentry.captureException(ex);
if (sentryId.equals(SentryId.EMPTY_ID)) {
return;
}

if (languageClientHolder == null) {
return;
}
var messageType = MessageType.Info;
var message = resources.getResourceString(getClass(), "logMessage", sentryId);
var messageParams = new MessageParams(messageType, message);

languageClientHolder.execIfConnected(languageClient -> languageClient.showMessage(messageParams));
}, executorService);
languageClientHolder.execIfConnected(languageClient -> languageClient.showMessage(messageParams));
},
executorService);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,17 @@
import com.github._1c_syntax.bsl.languageserver.configuration.LanguageServerConfiguration;
import com.github._1c_syntax.bsl.languageserver.configuration.SendErrorsMode;
import com.github._1c_syntax.bsl.languageserver.utils.Resources;
import org.jspecify.annotations.Nullable;
import io.sentry.Hint;
import io.sentry.SentryEvent;
import io.sentry.SentryOptions.BeforeSendCallback;
import lombok.NonNull;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.eclipse.lsp4j.MessageActionItem;
import org.eclipse.lsp4j.MessageType;
import org.eclipse.lsp4j.ServerInfo;
import org.eclipse.lsp4j.ShowMessageRequestParams;
import org.eclipse.lsp4j.services.LanguageClient;
import org.jspecify.annotations.Nullable;
import org.springframework.stereotype.Component;

import java.util.LinkedHashMap;
Expand Down Expand Up @@ -71,7 +70,7 @@ public class PermissionFilterBeforeSendCallback implements BeforeSendCallback {
private final AtomicBoolean questionWasSend = new AtomicBoolean(false);

@Override
public SentryEvent execute(@NonNull SentryEvent event, @NonNull Hint hint) {
public @Nullable SentryEvent execute(SentryEvent event, Hint hint) {
if (sendToSentry()) {
return event;
}
Expand Down Expand Up @@ -132,8 +131,7 @@ private CompletableFuture<MessageActionItem> askUserForPermission(LanguageClient
return languageClient.showMessageRequest(requestParams);
}

@Nullable
private MessageActionItem waitForPermission(CompletableFuture<MessageActionItem> sendQuestion) {
@Nullable private MessageActionItem waitForPermission(CompletableFuture<MessageActionItem> sendQuestion) {
try {
return sendQuestion.get();
} catch (InterruptedException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
import org.antlr.v4.runtime.tree.ParseTree;
import org.jspecify.annotations.NullUnmarked;

import java.util.ArrayList;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Deque;
import java.util.HashMap;
import java.util.Map;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
public class ControlFlowGraph extends DefaultDirectedGraph<CfgVertex, CfgEdge> {

@Setter
@SuppressWarnings("NullAway.Init")

Check warning on line 32 in src/main/java/com/github/_1c_syntax/bsl/languageserver/cfg/ControlFlowGraph.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Suppressing warnings is not allowed

See more on https://sonarcloud.io/project/issues?id=1c-syntax_bsl-language-server&issues=AZsRGsfJNjNj9hSO1CZ_&open=AZsRGsfJNjNj9hSO1CZ_&pullRequest=3657
private CfgVertex entryPoint;

private final ExitVertex exitPoint;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import lombok.Getter;
import lombok.RequiredArgsConstructor;

import java.util.Objects;
import java.util.Set;

@RequiredArgsConstructor
Expand All @@ -34,7 +35,7 @@ public class ControlFlowGraphWalker {
private CfgVertex currentNode;

public void start() {
currentNode = graph.getEntryPoint();
currentNode = Objects.requireNonNull(graph.getEntryPoint());
}

public Set<CfgEdge> availableRoutes() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
package com.github._1c_syntax.bsl.languageserver.cli.lsp;

import com.github._1c_syntax.bsl.languageserver.configuration.events.LanguageServerConfigurationChangedEvent;
import org.jspecify.annotations.Nullable;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.jspecify.annotations.Nullable;
import org.springframework.context.event.EventListener;
import org.springframework.stereotype.Component;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@
import com.github._1c_syntax.bsl.languageserver.context.FileType;
import com.github._1c_syntax.bsl.languageserver.events.LanguageServerInitializeRequestReceivedEvent;
import com.github._1c_syntax.utils.Absolute;
import org.jspecify.annotations.Nullable;
import lombok.RequiredArgsConstructor;
import org.eclipse.lsp4j.ClientInfo;
import org.eclipse.lsp4j.InitializeParams;
import org.jspecify.annotations.Nullable;
import org.springframework.cache.annotation.CacheConfig;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
import com.github._1c_syntax.bsl.languageserver.configuration.inlayhints.InlayHintOptions;
import com.github._1c_syntax.bsl.languageserver.configuration.references.ReferencesOptions;
import com.github._1c_syntax.utils.Absolute;
import org.jspecify.annotations.Nullable;
import jakarta.annotation.PostConstruct;
import lombok.AccessLevel;
import lombok.AllArgsConstructor;
Expand All @@ -45,6 +44,7 @@
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.beanutils.PropertyUtils;
import org.jspecify.annotations.Nullable;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.context.annotation.Role;
Expand Down Expand Up @@ -163,9 +163,9 @@ public void reset() {
*
* @param configuration Конфигурация language server
* @param srcDir Директория исходных файлов
* @return Корневой каталог для анализа
* @return Корневой каталог для анализа, или {@code null} если конфигурация находится вне srcDir
*/
public static Path getCustomConfigurationRoot(LanguageServerConfiguration configuration, Path srcDir) {
public static @Nullable Path getCustomConfigurationRoot(LanguageServerConfiguration configuration, Path srcDir) {

Path rootPath = null;
var pathFromConfiguration = configuration.getConfigurationRoot();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@
@NullMarked
package com.github._1c_syntax.bsl.languageserver.configuration.capabilities;

import org.jspecify.annotations.NullMarked;
import org.jspecify.annotations.NullMarked;
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@
@NullMarked
package com.github._1c_syntax.bsl.languageserver.configuration.codelens;

import org.jspecify.annotations.NullMarked;
import org.jspecify.annotations.NullMarked;
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@
import com.github._1c_syntax.bsl.languageserver.configuration.databind.DiagnosticMetadataMapDeserializer;
import com.github._1c_syntax.bsl.languageserver.configuration.databind.ParametersDeserializer;
import com.github._1c_syntax.bsl.languageserver.diagnostics.metadata.DiagnosticMetadata;
import org.eclipse.lsp4j.DiagnosticSeverity;
import org.jspecify.annotations.Nullable;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.eclipse.lsp4j.DiagnosticSeverity;
import org.eclipse.lsp4j.jsonrpc.messages.Either;
import org.jspecify.annotations.Nullable;

import java.util.HashMap;
import java.util.Map;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@
@NullMarked
package com.github._1c_syntax.bsl.languageserver.configuration.diagnostics;

import org.jspecify.annotations.NullMarked;
import org.jspecify.annotations.NullMarked;
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@
@NullMarked
package com.github._1c_syntax.bsl.languageserver.configuration.documentlink;

import org.jspecify.annotations.NullMarked;
import org.jspecify.annotations.NullMarked;
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@
@NullMarked
package com.github._1c_syntax.bsl.languageserver.configuration.formating;

import org.jspecify.annotations.NullMarked;
import org.jspecify.annotations.NullMarked;
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@
@NullMarked
package com.github._1c_syntax.bsl.languageserver.configuration;

import org.jspecify.annotations.NullMarked;
import org.jspecify.annotations.NullMarked;
Loading
Loading