Skip to content

Commit dd26ec0

Browse files
committed
Merge branch 'develop' into Null_for_join_2283_2
# Conflicts: # src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/FieldsFromJoinsWithoutIsNullDiagnostic.java # src/test/resources/diagnostics/FieldsFromJoinsWithoutIsNullDiagnostic.bsl
2 parents 8992a58 + faf2f16 commit dd26ec0

30 files changed

+354
-109
lines changed

.github/workflows/codeql-analysis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ jobs:
3737

3838
# Initializes the CodeQL tools for scanning.
3939
- name: Initialize CodeQL
40-
uses: github/codeql-action/init@v1
40+
uses: github/codeql-action/init@v2
4141
# Override language selection by uncommenting this and choosing your languages
4242
with:
4343
languages: java
@@ -52,4 +52,4 @@ jobs:
5252
- run: ./gradlew jar
5353

5454
- name: Perform CodeQL Analysis
55-
uses: github/codeql-action/analyze@v1
55+
uses: github/codeql-action/analyze@v2

.github/workflows/pre-qa.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Pre-QA
2+
3+
on:
4+
push:
5+
branches-ignore:
6+
- "translations_*"
7+
pull_request:
8+
9+
jobs:
10+
gatekeeper:
11+
runs-on: ubuntu-latest
12+
if: github.event_name == 'pull_request' && startsWith(github.head_ref, 'translations_') == false || github.event_name == 'push'
13+
steps:
14+
- run: echo 'Open the Golden Gate'
15+
build:
16+
needs: gatekeeper
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Save PR number to file
20+
if: github.event_name == 'pull_request'
21+
run: echo ${{ github.event.number }} > PR_NUMBER.txt
22+
- name: Archive PR number
23+
if: github.event_name == 'pull_request'
24+
uses: actions/upload-artifact@v3
25+
with:
26+
name: PR_NUMBER
27+
path: PR_NUMBER.txt

.github/workflows/qa.yml

Lines changed: 47 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,66 @@
11
name: QA
22

33
on:
4-
push:
5-
branches: [develop, master]
6-
7-
pull_request:
4+
workflow_run:
5+
workflows: [Pre-QA]
6+
types: [completed]
87

98
jobs:
10-
gatekeeper:
11-
runs-on: ubuntu-latest
12-
if: github.event_name == 'pull_request' && (!startsWith(github.head_ref, 'translations_') == false || github.event.pull_request.user.login != 'dependabot[bot]') || github.event_name == 'push'
13-
steps:
14-
- run: echo 'Open the Golden Gate'
159

1610
QA:
17-
needs: gatekeeper
1811
runs-on: ubuntu-latest
19-
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.event.repository.full_name
12+
if: github.event.workflow_run.conclusion == 'success'
2013
steps:
14+
- name: Download PR number artifact
15+
if: github.event.workflow_run.event == 'pull_request'
16+
uses: dawidd6/action-download-artifact@v2
17+
with:
18+
workflow: ${{ github.event.workflow_run.name }}
19+
run_id: ${{ github.event.workflow_run.id }}
20+
name: PR_NUMBER
21+
- name: Read PR_NUMBER.txt
22+
if: github.event.workflow_run.event == 'pull_request'
23+
id: pr_number
24+
uses: juliangruber/read-file-action@v1
25+
with:
26+
path: ./PR_NUMBER.txt
27+
- name: Request GitHub API for PR data
28+
if: github.event.workflow_run.event == 'pull_request'
29+
uses: octokit/request-action@v2.x
30+
id: get_pr_data
31+
with:
32+
route: GET /repos/{full_name}/pulls/{number}
33+
number: ${{ steps.pr_number.outputs.content }}
34+
full_name: ${{ github.event.repository.full_name }}
35+
env:
36+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2137
- uses: actions/checkout@v3
2238
with:
23-
fetch-depth: ''
24-
- run: |
25-
git fetch --prune --unshallow
39+
repository: ${{ github.event.workflow_run.head_repository.full_name }}
40+
ref: ${{ github.event.workflow_run.head_branch }}
41+
fetch-depth: 0
42+
- name: Checkout base branch
43+
if: github.event.workflow_run.event == 'pull_request'
44+
run: |
45+
git remote add upstream ${{ github.event.repository.clone_url }}
46+
git fetch upstream
47+
git checkout -B ${{ fromJson(steps.get_pr_data.outputs.data).base.ref }} upstream/${{ fromJson(steps.get_pr_data.outputs.data).base.ref }}
48+
git checkout ${{ github.event.workflow_run.head_branch }}
49+
git clean -ffdx && git reset --hard HEAD
2650
- name: Set up JDK 11
2751
uses: actions/setup-java@v3
2852
with:
2953
java-version: 11
3054
distribution: 'temurin'
31-
- name: SonarCloud Scan
32-
run: ./gradlew check sonarqube
55+
- name: SonarCloud Scan on PR
56+
if: github.event.workflow_run.event == 'pull_request'
57+
run: ./gradlew check sonarqube -Dsonar.scm.revision=${{ github.event.workflow_run.head_sha }} -Dsonar.pullrequest.key=${{ fromJson(steps.get_pr_data.outputs.data).number }} -Dsonar.pullrequest.branch=${{ fromJson(steps.get_pr_data.outputs.data).head.ref }} -Dsonar.pullrequest.base=${{ fromJson(steps.get_pr_data.outputs.data).base.ref }}
58+
env:
59+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
60+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
61+
- name: SonarCloud Scan on push
62+
if: github.event.workflow_run.event == 'push' && github.event.workflow_run.head_repository.full_name == github.event.repository.full_name
63+
run: ./gradlew check sonarqube -Dsonar.scm.revision=${{ github.event.workflow_run.head_sha }} -Dsonar.branch.name=${{ github.event.workflow_run.head_branch }}
3364
env:
3465
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
3566
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/qodana.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ jobs:
2020
steps:
2121
- uses: actions/checkout@v3
2222
- name: 'Qodana Scan'
23-
uses: JetBrains/qodana-action@v4.2.5
23+
uses: JetBrains/qodana-action@v5.1.0
2424
with:
2525
linter: jetbrains/qodana-jvm-community
26-
- uses: github/codeql-action/upload-sarif@v1
26+
- uses: github/codeql-action/upload-sarif@v2
2727
with:
2828
sarif_file: ${{ runner.temp }}/qodana/results/qodana.sarif.json
2929
- name: Deploy to GitHub Pages

.github/workflows/rebase.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@ jobs:
1414
token: ${{ secrets.GITHUB_TOKEN }}
1515
fetch-depth: 0 # otherwise, you will fail to push refs to dest repo
1616
- name: Automatic Rebase
17-
uses: cirrus-actions/rebase@1.5
17+
uses: cirrus-actions/rebase@1.6
1818
env:
1919
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ jobs:
9595
name: bsl-language-server_${{ matrix.prefix }}.zip
9696
path: ./${{ matrix.app-image }}
9797
- name: Upload assets to release
98-
uses: AButler/upload-release-assets@v1.0
98+
uses: AButler/upload-release-assets@v2.0
9999
with:
100100
files: './bsl-language-server_${{ matrix.prefix }}.zip'
101101
repo-token: ${{ secrets.GITHUB_TOKEN }}
@@ -104,7 +104,7 @@ jobs:
104104
run: ./gradlew build
105105
- name: Upload jar to release
106106
if: matrix.prefix == 'nix'
107-
uses: AButler/upload-release-assets@v1.0
107+
uses: AButler/upload-release-assets@v2.0
108108
with:
109109
files: './build/libs/*.jar'
110110
repo-token: ${{ secrets.GITHUB_TOKEN }}

build.gradle.kts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@ plugins {
99
signing
1010
id("org.cadixdev.licenser") version "0.6.1"
1111
id("org.sonarqube") version "3.3"
12-
id("io.freefair.lombok") version "6.4.2"
13-
id("io.freefair.javadoc-links") version "6.4.2"
14-
id("io.freefair.javadoc-utf-8") version "6.4.2"
15-
id("io.freefair.aspectj.post-compile-weaving") version "6.4.1"
16-
id("io.freefair.maven-central.validate-poms") version "6.4.2"
17-
id("me.qoomon.git-versioning") version "5.1.5"
12+
id("io.freefair.lombok") version "6.4.3"
13+
id("io.freefair.javadoc-links") version "6.4.3"
14+
id("io.freefair.javadoc-utf-8") version "6.4.3"
15+
id("io.freefair.aspectj.post-compile-weaving") version "6.4.3"
16+
id("io.freefair.maven-central.validate-poms") version "6.4.3"
17+
id("me.qoomon.git-versioning") version "6.1.1"
1818
id("com.github.ben-manes.versions") version "0.42.0"
19-
id("org.springframework.boot") version "2.6.6"
19+
id("org.springframework.boot") version "2.6.7"
2020
id("io.spring.dependency-management") version "1.0.11.RELEASE"
2121
id("io.github.1c-syntax.bslls-dev-tools") version "0.7.0"
2222
id("ru.vyarus.pom") version "2.2.1"
@@ -63,7 +63,7 @@ dependencies {
6363
api("org.eclipse.lsp4j", "org.eclipse.lsp4j", "0.12.0")
6464

6565
// 1c-syntax
66-
api("com.github.1c-syntax", "bsl-parser", "0.20.3") {
66+
api("com.github.1c-syntax", "bsl-parser", "0.21.0") {
6767
exclude("com.tunnelvisionlabs", "antlr4-annotations")
6868
exclude("com.ibm.icu", "*")
6969
exclude("org.antlr", "ST4")

qodana.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
version: "1.0"
22
profile:
33
name: qodana.starter
4+
include:
5+
- name: CheckDependencyLicenses
46
exclude:
57
- name: OptionalUsedAsFieldOrParameterType

src/main/java/com/github/_1c_syntax/bsl/languageserver/cli/FormatCommand.java

Lines changed: 26 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
*/
2222
package com.github._1c_syntax.bsl.languageserver.cli;
2323

24-
import com.github._1c_syntax.bsl.languageserver.context.DocumentContext;
2524
import com.github._1c_syntax.bsl.languageserver.context.ServerContext;
2625
import com.github._1c_syntax.bsl.languageserver.providers.FormatProvider;
2726
import com.github._1c_syntax.utils.Absolute;
@@ -41,10 +40,10 @@
4140
import java.net.URI;
4241
import java.nio.charset.StandardCharsets;
4342
import java.nio.file.Path;
44-
import java.util.Collection;
45-
import java.util.Collections;
43+
import java.util.ArrayList;
4644
import java.util.List;
4745
import java.util.concurrent.Callable;
46+
import java.util.regex.Pattern;
4847

4948
import static picocli.CommandLine.Command;
5049
import static picocli.CommandLine.Option;
@@ -75,6 +74,7 @@
7574
@RequiredArgsConstructor
7675
public class FormatCommand implements Callable<Integer> {
7776

77+
private static final Pattern COMMA_PATTERN = Pattern.compile(",");
7878
private final ServerContext serverContext;
7979
private final FormatProvider formatProvider;
8080

@@ -99,18 +99,12 @@ public class FormatCommand implements Callable<Integer> {
9999
public Integer call() {
100100
serverContext.clear();
101101

102-
Path srcDir = Absolute.path(srcDirOption);
103-
if (!srcDir.toFile().exists()) {
104-
LOGGER.error("Source dir `{}` is not exists", srcDir);
105-
return 1;
106-
}
102+
String[] filePaths = COMMA_PATTERN.split(srcDirOption);
107103

108-
Collection<File> files;
104+
List<File> files = findFilesForFormatting(filePaths);
109105

110-
if(srcDir.toFile().isDirectory()) {
111-
files = FileUtils.listFiles(srcDir.toFile(), new String[]{"bsl", "os"}, true);
112-
} else {
113-
files = Collections.singletonList(srcDir.toFile());
106+
if (files.isEmpty()) {
107+
return 1;
114108
}
115109

116110
if (silentMode) {
@@ -132,6 +126,25 @@ public Integer call() {
132126
return 0;
133127
}
134128

129+
private List<File> findFilesForFormatting(String[] filePaths) {
130+
List<File> files = new ArrayList<>();
131+
for (String filePath : filePaths) {
132+
Path srcDir = Absolute.path(filePath);
133+
if (!srcDir.toFile().exists()) {
134+
LOGGER.error("Source dir `{}` is not exists", srcDir);
135+
continue;
136+
}
137+
138+
if(srcDir.toFile().isDirectory()) {
139+
files.addAll(FileUtils.listFiles(srcDir.toFile(), new String[]{"bsl", "os"}, true));
140+
} else {
141+
files.add(srcDir.toFile());
142+
}
143+
}
144+
145+
return files;
146+
}
147+
135148
@SneakyThrows
136149
private void formatFile(File file) {
137150
String textDocumentContent = FileUtils.readFileToString(file, StandardCharsets.UTF_8);

src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/AbstractSDBLVisitorDiagnostic.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323

2424
import com.github._1c_syntax.bsl.languageserver.context.DocumentContext;
2525
import com.github._1c_syntax.bsl.languageserver.diagnostics.metadata.DiagnosticInfo;
26+
import com.github._1c_syntax.bsl.languageserver.utils.Trees;
27+
import com.github._1c_syntax.bsl.parser.SDBLParser;
2628
import com.github._1c_syntax.bsl.parser.SDBLParserBaseVisitor;
2729
import lombok.Getter;
2830
import lombok.Setter;
@@ -49,4 +51,13 @@ public List<Diagnostic> getDiagnostics(DocumentContext documentContext) {
4951

5052
return diagnosticStorage.getDiagnostics();
5153
}
54+
55+
@Override
56+
public ParseTree visitQueryPackage(SDBLParser.QueryPackageContext ctx) {
57+
if (Trees.treeContainsErrors(ctx)) {
58+
return ctx;
59+
}
60+
return super.visitQueryPackage(ctx);
61+
}
62+
5263
}

0 commit comments

Comments
 (0)