X Tutup
Skip to content

LuizzKun/NewGithubRepoSteelWorks

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

16 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

SteelWorks Operations Reporting Tool

A Python-based operations reporting system with comprehensive security scanning, code quality checks, and automated CI/CD pipeline.

πŸ›‘οΈ Security Features

Software Bill of Materials (SBOM)

  • Automated SBOM Generation: Exports dependency lists in multiple formats
  • License Compliance: Automatic scanning for GPL/AGPL/LGPL copyleft licenses
  • Vulnerability Tracking: GitHub Dependabot integration for security alerts

Code Scanning

  • CodeQL Analysis: GitHub Advanced Security scanning for vulnerabilities
  • Pre-commit Hooks: Automated checks before every commit
  • Security-Extended Queries: Comprehensive security rule set

πŸ“‹ Project Overview

This system helps SteelWorks analyze production, inspection, and shipment data with:

  • SQLAlchemy ORM: Type-safe database access
  • Repository Pattern: Clean architecture with data access layer
  • Comprehensive Testing: 97% code coverage with pytest
  • Automated Quality Checks: Ruff, mypy, and custom license scanning

πŸš€ Quick Start

Prerequisites

  • Python 3.9+
  • pip or Poetry

Installation

# Clone the repository
git clone https://github.com/LuizzKun/NewGithubRepoSteelWorks.git
cd NewGithubRepoSteelWorks

# Install dependencies
pip install -r requirements.txt

# Or with Poetry
poetry install

# Install pre-commit hooks
pip install pre-commit
pre-commit install

πŸ§ͺ Testing

# Run all tests
pytest tests/ -v

# Run with coverage
pytest tests/ --cov=src/steelworks --cov-report=html

# View coverage report
open htmlcov/index.html

πŸ”’ Security & Compliance

Pre-commit Hooks

Every commit automatically runs:

  1. Ruff Format: Code formatting (PEP 8)
  2. Ruff Lint: Code quality checks
  3. MyPy: Static type checking
  4. Pytest: Full test suite
  5. License Check: Scans for prohibited copyleft licenses

Manual Security Checks

# Run all pre-commit hooks manually
pre-commit run --all-files

# Generate SBOM
python -m piplicenses --format=json --output-file=sbom.json

# Check for copyleft licenses
python scripts/check_copyleft_licenses.py

# Run CodeQL locally (requires GitHub CLI)
gh codeql database create --language=python

License Compliance

This project follows a strict license policy:

  • βœ… Approved: MIT, Apache 2.0, BSD
  • ⚠️ Review Required: LGPL (transitive dependencies only)
  • ❌ Prohibited: GPL, AGPL

See SBOM Report for detailed license analysis.

πŸ“Š CI/CD Pipeline

GitHub Actions workflows:

Code Quality (code-quality.yml)

  • Runs on: PR creation/updates, pushes to main/develop
  • Matrix testing: Python 3.9, 3.10, 3.11
  • Steps: Format check β†’ Lint β†’ Type check β†’ Tests β†’ Coverage

SBOM Generation (sbom.yml)

  • Generates Software Bill of Materials
  • Exports in JSON, Markdown, CSV formats
  • Uploads artifacts for download

CodeQL Security Scanning (codeql.yml)

  • Runs on: PR, push, weekly schedule
  • Detects: SQL injection, XSS, code injection, insecure patterns
  • Results visible in Security tab

πŸ“ Project Structure

steelworks-operations/
β”œβ”€β”€ .github/workflows/       # CI/CD pipelines
β”‚   β”œβ”€β”€ code-quality.yml     # Ruff, mypy, pytest
β”‚   β”œβ”€β”€ codeql.yml           # Security scanning
β”‚   └── sbom.yml             # Dependency tracking
β”œβ”€β”€ docs/                    # Documentation
β”‚   β”œβ”€β”€ SBOM_REPORT.md       # License compliance report
β”‚   β”œβ”€β”€ PRE_COMMIT_SETUP.md  # Pre-commit guide
β”‚   └── *.md                 # Architecture, design docs
β”œβ”€β”€ scripts/                 # Utility scripts
β”‚   β”œβ”€β”€ check_copyleft_licenses.py
β”‚   └── check_gpl_license.py
β”œβ”€β”€ src/steelworks/          # Application code
β”‚   β”œβ”€β”€ models.py            # SQLAlchemy models
β”‚   └── repositories.py      # Data access layer
β”œβ”€β”€ tests/                   # Unit tests
β”œβ”€β”€ .pre-commit-config.yaml  # Pre-commit configuration
β”œβ”€β”€ pyproject.toml           # Poetry dependencies & tool config
└── sbom-*.{json,md,csv}     # Generated SBOM files

πŸ› οΈ Development

Code Quality Tools

# Format code
ruff format src tests

# Lint code
ruff check src tests --fix

# Type check
mypy src tests --ignore-missing-imports

# Run security checks
python scripts/check_copyleft_licenses.py

Pre-commit Hook Configuration

See .pre-commit-config.yaml for detailed hook configuration with extensive comments explaining the mental model.

Skipping Hooks (Emergency Only)

# Skip all hooks (not recommended)
git commit --no-verify

# Skip specific hooks
SKIP=pytest-tests git commit -m "message"

πŸ“ˆ Code Coverage

Current: 97% (66/66 statements)

Module Coverage
models.py 100%
repositories.py 90%
Overall 97%

πŸ” GitHub Security Features

Enabling Security Features

  1. Dependency Graph:

    • Settings β†’ Security & Analysis β†’ Enable Dependency graph
  2. Dependabot Alerts:

    • Settings β†’ Security & Analysis β†’ Enable Dependabot alerts
  3. Code Scanning:

    • Automatically enabled via .github/workflows/codeql.yml
    • View results: Security tab β†’ Code scanning alerts

Exporting SBOM from GitHub

# Via GitHub UI
Repository β†’ Insights β†’ Dependency graph β†’ Export SBOM

# Via API
curl -H "Authorization: token YOUR_TOKEN" \
  https://api.github.com/repos/LuizzKun/NewGithubRepoSteelWorks/dependency-graph/sbom

πŸ“š Documentation

🀝 Contributing

  1. Create a feature branch: git checkout -b feature/your-feature
  2. Make changes (pre-commit hooks will run automatically)
  3. Ensure all tests pass: pytest tests/
  4. Push and create a Pull Request
  5. Wait for CI/CD checks to pass
  6. Request review

πŸ“„ License

MIT License - see LICENSE file for details

πŸ”— Links


Last Updated: March 4, 2026
Version: 1.0.0

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

Β 
Β 
Β 

Contributors

X Tutup