Skip to content

Commit

Permalink
Add PMD and precommit for format and license header checking.
Browse files Browse the repository at this point in the history
Use package goal as project doesn't support earlier lifecycle phases.
  • Loading branch information
tpage-alfresco committed Sep 26, 2024
1 parent abd85fb commit ed3b3e0
Show file tree
Hide file tree
Showing 6 changed files with 653 additions and 0 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,22 @@ env:
GITHUB_ACTIONS_DEPLOY_TIMEOUT: 60

jobs:
pre_commit:
runs-on: ubuntu-latest
outputs:
java_version: ${{ env.JAVA_VERSION }}
java_version_supported_by_repo: ${{ env.JAVA_VERSION_SUPPORTED_BY_REPO }}
steps:
- uses: Alfresco/alfresco-build-tools/.github/actions/[email protected]
- uses: actions/checkout@v4
with:
fetch-depth: 0
- id: changed-files
uses: Alfresco/alfresco-build-tools/.github/actions/[email protected]
with:
write-list-to-env: true
- uses: Alfresco/alfresco-build-tools/.github/actions/[email protected]

veracode_sca:
name: "Veracode - Source Clear Scan (SCA)"
runs-on: ubuntu-latest
Expand Down Expand Up @@ -119,6 +135,21 @@ jobs:
name: Veracode Pipeline-Scan Results (Human Readable)
path: readable_output.zip

pmd_scan:
name: "PMD Scan"
runs-on: ubuntu-latest
if: >
github.event_name == 'pull_request' &&
!contains(github.event.head_commit.message, '[skip pmd]') &&
!contains(github.event.head_commit.message, '[skip tests]')
steps:
- uses: actions/checkout@v4
- uses: Alfresco/alfresco-build-tools/.github/actions/[email protected]
- uses: Alfresco/alfresco-build-tools/.github/actions/[email protected]
- uses: Alfresco/[email protected]
with:
classpath-build-command: "mvn -ntp package -DskipTests"

build_and_test:
name: "Core & Base Snapshot deployment"
runs-on: ubuntu-latest
Expand Down
14 changes: 14 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
repos:
- repo: https://github.com/Yelp/detect-secrets
rev: v1.5.0
hooks:
- id: detect-secrets
args: ["--baseline", ".secrets.baseline"]
- repo: local
hooks:
- id: check-format-and-headers
name: Check format and headers and fix if necessary
entry: ./scripts/check-format-and-headers.sh
language: script
files: ".*.java"
pass_filenames: false
162 changes: 162 additions & 0 deletions .secrets.baseline
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
{
"version": "1.5.0",
"plugins_used": [
{
"name": "ArtifactoryDetector"
},
{
"name": "AWSKeyDetector"
},
{
"name": "AzureStorageKeyDetector"
},
{
"name": "Base64HighEntropyString",
"limit": 4.5
},
{
"name": "BasicAuthDetector"
},
{
"name": "CloudantDetector"
},
{
"name": "DiscordBotTokenDetector"
},
{
"name": "GitHubTokenDetector"
},
{
"name": "GitLabTokenDetector"
},
{
"name": "HexHighEntropyString",
"limit": 3.0
},
{
"name": "IbmCloudIamDetector"
},
{
"name": "IbmCosHmacDetector"
},
{
"name": "IPPublicDetector"
},
{
"name": "JwtTokenDetector"
},
{
"name": "KeywordDetector",
"keyword_exclude": ""
},
{
"name": "MailchimpDetector"
},
{
"name": "NpmDetector"
},
{
"name": "OpenAIDetector"
},
{
"name": "PrivateKeyDetector"
},
{
"name": "PypiTokenDetector"
},
{
"name": "SendGridDetector"
},
{
"name": "SlackDetector"
},
{
"name": "SoftlayerDetector"
},
{
"name": "SquareOAuthDetector"
},
{
"name": "StripeDetector"
},
{
"name": "TelegramBotTokenDetector"
},
{
"name": "TwilioKeyDetector"
}
],
"filters_used": [
{
"path": "detect_secrets.filters.allowlist.is_line_allowlisted"
},
{
"path": "detect_secrets.filters.common.is_baseline_file",
"filename": ".secrets.baseline"
},
{
"path": "detect_secrets.filters.common.is_ignored_due_to_verification_policies",
"min_level": 2
},
{
"path": "detect_secrets.filters.heuristic.is_indirect_reference"
},
{
"path": "detect_secrets.filters.heuristic.is_likely_id_string"
},
{
"path": "detect_secrets.filters.heuristic.is_lock_file"
},
{
"path": "detect_secrets.filters.heuristic.is_not_alphanumeric_string"
},
{
"path": "detect_secrets.filters.heuristic.is_potential_uuid"
},
{
"path": "detect_secrets.filters.heuristic.is_prefixed_with_dollar_sign"
},
{
"path": "detect_secrets.filters.heuristic.is_sequential_string"
},
{
"path": "detect_secrets.filters.heuristic.is_swagger_file"
},
{
"path": "detect_secrets.filters.heuristic.is_templated_secret"
}
],
"results": {
"deprecated/alfresco-transformer-base/src/main/resources/application.yaml": [
{
"type": "Secret Keyword",
"filename": "deprecated/alfresco-transformer-base/src/main/resources/application.yaml",
"hashed_secret": "8c1ab56bc026c89468942df91166c35a277455a7",
"is_verified": false,
"line_number": 10,
"is_secret": false
}
],
"engines/base/src/main/resources/application.yaml": [
{
"type": "Secret Keyword",
"filename": "engines/base/src/main/resources/application.yaml",
"hashed_secret": "8c1ab56bc026c89468942df91166c35a277455a7",
"is_verified": false,
"line_number": 10,
"is_secret": false
}
],
"engines/libreoffice/src/test/resources/quick.vdx": [
{
"type": "Hex High Entropy String",
"filename": "engines/libreoffice/src/test/resources/quick.vdx",
"hashed_secret": "37c332070388a4797ccf1fa64f7029a193ce0371",
"is_verified": false,
"line_number": 2,
"is_secret": false
}
]
},
"generated_at": "2024-09-26T14:01:33Z"
}
Loading

0 comments on commit ed3b3e0

Please sign in to comment.