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
54 changes: 0 additions & 54 deletions .github/workflows/checkerframework.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ on:

permissions:
contents: write
pull-requests: write

jobs:
nullness:
Expand Down Expand Up @@ -66,59 +65,6 @@ jobs:
Download the **checker-framework-report** artifact for the full report.
EOF
- name: Comment on PR
if: always() && github.event_name == 'pull_request' && steps.cf-warnings.outputs.found == 'true'
uses: actions/github-script@v7
with:
script: |
const total = '${{ steps.cf-warnings.outputs.total }}';
const nullness = '${{ steps.cf-warnings.outputs.nullness }}';
const init = '${{ steps.cf-warnings.outputs.init }}';
const body = [
'## Checker Framework Nullness Analysis',
'',
'| Metric | Count |',
'|--------|-------|',
`| **Total warnings** | **${total}** |`,
`| Nullness warnings | ${nullness} |`,
`| Initialization warnings | ${init} |`,
'',
'<details>',
'<summary>What does this mean?</summary>',
'',
'The Checker Framework Nullness Checker verifies that the code is free from',
'null pointer dereferences. Warnings indicate places where a `@Nullable` value',
'may flow into a `@NonNull` context. Download the **checker-framework-report**',
'artifact for the full report.',
'</details>',
].join('\n');
const { data: comments } = await github.rest.issues.listComments({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
});
const existing = comments.find(c =>
c.user.type === 'Bot' && c.body.startsWith('## Checker Framework Nullness Analysis')
);
if (existing) {
await github.rest.issues.updateComment({
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: existing.id,
body: body,
});
} else {
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
body: body,
});
}
- name: Upload report
if: always()
uses: actions/upload-artifact@v4
Expand Down
15 changes: 2 additions & 13 deletions .github/workflows/plugin-UT.yml
Original file line number Diff line number Diff line change
Expand Up @@ -126,11 +126,9 @@ jobs:
const passed = '${{ steps.metrics.outputs.passed }}';
const failures = '${{ steps.metrics.outputs.failures }}';
const errors = '${{ steps.metrics.outputs.errors }}';
const lineCov = '${{ steps.metrics.outputs.line_cov }}';
const branchCov = '${{ steps.metrics.outputs.branch_cov }}';

const body = [
'## Plugin Unit Tests & Coverage',
'## Plugin Unit Tests',
'',
`**${status}** (Java 17)`,
'',
Expand All @@ -140,15 +138,6 @@ jobs:
`| Passed | ${passed} |`,
`| Failures | ${failures} |`,
`| Errors | ${errors} |`,
`| Line Coverage | ${lineCov} |`,
`| Branch Coverage | ${branchCov} |`,
'',
'<details>',
'<summary>Coverage details</summary>',
'',
'Download the **plugin-coverage-report-java17** artifact for the full',
'JaCoCo HTML report with per-class breakdowns.',
'</details>',
].join('\n');

const { data: comments } = await github.rest.issues.listComments({
Expand All @@ -157,7 +146,7 @@ jobs:
issue_number: context.issue.number,
});
const existing = comments.find(c =>
c.user.type === 'Bot' && c.body.startsWith('## Plugin Unit Tests & Coverage')
c.user.type === 'Bot' && c.body.startsWith('## Plugin Unit Tests')
);

if (existing) {
Expand Down
55 changes: 0 additions & 55 deletions .github/workflows/spotbugs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ on:
permissions:
checks: write
contents: write
pull-requests: write

jobs:
spotbugs:
Expand Down Expand Up @@ -68,60 +67,6 @@ jobs:
| Low | ${{ steps.sb-counts.outputs.low }} |
EOF

- name: Comment on PR
if: always() && github.event_name == 'pull_request' && steps.sb-counts.outputs.found == 'true'
uses: actions/github-script@v7
with:
script: |
const total = '${{ steps.sb-counts.outputs.total }}';
const high = '${{ steps.sb-counts.outputs.high }}';
const medium = '${{ steps.sb-counts.outputs.medium }}';
const low = '${{ steps.sb-counts.outputs.low }}';

const body = [
'## SpotBugs Analysis',
'',
'| Priority | Count |',
'|----------|-------|',
`| **Total** | **${total}** |`,
`| High | ${high} |`,
`| Medium | ${medium} |`,
`| Low | ${low} |`,
'',
'<details>',
'<summary>What does this mean?</summary>',
'',
'SpotBugs performs static analysis on Java bytecode to find potential bugs.',
'High-priority findings are most likely to be real defects. Download the',
'**spotbugs-report** artifact for the detailed HTML report.',
'</details>',
].join('\n');

const { data: comments } = await github.rest.issues.listComments({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
});
const existing = comments.find(c =>
c.user.type === 'Bot' && c.body.startsWith('## SpotBugs Analysis')
);

if (existing) {
await github.rest.issues.updateComment({
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: existing.id,
body: body,
});
} else {
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
body: body,
});
}

- name: Upload SpotBugs report
if: always()
uses: actions/upload-artifact@v4
Expand Down
15 changes: 2 additions & 13 deletions .github/workflows/vstar-UT.yml
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,9 @@ jobs:
const passed = '${{ steps.metrics.outputs.passed }}';
const failures = '${{ steps.metrics.outputs.failures }}';
const errors = '${{ steps.metrics.outputs.errors }}';
const lineCov = '${{ steps.metrics.outputs.line_cov }}';
const branchCov = '${{ steps.metrics.outputs.branch_cov }}';

const body = [
'## VStar Unit Tests & Coverage',
'## VStar Unit Tests',
'',
`**${status}** (Java 17)`,
'',
Expand All @@ -137,15 +135,6 @@ jobs:
`| Passed | ${passed} |`,
`| Failures | ${failures} |`,
`| Errors | ${errors} |`,
`| Line Coverage | ${lineCov} |`,
`| Branch Coverage | ${branchCov} |`,
'',
'<details>',
'<summary>Coverage details</summary>',
'',
'Download the **coverage-report-java17** artifact for the full',
'JaCoCo HTML report with per-package and per-class breakdowns.',
'</details>',
].join('\n');

const { data: comments } = await github.rest.issues.listComments({
Expand All @@ -154,7 +143,7 @@ jobs:
issue_number: context.issue.number,
});
const existing = comments.find(c =>
c.user.type === 'Bot' && c.body.startsWith('## VStar Unit Tests & Coverage')
c.user.type === 'Bot' && c.body.startsWith('## VStar Unit Tests')
);

if (existing) {
Expand Down
18 changes: 17 additions & 1 deletion src/org/aavso/tools/vstar/ui/vela/VeLaDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@

public VeLaDialog(String title, String code) {
this(title);
VeLaDialog.code = code;

Check warning on line 97 in src/org/aavso/tools/vstar/ui/vela/VeLaDialog.java

View workflow job for this annotation

GitHub Actions / SpotBugs

ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD

Write to static field org.aavso.tools.vstar.ui.vela.VeLaDialog.code from instance method new org.aavso.tools.vstar.ui.vela.VeLaDialog(String, String)
Raw output
This instance method writes to a static field. This is tricky to get correct if multiple instances are being manipulated, and generally bad practice.
codeTextArea.setValue(code);
}

Expand Down Expand Up @@ -178,10 +178,26 @@

@Override
protected void okAction() {
VeLaDialog.code = VeLaDialog.codeTextArea.getValue();
super.okAction();
}

/**
* Retain VeLa source across dialog invocations whenever the window is closed
* (OK, Cancel, or window close), not only when the dismiss button runs
* {@link #okAction()}.
*/
@Override
public void dispose() {
persistCodeFromEditor();
super.dispose();
}

private static void persistCodeFromEditor() {
if (codeTextArea != null) {
code = codeTextArea.getValue();
}
}

private static void addKeyListener() {
JTextArea area = (JTextArea) (codeTextArea.getUIComponent());
area.addKeyListener(new KeyAdapter() {
Expand All @@ -193,35 +209,35 @@
String newCh = null;

if (escapeMode) {
switch (ch) {
case 'b':
case 'B':
// Boolean set
newCh = "\uD835\uDD39";
break;
case 'l':
case 'L':
// lambda
newCh = "\u03BB";
break;
case 'p':
case 'P':
// pi
newCh = "\u03C0";
break;
case 'r':
case 'R':
// real number set
newCh = "\u211D";
break;
case 'z':
case 'Z':
// integer number set
newCh = "\u2124";
break;
case '\\':
// backslash
newCh = "\\";

Check warning on line 240 in src/org/aavso/tools/vstar/ui/vela/VeLaDialog.java

View workflow job for this annotation

GitHub Actions / SpotBugs

SF_SWITCH_NO_DEFAULT

Switch statement found in org.aavso.tools.vstar.ui.vela.VeLaDialog$1.keyTyped(KeyEvent) where default case is missing
Raw output
This method contains a switch statement where default case is missing. Usually you need to provide a default case.

Because the analysis only looks at the generated bytecode, this warning can be incorrect triggered if the default case is at the end of the switch statement and the switch statement doesn't contain break statements for other cases.
break;
}

Expand Down Expand Up @@ -251,7 +267,7 @@

// Capture standard output and error
ByteArrayOutputStream outStream = new ByteArrayOutputStream();
System.setOut(new PrintStream(outStream));

Check warning on line 270 in src/org/aavso/tools/vstar/ui/vela/VeLaDialog.java

View workflow job for this annotation

GitHub Actions / SpotBugs

DM_DEFAULT_ENCODING

Found reliance on default encoding in org.aavso.tools.vstar.ui.vela.VeLaDialog.execute(): new java.io.PrintStream(OutputStream)
Raw output
Found a call to a method which will perform a byte to String (or String to byte) conversion, and will assume that the default platform encoding is suitable. This will cause the application behavior to vary between platforms. Use an alternative API and specify a charset name or Charset object explicitly.

ByteArrayOutputStream errStream = new ByteArrayOutputStream();
System.setErr(new PrintStream(errStream));
Expand Down Expand Up @@ -293,7 +309,7 @@
error = "Error";
}

if (msg != null && !msg.equals(errStream.toString())) {

Check warning on line 312 in src/org/aavso/tools/vstar/ui/vela/VeLaDialog.java

View workflow job for this annotation

GitHub Actions / SpotBugs

DM_DEFAULT_ENCODING

Found reliance on default encoding in org.aavso.tools.vstar.ui.vela.VeLaDialog.execute(): java.io.ByteArrayOutputStream.toString()
Raw output
Found a call to a method which will perform a byte to String (or String to byte) conversion, and will assume that the default platform encoding is suitable. This will cause the application behavior to vary between platforms. Use an alternative API and specify a charset name or Charset object explicitly.
// Any standard error to show in relation to this exception?
// Don't repeat msg.
error += showOutput(errStream);
Expand Down Expand Up @@ -335,7 +351,7 @@
String str = "";

if (stream.size() != 0) {
str = stream.toString() + "\n";

Check warning on line 354 in src/org/aavso/tools/vstar/ui/vela/VeLaDialog.java

View workflow job for this annotation

GitHub Actions / SpotBugs

DM_DEFAULT_ENCODING

Found reliance on default encoding in org.aavso.tools.vstar.ui.vela.VeLaDialog.showOutput(ByteArrayOutputStream): java.io.ByteArrayOutputStream.toString()
Raw output
Found a call to a method which will perform a byte to String (or String to byte) conversion, and will assume that the default platform encoding is suitable. This will cause the application behavior to vary between platforms. Use an alternative API and specify a charset name or Charset object explicitly.
}

return str;
Expand Down
Loading