Skip to content

Commit 2054365

Browse files
Github contribution and issue configuration (#59)
1 parent ed8df17 commit 2054365

File tree

2 files changed

+185
-0
lines changed

2 files changed

+185
-0
lines changed

.github/CONTRIBUTING.md

Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
# Contributing to Cognitive Code Analysis
2+
3+
Thank you for your interest in contributing to this project! 💙
4+
We welcome all improvements, whether they're bug fixes, new features, documentation updates, or test enhancements.
5+
6+
---
7+
8+
## 🧭 Contribution Guidelines
9+
10+
### 1. Fork and Branch
11+
12+
Fork the repository and create a new branch for your work:
13+
14+
```bash
15+
git checkout -b feature/your-feature-name
16+
```
17+
18+
### 2. Write Clear Commits
19+
20+
- Use clear, atomic commits that explain **what** and **why**, not just how
21+
- Follow [Conventional Commits](https://www.conventionalcommits.org/) when possible
22+
- Example: `feat: add code coverage display to cognitive metrics command`
23+
24+
### 3. Include Tests
25+
26+
**All Pull Requests must include tests.**
27+
28+
- **New features**: Must include unit or integration tests
29+
- **Bug fixes**: Must include regression tests reproducing the original issue
30+
- **Refactoring**: Ensure existing tests pass and add new tests if coverage gaps exist
31+
32+
If you're fixing an open issue, reference it in your PR description and ensure the issue scenario is covered by a test.
33+
34+
### 4. Code Quality Standards
35+
36+
Run these checks before submitting your PR:
37+
38+
```bash
39+
# PHPStan - Static Analysis (must pass with no errors)
40+
./bin/phpstan analyse
41+
42+
# PHPMD - Code Quality Analysis
43+
composer phpmd
44+
45+
# PHPUnit - All tests must pass
46+
./bin/phpunit
47+
48+
# Code Coverage (optional but encouraged)
49+
XDEBUG_MODE=coverage ./bin/phpunit --coverage-clover=coverage-clover.xml
50+
```
51+
52+
**Code Style:**
53+
- Follow PSR-12 coding standards
54+
- Use strict types: `declare(strict_types=1);`
55+
- Add type hints to all parameters and return types
56+
- Use PHPDoc blocks for complex array types and additional context
57+
58+
### 5. Documentation
59+
60+
Update documentation when relevant:
61+
62+
- Update `README.md` for user-facing feature changes
63+
- Add or update PHPDoc blocks for new classes and methods
64+
- Include inline comments when logic isn't immediately obvious
65+
- Update configuration examples if you add new options
66+
67+
---
68+
69+
## ✅ Pull Request Checklist
70+
71+
Before submitting your PR, please verify:
72+
73+
- [ ] Code follows PSR-12 and project conventions
74+
- [ ] All tests pass (`./bin/phpunit`)
75+
- [ ] PHPStan analysis passes with no errors (`./bin/phpstan analyse`)
76+
- [ ] PHPMD violations are addressed or justified
77+
- [ ] New features include tests
78+
- [ ] Bug fixes include regression tests
79+
- [ ] Documentation is updated (if applicable)
80+
- [ ] PR description clearly explains the motivation and context
81+
- [ ] Related issues are referenced (e.g., "Fixes #123")
82+
83+
---
84+
85+
## 🐛 Reporting Issues
86+
87+
When reporting bugs, please include:
88+
89+
1. **PHP version** and environment details
90+
2. **Steps to reproduce** the issue
91+
3. **Expected behavior** vs actual behavior
92+
4. **Code samples** or configuration files (if relevant)
93+
5. **Error messages** or stack traces
94+
95+
---
96+
97+
## 💬 Communication
98+
99+
For larger changes or new features:
100+
101+
1. **Open an issue first** to discuss the approach
102+
2. Wait for maintainer feedback before investing significant time
103+
3. We're happy to review proposals and provide guidance early!
104+
105+
---
106+
107+
## 🧪 Testing Philosophy
108+
109+
This project values:
110+
111+
- **High test coverage** - Aim for >80% code coverage
112+
- **Fast tests** - Unit tests should run in milliseconds
113+
- **Reliable tests** - Tests must be deterministic and not flaky
114+
- **Clear test names** - Use descriptive method names that explain what's being tested
115+
116+
---
117+
118+
## 📜 Code of Conduct
119+
120+
- Be respectful and constructive in all interactions
121+
- Focus on the code and ideas, not the person
122+
- Welcome newcomers and help them learn
123+
- Assume good intentions
124+
125+
---
126+
127+
## ❤️ Recognition
128+
129+
We deeply appreciate everyone who contributes to this project.
130+
All contributors are recognized in our release notes and commit history.
131+
132+
**Note:** PRs without accompanying tests will not be merged unless explicitly discussed and justified with maintainers.
133+
134+
---
135+
136+
## 📞 Need Help?
137+
138+
- Open a [GitHub Discussion](../../discussions) for questions
139+
- Check existing [Issues](../../issues) for similar problems
140+
- Tag maintainers in your PR if you need guidance
141+
142+
Thank you for making this project better! 🚀

.github/ISSUE_TEMPLATE

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Bug Report
2+
description: File a bug report.
3+
title: "[Bug]: "
4+
labels: ["bug", "triage"]
5+
projects: ["octo-org/1", "octo-org/44"]
6+
assignees:
7+
- octocat
8+
body:
9+
- type: markdown
10+
attributes:
11+
value: |
12+
Thanks for taking the time to fill out this bug report!
13+
- type: input
14+
id: contact
15+
attributes:
16+
label: Contact Details
17+
description: How can we get in touch with you if we need more info?
18+
placeholder: ex. [email protected]
19+
validations:
20+
required: false
21+
- type: input
22+
id: version
23+
attributes:
24+
label: The version / Commit ID
25+
description: This helps to find out if you're running the latest version.
26+
placeholder: ex. 1.2.3 or a commit SHA
27+
validations:
28+
required: true
29+
- type: textarea
30+
id: what-happened
31+
attributes:
32+
label: What happened?
33+
description: Also tell us, what did you expect to happen?
34+
placeholder: Tell us what you see!
35+
value: "A bug happened!"
36+
validations:
37+
required: true
38+
- type: textarea
39+
id: logs
40+
attributes:
41+
label: Relevant log output
42+
description: Please copy and paste any relevant log output. This will be automatically formatted into code, so no need for backticks.
43+
render: shell

0 commit comments

Comments
 (0)