-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #16 from Xenowa/platform-plugin-integration
Add support for loading and reporting analysis issues to platform plugins
- Loading branch information
Showing
138 changed files
with
1,342 additions
and
782 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,7 +35,7 @@ jobs: | |
env: | ||
packageUser: ${{ github.actor }} | ||
packagePAT: ${{ secrets.GITHUB_TOKEN }} | ||
run: ./gradlew build | ||
run: ./gradlew build --scan | ||
|
||
- name: Generate Jacoco report | ||
run: ./gradlew createCodeCoverageReport | ||
|
@@ -66,10 +66,10 @@ jobs: | |
- name: Set Up Ballerina | ||
uses: ballerina-platform/[email protected] | ||
with: | ||
version: '2201.9.1' | ||
version: '2201.10.0' | ||
|
||
- name: Build with Gradle | ||
env: | ||
packageUser: ${{ github.actor }} | ||
packagePAT: ${{ secrets.GITHUB_TOKEN }} | ||
run: ./gradlew build | ||
run: ./gradlew build --scan |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
scan-command/src/main/java/io/ballerina/scan/PlatformPluginContext.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/* | ||
* Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com). | ||
* | ||
* WSO2 LLC. licenses this file to you under the Apache License, | ||
* Version 2.0 (the "License"); you may not use this file except | ||
* in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
package io.ballerina.scan; | ||
|
||
import java.util.Map; | ||
|
||
/** | ||
* {@code PlatformPluginContext} represents a context passed from the scan tool to the platform plugins. | ||
* | ||
* @since 0.1.0 | ||
*/ | ||
public interface PlatformPluginContext { | ||
|
||
/** | ||
* <p> | ||
* Returns the platform specific arguments that are defined in addition to the 'name' and 'path' arguments in the | ||
* Scan.toml file as a map. These arguments can be used for modifying the behavior of the specific platform plugin. | ||
*</p> | ||
* | ||
* @return in-memory representation of the additional platform specific arguments defined in the Scan.toml file. | ||
*/ | ||
Map<String, String> platformArgs(); | ||
|
||
/** | ||
* Returns whether the analysis is initiated by the platform. | ||
* | ||
* @return true if the analysis is initiated by the platform, false otherwise. | ||
*/ | ||
boolean initiatedByPlatform(); | ||
} |
49 changes: 49 additions & 0 deletions
49
scan-command/src/main/java/io/ballerina/scan/StaticCodeAnalysisPlatformPlugin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/* | ||
* Copyright (c) 2024, WSO2 LLC. (http://www.wso2.org) All Rights Reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
*/ | ||
|
||
package io.ballerina.scan; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* {@code StaticCodeAnalysisPlatformPlugin} Represents the interface to extend to report issues for a specific platform. | ||
* | ||
* @since 0.1.0 | ||
*/ | ||
public interface StaticCodeAnalysisPlatformPlugin { | ||
|
||
/** | ||
* Returns the platform name. | ||
* | ||
* @return platform name | ||
*/ | ||
String platform(); | ||
|
||
/** | ||
* Initializes the platform plugin with a {@link PlatformPluginContext}. | ||
* | ||
* @param platformPluginContext context passed from the scan tool to the platform plugins. | ||
*/ | ||
void init(PlatformPluginContext platformPluginContext); | ||
|
||
/** | ||
* The method that gets invoked when the scan is complete. | ||
* | ||
* @param issues list of issues passed from the scan tool. | ||
*/ | ||
void onScan(List<Issue> issues); | ||
} |
39 changes: 39 additions & 0 deletions
39
scan-command/src/main/java/io/ballerina/scan/internal/PlatformPluginContextImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* | ||
* Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com). | ||
* | ||
* WSO2 LLC. licenses this file to you under the Apache License, | ||
* Version 2.0 (the "License"); you may not use this file except | ||
* in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
package io.ballerina.scan.internal; | ||
|
||
import io.ballerina.scan.PlatformPluginContext; | ||
|
||
import java.util.Collections; | ||
import java.util.Map; | ||
|
||
/** | ||
* Represents the implementation of the {@link PlatformPluginContext} interface. | ||
* | ||
* @param platformArgs in-memory representation of platform specific arguments defined in the Scan.toml file | ||
* @param initiatedByPlatform true if the plugin is initiated by the platform, false otherwise | ||
* | ||
* @since 0.1.0 | ||
*/ | ||
public record PlatformPluginContextImpl(Map<String, String> platformArgs, boolean initiatedByPlatform) implements | ||
PlatformPluginContext { | ||
public PlatformPluginContextImpl { | ||
platformArgs = Collections.unmodifiableMap(platformArgs); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.