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
39 changes: 39 additions & 0 deletions .github/workflows/test-action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Test Action

on:
push:
branches:
- main
pull_request:

jobs:
test-action:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Run RsMetaCheck Action on self
uses: ./
with:
# Automatically uses ${{ github.repository }} and checks it
verbose: "false"
env:
# Provide token for SoMEF API rate limits (optional but recommended)
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Verify outputs are generated
run: |
if [ ! -d "somef_outputs" ]; then
echo "somef_outputs directory not found!"
exit 1
fi
if [ ! -d "pitfalls" ]; then
echo "pitfalls directory not found!"
exit 1
fi
if [ ! -f "all_pitfalls_results.json" ]; then
echo "all_pitfalls_results.json not found!"
exit 1
fi
echo "Output files verified successfully."
34 changes: 33 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,39 @@ pip install git+https://github.com/SoftwareUnderstanding/RsMetaCheck.git

## Usage

### Run the Detection Tool
### GitHub Action

RsMetaCheck can be easily integrated into your CI/CD pipelines as a GitHub Action.

```yaml
name: RsMetaCheck

on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
check-metadata:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Run RsMetaCheck
uses: SoftwareUnderstanding/[email protected] # Update to the latest version tag
with:
# Optional: Include passed checks in output (defaults to false)
verbose: "false"
env:
# Optional: Provide token for SoMEF API rate limits
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
```

The action will generate `all_pitfalls_results.json`, along with the `pitfalls/` and `somef_outputs/` directories directly in your workflow workspace.

### Run the Detection Tool locally

#### Analyze a Single Repository

Expand Down
56 changes: 56 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: "RsMetaCheck"
description: "Detect metadata pitfalls and warnings in software repositories using SoMEF."
author: "SoftwareUnderstanding"
branding:
icon: "check-circle"
color: "blue"

inputs:
repository_url:
description: "URL of the repository to analyze. Defaults to the current GitHub workspace repository."
required: false
default: "https://github.com/${{ github.repository }}"
branch:
description: "Specific branch to analyze."
required: false
input_file:
description: "Path to a JSON file containing a list of repositories to analyze."
required: false
verbose:
description: "Whether to include all tests (even passed ones) in the final JSON-LD output."
required: false
default: "false"

runs:
using: "composite"
steps:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
cache: "pip"

- name: Install RsMetaCheck
shell: bash
run: pip install ${{ github.action_path }}

- name: Run RsMetaCheck
shell: bash
run: |
CMD="rsmetacheck"

if [ -n "${{ inputs.input_file }}" ]; then
CMD="$CMD --input ${{ inputs.input_file }}"
elif [ -n "${{ inputs.repository_url }}" ]; then
CMD="$CMD --input ${{ inputs.repository_url }}"
if [ -n "${{ inputs.branch }}" ]; then
CMD="$CMD --branch ${{ inputs.branch }}"
fi
fi

if [ "${{ inputs.verbose }}" == "true" ]; then
CMD="$CMD --verbose"
fi

echo "Running: $CMD"
eval "$CMD"
36 changes: 26 additions & 10 deletions docs/ground_truth/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
margin-bottom: 30px;
}
.table-container {
max-width: 1200px;
max-width: 95%;
margin: 0 auto;
overflow-x: auto;
box-shadow: 0 4px 6px rgba(0,0,0,0.1);
Expand Down Expand Up @@ -95,7 +95,7 @@ <h1>Ground TruthReport</h1>
<th>Pitfall / Warning Code</th>
<th>Description</th>
<th>Source File</th>
<th>Automated</th>
<th>Commit ID</th>
</tr>
</thead>
</table>
Expand Down Expand Up @@ -126,11 +126,11 @@ <h1>Ground TruthReport</h1>
let isFirstContext = true;

for (const [code, info] of pEntries) {
addRow(tbody, url, code, info, 'p', isFirstContext, totalRows);
addRow(tbody, url, code, info, 'p', isFirstContext, totalRows, repoData);
isFirstContext = false;
}
for (const [code, info] of wEntries) {
addRow(tbody, url, code, info, 'w', isFirstContext, totalRows);
addRow(tbody, url, code, info, 'w', isFirstContext, totalRows, repoData);
isFirstContext = false;
}

Expand All @@ -144,7 +144,7 @@ <h1>Ground TruthReport</h1>
});
});

function addRow(tbody, url, code, info, type, isFirstContext, totalRows) {
function addRow(tbody, url, code, info, type, isFirstContext, totalRows, repoData) {
const tr = document.createElement('tr');

if (isFirstContext) {
Expand Down Expand Up @@ -179,14 +179,30 @@ <h1>Ground TruthReport</h1>
const tdSource = document.createElement('td');
tdSource.textContent = info.source_file || 'Unknown';

// Automated Column
const tdAutomated = document.createElement('td');
tdAutomated.textContent = 'Yes';

tr.appendChild(tdCode);
tr.appendChild(tdDesc);
tr.appendChild(tdSource);
tr.appendChild(tdAutomated);

if (isFirstContext) {
const tdCommit = document.createElement('td');
tdCommit.style.whiteSpace = 'nowrap';
const commitId = repoData['commit ID'];
if (commitId) {
const aCommit = document.createElement('a');
let cleanUrl = url.endsWith('/') ? url.slice(0, -1) : url;
let treePath = cleanUrl.includes('gitlab') ? '/-/tree/' : '/tree/';
aCommit.href = `${cleanUrl}${treePath}${commitId}`;
aCommit.textContent = commitId.substring(0, 7);
aCommit.className = 'repo-link';
aCommit.style.wordBreak = 'normal';
aCommit.target = '_blank';
tdCommit.appendChild(aCommit);
} else {
tdCommit.textContent = 'Unknown';
}
tdCommit.rowSpan = totalRows;
tr.appendChild(tdCommit);
}

tbody.appendChild(tr);
}
Expand Down
Loading
Loading