docs: add contribution guides - #2005
Conversation
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>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
mineralsfree
left a comment
There was a problem hiding this comment.
A few improvements suggestions
| - **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 |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
| - **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(...)`). |
There was a problem hiding this comment.
maybe DeviceList.tsx? 😄
| - **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. |
There was a problem hiding this comment.
I think Follow existing patterns where applicable supposed to be a separate item here?
| 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. |
There was a problem hiding this comment.
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
| npm run test | ||
| ``` | ||
| - Ensure all tests pass before submitting your pull request. | ||
|
|
There was a problem hiding this comment.
Worth mentioning nt-gui I guess
There was a problem hiding this comment.
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>
Requested by Manuel Zedel · Slack thread
What
Adds a root
CONTRIBUTING.mdfor 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.mdin the repo; contribution conventions lived implicitly incommitlint.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
MENJira project), the Go programming style, thebackend/services/<svc>layered structure (api → app → store, sharedmodelandpkg/), building and testing via the backend Makefile, DCO sign-off, Conventional-Commit structure pointed at the repo'scommitlint.config.js, AI/LLM usage, and the code of conduct. It points frontend contributors to a separatefrontend/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+goimportswith thegithub.com/mendersoftware/mender-serverlocal prefix, thegolangci-lintconfig inbackend/.golangci.yml, 100-column lines, and the layered service architecture underbackend/services/. The commit and sign-off sections reference the repo's owncommitlint.config.js(allowed scopes, mandatorySigned-off-by).Generated by Claude Code