Skip to content

docs: add contribution guides - #2005

Open
claude[bot] wants to merge 4 commits into
mainfrom
docs/add-contributing-guide
Open

docs: add contribution guides#2005
claude[bot] wants to merge 4 commits into
mainfrom
docs/add-contributing-guide

Conversation

@claude

@claude claude Bot commented Jun 30, 2026

Copy link
Copy Markdown

Requested by Manuel Zedel · Slack thread

What

Adds a root CONTRIBUTING.md for the Mender server backend. The repo had no contribution guide, so new backend contributors had nothing describing the Go style, commit rules, or sign-off requirements.

Before: no CONTRIBUTING.md in the repo; contribution conventions lived implicitly in commitlint.config.js, backend/.golangci.yml, and the mender client repo's guide.

After: a server-focused guide at the repo root covering security reporting, getting started (the MEN Jira project), the Go programming style, the backend/services/<svc> layered structure (api → app → store, shared model and pkg/), building and testing via the backend Makefile, DCO sign-off, Conventional-Commit structure pointed at the repo's commitlint.config.js, AI/LLM usage, and the code of conduct. It points frontend contributors to a separate frontend/CONTRIBUTING.md.

How

Modeled on the mender client repo's CONTRIBUTING.md, with the C++ "Programming style" section replaced by the Go/backend equivalents: gofmt + goimports with the github.com/mendersoftware/mender-server local prefix, the golangci-lint config in backend/.golangci.yml, 100-column lines, and the layered service architecture under backend/services/. The commit and sign-off sections reference the repo's own commitlint.config.js (allowed scopes, mandatory Signed-off-by).


Generated by Claude Code

claude added 2 commits June 30, 2026 20:40
Add a server-focused CONTRIBUTING.md at the repo root covering security
reporting, getting started, Go programming style and the backend service
structure, building and testing, DCO sign-off, Conventional Commit structure
(pointing at commitlint.config.js), AI/LLM usage and the code of conduct.
Frontend contributors are pointed to a separate frontend/CONTRIBUTING.md.

Ticket: None
Signed-off-by: Claude <noreply@anthropic.com>
Add a CONTRIBUTING.md under frontend/ describing the frontend code style
(Prettier), naming conventions, testing philosophy (Testing Trophy / React
Testing Library) and pull request process. It links back to the root
CONTRIBUTING.md for sign-off and commit-structure rules.

Ticket: None
Signed-off-by: Claude <noreply@anthropic.com>
@mzedel mzedel changed the title docs: add backend contribution guide docs: add contribution guides Jul 3, 2026
@mzedel
mzedel marked this pull request as ready for review July 3, 2026 08:56
@mzedel
mzedel requested review from a team July 3, 2026 08:57
@codecov

codecov Bot commented Jul 3, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@mineralsfree mineralsfree left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few improvements suggestions

Comment thread frontend/CONTRIBUTING.md Outdated
- **Enforcement:** Code style is automatically checked in our CI pipeline. Pull requests with formatting issues will fail checks.
- **How to Apply:** Before committing your changes, please run the formatting command:
```bash
npm run lint-fix

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will only fix some ESLint errors, but it won't fix Prettier issues. Maybe we should introduce a script that does both? (Some eslint errors have to be fixed manually in any case.)

Otherwise, maybe we should try to add a pre-commit hook or something?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch — you're right that lint-fix only runs ESLint. I've updated the guide to run npm run lint-fix and npx prettier --write "src/js/**/*.{js,ts,jsx,tsx,less}" explicitly. Adding a dedicated format script and wiring Prettier into a working pre-commit hook (the current husky block in package.json is the old v4 format and is inert, and lint-staged only runs ESLint) is a tooling change, so I'll do it in a separate follow-up PR rather than in this docs change.

Comment thread frontend/CONTRIBUTING.md Outdated
- **Descriptive Names:** Variables, functions, components, and file names should be descriptive and clearly convey their purpose. Avoid abbreviations unless they are widely understood (e.g., `id`, `url`, `http`).
- **Consistency:**
- **Variables & Functions:** Use `camelCase` (e.g., `isLoading`, `fetchDeviceDetails`).
- **React Components:** Use `PascalCase` for component names and filenames (e.g., `DeviceList.js`, `function DeviceList(...)`).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe DeviceList.tsx? 😄

Comment thread frontend/CONTRIBUTING.md Outdated
- **Variables & Functions:** Use `camelCase` (e.g., `isLoading`, `fetchDeviceDetails`).
- **React Components:** Use `PascalCase` for component names and filenames (e.g., `DeviceList.js`, `function DeviceList(...)`).
- **Constants:** Use `UPPER_SNAKE_CASE` for true constants (e.g., `MAX_LOGIN_ATTEMPTS`).
- **CSS/SCSS classes:** Use kebab-case (e.g., `.device-list-item`). Follow existing patterns where applicable.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think Follow existing patterns where applicable supposed to be a separate item here?

Comment thread frontend/CONTRIBUTING.md Outdated
We aim for a high degree of confidence in our frontend application through testing. Our testing philosophy is heavily inspired by Kent C. Dodds' principles, particularly the Testing Trophy and the practices promoted by React Testing Library.

- **Testing Trophy Focus:**
- **(Few) End-to-End Tests:** Cover critical user flows using tools like Cypress (if applicable). These are valuable but slower and more brittle.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We use Playwright, so maybe it's worth mentioning it explicitly? Maybe also providing the location of the test and README for playwright we have

Comment thread frontend/CONTRIBUTING.md
npm run test
```
- Ensure all tests pass before submitting your pull request.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Worth mentioning nt-gui I guess

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a "Shared packages" section noting that the @northern.tech/* packages (state store, themes, shared UI components, and the ESLint/Prettier/TypeScript configs) are developed in NorthernTechHQ/nt-gui, so changes to those belong there rather than in this directory.

Use .tsx in the React component example, split the "follow existing
patterns" note into its own item, describe the Prettier vs ESLint fix
commands accurately, name Playwright and point at tests/e2e_tests/, and
note that shared @northern.tech/* packages are developed in nt-gui.

Ticket: None
Signed-off-by: Claude <noreply@anthropic.com>
PR #2015 added an npm run format script, Prettier in lint-staged, and a working
husky pre-commit hook. Update the "How to Apply" section to point at npm run
format and the automatic pre-commit hook instead of the manual npx prettier
workaround.

Ticket: None
Signed-off-by: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants