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
44 changes: 44 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: "CodeQL"

on:
push:
branches: [ "main", "develop" ]
pull_request:
branches: [ "main", "develop" ]
schedule:
- cron: '0 0 * * 0'

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: [ 'python' ]

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
config: |
name: Default setup
queries:
- uses: security-and-quality

- name: Autobuild
uses: github/codeql-action/autobuild@v3

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
with:
category: "/language:${{matrix.language}}"
23 changes: 3 additions & 20 deletions .safety-project.ini
Original file line number Diff line number Diff line change
@@ -1,29 +1,12 @@
# Safety Project Configuration
# This file pre-configures Safety CLI to prevent interactive prompts in CI environments

[project]
# Project name - prevents the "Enter a name for this codebase" prompt
name = samo-dl

# Project ID - optional but helps with consistency
name = samo-dl-project
id = samo-dl-project

# Organization - optional
organization = SAMO
url = https://app.safetycli.com/codebases/samo-dl-project/findings

[scan]
# Skip interactive prompts
interactive = false

# Note: targets and continue_on_error are now specified via CLI flags
# This allows more flexibility in different environments

# [policy]
# Policy file disabled - using command-line options instead
# policy_file = .safety-policy.yml

[output]
# Output format for CI
format = screen
# Detailed output for debugging
detailed = true
detailed = true
8 changes: 5 additions & 3 deletions scripts/check_pr_scope.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,15 +166,17 @@ def _check_single_commit(sha: str) -> bool:

print(f"πŸ”Ž Checking commit {sha[:8]}: {commit_msg}")

# Check for single-purpose keywords
# Check for single-purpose keywords (handle scoped commits like feat(scope):)
has_single_purpose = any(
commit_msg.startswith(keyword) for keyword in SINGLE_PURPOSE_KEYWORDS
commit_msg.startswith(keyword) or
commit_msg.startswith(keyword.replace(':', '('))
for keyword in SINGLE_PURPOSE_KEYWORDS
)

if not has_single_purpose:
print(
f"❌ Commit {sha[:8]} message must start with "
f"feat:, fix:, chore:, refactor:, docs:, or test:",
f"feat:, fix:, chore:, refactor:, docs:, test:, or security:",
)
print(f" Message: {commit_msg}")
return False
Expand Down
5 changes: 4 additions & 1 deletion scripts/pr_scope_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,9 @@
MAX_FILE_TYPES_FOR_WARNING = 2

# Branch naming pattern
BRANCH_NAME_PATTERN = r"^(feat|fix|chore|refactor|docs|test)/[a-z]+(?:-[a-z]+)*$"
BRANCH_NAME_PATTERN = (
r"^(feat|fix|chore|refactor|docs|test|security)/[a-z]+(?:-[a-z]+)*$"
)

# Commit message patterns
SINGLE_PURPOSE_KEYWORDS = [
Expand All @@ -72,6 +74,7 @@
"refactor:",
"docs:",
"test:",
"security:",
]

MIXING_INDICATORS = [" and ", " also ", " plus ", " & ", " in addition "]
Expand Down
Loading