Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
c5b9ad7
fix clang settings and yml linter issues
MartinMelikMerkumians Nov 25, 2025
b202f57
change ML workflow to apply fixes
MartinMelikMerkumians Nov 25, 2025
fccb16f
Fix double quotes for shell vars
MartinMelikMerkumians Nov 26, 2025
31d3afd
another try to fix the linter issue
MartinMelikMerkumians Nov 26, 2025
0e929d7
Add megalinter reports to gitignore
MartinMelikMerkumians Nov 26, 2025
2bba58a
Megalinter fixes
MartinMelikMerkumians Nov 26, 2025
0285894
Fix markdown linter issues
MartinMelikMerkumians Nov 28, 2025
cebc05f
Change formatting to better supported clang-format
MartinMelikMerkumians Nov 28, 2025
dce554b
fix mem leak in test helper
MartinMelikMerkumians Nov 28, 2025
85029b1
Fix some linter issues
MartinMelikMerkumians Dec 1, 2025
00ec573
add necessary permissions for build, test and coverage steps
MartinMelikMerkumians Dec 1, 2025
ef6ab99
change action versions to hashes
MartinMelikMerkumians Dec 1, 2025
78a17fc
Fix cppcheck non-/exhaustive checks
MartinMelikMerkumians Dec 3, 2025
1203106
update workflows and configs
MartinMelikMerkumians Dec 3, 2025
303ec83
update megalinter config
MartinMelikMerkumians Dec 3, 2025
d602be0
fix cppcheck info as errors in CI
MartinMelikMerkumians Dec 3, 2025
1d5e47b
add supression of checklevelmaxbranches
MartinMelikMerkumians Dec 3, 2025
2dc1b17
Fix env argument in exhaustive check job
MartinMelikMerkumians Dec 3, 2025
5423ab3
update settings
MartinMelikMerkumians Dec 3, 2025
c3a2632
Fix lychee error
MartinMelikMerkumians Dec 3, 2025
bfe4712
update settings
MartinMelikMerkumians Dec 4, 2025
149ad46
Add C17 requirements for compiler
MartinMelikMerkumians Dec 5, 2025
2b8898b
Fix undefined cast behavior and cpplint violations in cipconnectionob…
MartinMelikMerkumians Dec 5, 2025
ba30823
Fixing structure and linter errors partially
MartinMelikMerkumians Dec 13, 2025
7b6a2cc
Update code style
MartinMelikMerkumians Dec 13, 2025
86d9eed
Update cpplint config
MartinMelikMerkumians Dec 13, 2025
41e343a
Fix cpplint issues
MartinMelikMerkumians Dec 19, 2025
f966c17
Fix cpplint issues
MartinMelikMerkumians Dec 20, 2025
2d7deff
Fix cpplint issues
MartinMelikMerkumians Dec 21, 2025
4e2647d
Fix cpplint issues
MartinMelikMerkumians Dec 21, 2025
3f61ac4
Fix cpplint issues
MartinMelikMerkumians Dec 21, 2025
89cfab5
Fix cpplint issues
MartinMelikMerkumians Dec 22, 2025
1fc238d
Fix cpplint issues
MartinMelikMerkumians Dec 22, 2025
bba7230
Fix cpplint issues
MartinMelikMerkumians Dec 22, 2025
2347d2f
Fix wrong include for test builds
MartinMelikMerkumians Dec 22, 2025
10b7950
Add sanitizers
MartinMelikMerkumians Dec 22, 2025
997d1cd
Fix no traces when testing is enabled
MartinMelikMerkumians Dec 22, 2025
7bec8df
Fix license file to UTF-8
MartinMelikMerkumians Dec 26, 2025
63d2150
Fix platform includes for linting
MartinMelikMerkumians Dec 26, 2025
81b9291
Add tests fr encapsulation inactivity timer
MartinMelikMerkumians Dec 27, 2025
6840c1e
Add tests for encapsulation inactivity timer
MartinMelikMerkumians Dec 27, 2025
f055c48
Simplify CheckEncapsulationInactivity
MartinMelikMerkumians Dec 27, 2025
952bf7f
Add sanitizer buid
MartinMelikMerkumians Dec 29, 2025
01c1a20
Change XorRandomShift to reentrant Random-compliant
MartinMelikMerkumians Dec 31, 2025
0e5f571
Update copyright
MartinMelikMerkumians Dec 31, 2025
b852302
Update copyright
MartinMelikMerkumians Dec 31, 2025
d8cf974
Split RandomNew to create an init function
MartinMelikMerkumians Jan 3, 2026
6ecd5df
fix cpplint C errors
MartinMelikMerkumians Jan 3, 2026
887dab1
chore: ignore actionlint binary
MartinMelikMerkumians Jan 3, 2026
10e4f2a
Fix last C cpplint issues
MartinMelikMerkumians Jan 5, 2026
5978499
Fix last C cpplint error
MartinMelikMerkumians Jan 5, 2026
6345001
chore: ignore all build directories using wildcard
MartinMelikMerkumians Jan 5, 2026
081f153
Fix Markdown linter issues
MartinMelikMerkumians Jan 5, 2026
5fc55b8
Fix another md linter issue
MartinMelikMerkumians Jan 5, 2026
2f623ab
Fix shall linter issues
MartinMelikMerkumians Jan 5, 2026
80cabc9
Fix OpENerTests.cpp issues
MartinMelikMerkumians Jan 5, 2026
d3255a7
Change config to ignore files with expected clones
MartinMelikMerkumians Jan 5, 2026
d9d6b21
Change config for lynchee to ignore expected broken links
MartinMelikMerkumians Jan 5, 2026
e22d60c
Fix shellcheck issue
MartinMelikMerkumians Jan 5, 2026
bf03303
Update gihub regex for lychee
MartinMelikMerkumians Jan 5, 2026
3948aa0
Ignore false positive duplicates
MartinMelikMerkumians Jan 5, 2026
62fc9ff
Fix shellcheck error
MartinMelikMerkumians Jan 5, 2026
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
94 changes: 55 additions & 39 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -1,64 +1,80 @@
---
# Based on the Google C++ Style Guide, with user-specific overrides.
# Based on the Google C++ Style Guide, with user-specific overrides
# derived from Uncrustify rules (e.g., alignment, block enforcement).
BasedOnStyle: Google

# --- User Overrides from Uncrustify Config ---
# --- 1. Indentation & Width ---

# 1. Indentation
# Google Style default is 2, but we keep the explicit setting just in case.
# Uncrustify: indent_columns=2
IndentWidth: 2

# 2. Tabs
# Google Style default is Never, but explicitly set here.
# Set continuation indent to match base indent
ContinuationIndentWidth: 2

# Uncrustify: indent_with_tabs=0
UseTab: Never

# 3. Column Width
# Uncrustify: code_width=80
ColumnLimit: 80

# 4. Brace Wrapping
# The Google Style default is already to attach braces to the line end
# (e.g., `if (x) { ... }`).
# Uncrustify: nl_class_brace=remove, nl_fdef_brace=remove
# We keep the default: BreakBeforeBraces: Attach
# Uncrustify: indent_switch_case=2 (Enforce indentation for case labels)
IndentCaseLabels: true

# --- 2. Spacing & Pointers ---

# 5. Assignment Alignment
# This is a key deviation from the Google default, which is usually 'None'.
# Uncrustify: indent_align_assign=true
AlignConsecutiveAssignments: true
# Uncrustify: sp_func_def_paren=remove
# Changed to ControlStatements to add space before parens in if/for/while
# but not in function calls/declarations
SpaceBeforeParens: ControlStatements

# 6. Function Parameter Packing (Google default is to pack)
# Uncrustify: nl_func_def_args=add (Suggests placing each arg on a new line)
BinPackArguments: false
BinPackParameters: false # Applies to declarations
# Uncrustify: sp_arith=add, sp_assign=add, sp_enum_assign=add
# Note: SpaceBeforeAssignment is not a valid option in clang-format
# Spacing around operators is controlled by SpacesAroundConditions and others

# 7. Pointer Alignment
# Google Style prefers the star next to the type ('int* foo').
# Uncrustify: sp_before_ptr_star=add (e.g. 'int * a;')
# We stick to the Google default: PointerAlignment: Left (or None, which often results in Left).
# Pointer Alignment: Google default is 'Left', matching the typical style
# (int* foo). We keep this unless explicitly overridden by Uncrustify.
PointerAlignment: Left

# 8. Namespace Indentation
# Google Style default is false, matching:
# Uncrustify: indent_namespace=false
IndentNamespace: false
# --- 3. Alignment (Key Overrides) ---

# 9. Case Label Indentation
# Google Style default is to indent `case` labels.
# Uncrustify: indent_switch_case=2 (Suggests indenting case labels)
IndentCaseLabels: true
# Uncrustify: indent_align_assign=true (Aligning consecutive assignment operators)
AlignConsecutiveAssignments: Consecutive

# 10. Operator Alignment
# Uncrustify: align_left_shift=true
# Uncrustify: align_left_shift=true (Aligning binary operators like <<)
AlignOperands: Align

# 11. Newlines/Block Handling
# Uncrustify: mod_full_brace_if=add, mod_full_brace_for=add, etc.
# These are generally handled by Google's requirement for braces, even for single statements.
# --- 4. Newlines & Block Enforcement ---

# Uncrustify: nl_func_def_args=add (One argument per line)
BinPackArguments: false
BinPackParameters: false

# Uncrustify: mod_full_brace_if=add, mod_full_brace_for=add, mod_full_brace_while=add
# Goal: Do NOT allow short statements on a single line.

AllowShortBlocksOnASingleLine: Never
AllowShortIfStatementsOnASingleLine: Never
AllowShortCaseLabelsOnASingleLine: Never
AllowShortCaseLabelsOnASingleLine: false

# Uncrustify: ls_func_split_full=true (Functions)
# 'Empty' means short functions can only be one line if their body is empty.
AllowShortFunctionsOnASingleLine: Empty
...

# Braces: Google default is 'Attach' (e.g., 'if (x) {'), matching
# Uncrustify's nl_class_brace=remove and nl_fdef_brace=remove intent.
BreakBeforeBraces: Attach

# --- 5. Miscellaneous ---

# Keep opening brace on same line for initializer lists
Cpp11BracedListStyle: false

# Uncrustify: mod_remove_extra_semicolon=true
# Note: RemoveSemicolon is not a standard option, clang-format handles this differently

# Uncrustify: indent_class=true
# Note: IndentAccessModifiers controls the indentation of public/private/protected
IndentAccessModifiers: false
AccessModifierOffset: -1

DisableFormat: false
29 changes: 29 additions & 0 deletions .cppcheck-config
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# cppcheck configuration for OpENer
#
# This file documents the cppcheck settings used in the project.
# cppcheck does not have a native config file format, but these settings
# are applied via command-line arguments in:
# - .pre-commit-config.yaml (for pre-commit hook)
# - .mega-linter.yml (for CI/CD)
#
# Settings:
# --------
# Standard Analysis:
# --enable=all Enable all checks
# --inconclusive Include inconclusive warnings
# --force Force checking of all configurations
# --inline-suppr Enable inline suppressions (// cppcheck-suppress)
# --suppress=missingIncludeSystem Suppress system header warnings
# --suppress=normalCheckLevelMaxBranches Suppress informational messages
#
# Exhaustive Analysis (CI only):
# --check-level=exhaustive Enable all checks
# --enable=warning,style,performance,portability
# --std=c99 Use C99 standard
# --platform=unix64 Target 64-bit POSIX platform
#
# References:
# - Pre-commit hook: .pre-commit-config.yaml (lines 28-36)
# - CI standard checks: .github/workflows/ci.yml (line 41)
# - CI exhaustive checks: .github/workflows/exhaustive-analysis.yml (lines 50-54)
# - MegaLinter config: .mega-linter.yml (line 13)
1 change: 1 addition & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
version: 2
updates:
- package-ecosystem: "github-actions"
Expand Down
181 changes: 181 additions & 0 deletions .github/workflows/WORKFLOWS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,181 @@
# OpENer CI/CD Workflows

This document describes the continuous integration and analysis workflows for the OpENer project.

## Overview

The CI/CD pipeline is split into two workflows optimized for different purposes:

### 1. **CI Workflow** (`ci.yml`)
- **Purpose**: Fast feedback for daily development
- **Triggers**: Every push to `master`, every pull request
- **Duration**: ~5-10 minutes
- **Analysis Level**: Standard (fast) static analysis

### 2. **Exhaustive Analysis** (`exhaustive-analysis.yml`)
- **Purpose**: Thorough validation for releases
- **Triggers**:
- Release branches (`release/**`)
- Version tags (`v*`)
- Nightly at 3 AM UTC
- Manual workflow dispatch
- **Duration**: ~30-60 minutes
- **Analysis Level**: Exhaustive static analysis

## Workflow Details

### CI Workflow (Fast)

**Jobs:**
1. **lint** - Quick code quality checks
- MegaLinter with standard cppcheck
- Auto-applies formatting fixes on PRs
- Suppresses `normalCheckLevelMaxBranches` info message

2. **build-test** - Build and test
- Compiles with optimizations enabled
- Runs full test suite with parallel execution
- Generates code coverage reports
- Posts coverage summary on PRs

**Best Practices Applied:**
- ✅ Parallel builds (`-j$(nproc)`)
- ✅ Parallel test execution
- ✅ Action version pinning with SHA (security)
- ✅ Automatic linter fixes
- ✅ Coverage reporting on PRs

### Exhaustive Analysis (Thorough)

**Jobs:**
1. **exhaustive-lint** - Deep static analysis
- Full branch analysis with `--check-level=exhaustive`
- Enables all cppcheck warnings (style, performance, portability)
- Creates GitHub issue on nightly failures
- Retains reports for 30 days

2. **build-release** - Release configuration testing
- Strict compiler warnings (`-Wall -Wextra -Werror`)
- Full optimization testing
- Separate coverage report for releases

## Configuration Files

### `.mega-linter.yml`
Central MegaLinter configuration with:
- Linter inclusions/exclusions
- File filtering rules
- Report settings
- Parallel processing enabled

### When Does Each Workflow Run?

| Event | CI (Fast) | Exhaustive |
|-------|-----------|------------|
| Push to `master` | ✅ | ❌ |
| Pull request | ✅ | ❌ |
| Push to `release/*` | ❌ | ✅ |
| Version tag (`v*`) | ❌ | ✅ |
| Nightly (3 AM UTC) | ❌ | ✅ |
| Manual trigger | ❌ | ✅ |

## Benefits of This Approach

### For Developers
- ⚡ **Fast feedback** on PRs (5-10 min)
- 🔧 **Auto-fixes** for formatting issues
- 📊 **Immediate coverage** reports
- 🎯 **No waiting** for exhaustive checks during development

### For Releases
- 🔍 **Thorough validation** before releases
- 🛡️ **Deep branch analysis** finds edge cases
- 📈 **Long-term tracking** with nightly runs
- 🚨 **Automatic alerts** for regressions

### For Industrial/Safety Context
- ✅ OpENer is used in **manufacturing and automation**
- ✅ Exhaustive checks catch **subtle issues** in critical paths
- ✅ **Nightly monitoring** ensures code health
- ✅ **Release validation** provides confidence for production deployments

## Maintenance

### Updating Dependencies
All action versions are pinned to specific commits for security. To update:

```bash
# Check for updates
gh workflow view ci.yml

# Update specific action
# Replace SHA in workflows with new version
```

### Adjusting Analysis Depth

**To make standard checks more thorough:**
```yaml
# In ci.yml
CPPCHECK_ARGUMENTS: --inline-suppr --enable=warning
```

**To reduce exhaustive analysis:**
```yaml
# In exhaustive-analysis.yml
CPPCHECK_ARGUMENTS: --check-level=exhaustive --inline-suppr
# Remove: --enable=warning,style,performance,portability
```

### Troubleshooting

**If CI is too slow:**
- Reduce parallel jobs: `cmake --build ... -j2`
- Skip tests on draft PRs
- Reduce validation scope

**If exhaustive analysis fails nightly:**
- Check created GitHub issues
- Download artifacts for detailed reports
- Review cppcheck output for false positives

**If linter fixes cause conflicts:**
- Add `skip fix` to commit message
- Adjust `.mega-linter.yml` rules
- Disable specific fixers

## Migration from Old Workflow

The new structure maintains all functionality from `build.yml`:

| Old Feature | New Location | Changes |
|------------|--------------|---------|
| MegaLinter | `ci.yml` → lint | Split into standard/exhaustive |
| Build & Test | `ci.yml` → build-test | Added parallel execution |
| Coverage | `ci.yml` → build-test | Enhanced reporting |
| Auto-fixes | `ci.yml` → lint | Simplified logic |
| Release validation | NEW: `exhaustive-analysis.yml` | Added thorough checks |

## Manual Workflow Execution

```bash
# Trigger exhaustive analysis manually
gh workflow run exhaustive-analysis.yml

# View recent runs
gh run list --workflow=ci.yml

# Download artifacts
gh run download <run-id>
```

## Questions?

- **Why two workflows?** Balance between speed (dev) and thoroughness (release)
- **Why nightly exhaustive?** Catches regressions without slowing daily work
- **Can I run exhaustive on my PR?** Yes, via workflow dispatch, but not recommended for regular PRs
- **What if exhaustive finds issues?** Fix in a follow-up PR; doesn't block daily development

---

*Last updated: December 2025*
Loading