FocusFlow β Sprint Code Standards
目录
- Project Overview
- Introduction
- Part 1: Language-Specific Coding Standards
- 1. Python (Backend / Scripts)
- 2. JavaScript / TypeScript (Frontend - React/React Native)
- 3. HTML & CSS
- Part 2: Git & Version Control Workflow (CRITICAL)
- Part 3: Pre-Merge Quality Checklist
- Conclusion
Project Overview
| Course | 2501_MU_SE_FZU |
|---|---|
| Assignment Requirement | Sixth Assignment - Beta Sprint |
| Team Name | Focus_2025 |
| Goal of this assignment | Clarify Code Standards, Sprint Tasks, and Plans for the team Beta Sprint |
| Other references | IEEE Std 830-1998, GB/T 8567-2006 |
Introduction
To ensure the code quality, maintainability, and collaborative efficiency of the FocusFlow project, our team has established and unanimously agreed to adhere to the following code standards. These standards encompass syntax style, engineering practices, and collaboration workflows. They represent a key improvement distilled from our "learning by doing" experience in the Alpha phase.
Part 1: Language-Specific Coding Standards
1. Python (Backend / Scripts)
- Reference: PEP 8.
- Naming:
- Variables & Functions:
snake_case(e.g.,calculate_session_duration) - Classes:
CamelCase(e.g.,UserProfileManager) - Constants:
ALL_CAPS_WITH_UNDERSCORES(e.g.,MAX_FOCUS_BLOCK)
- Variables & Functions:
- Style:
- Indentation: 4 spaces.
- Maximum Line Length: 80 characters.
- Spacing: Two blank lines between top-level functions/classes. One blank line between methods.
- Documentation:
- Use docstrings for all modules, classes, and public functions (Google or NumPy style).
- Use inline comments (
#) sparingly for complex logic only.
- Key Practices:
- Use context managers (
withstatement) or explicittry...except...finallyblocks for resource management (files, DB connections). - Always use parameterized queries with the database driver. NEVER use string formatting for SQL statements.
- Hash passwords using a dedicated library (e.g.,
bcrypt,passlib) before storage.
- Use context managers (
2. JavaScript / TypeScript (Frontend - React/React Native)
- Reference: Airbnb JavaScript/React Style Guide (adapted).
- Naming:
- Variables & Functions:
camelCase(e.g.,formatTimerDisplay) - React Components:
PascalCase(e.g.,TaskCard,FocusTimer) - Constants:
ALL_CAPS_WITH_UNDERSCORESfor true constants.
- Variables & Functions:
- Style:
- Indentation: 2 spaces.
- Maximum Line Length: 80 characters.
- Semicolons: Required.
- Quotes: Use single quotes (
') for strings, backticks (`) for template literals.
- React-Specific:
- Use functional components with Hooks.
- Define props and state using TypeScript interfaces or PropTypes.
- Keep components small and focused on a single responsibility.
- Key Practices:
- For API calls, use a centralized service (e.g.,
apiClient.js) built onaxiosorfetch. - Use the
useEffectcleanup function to prevent memory leaks (e.g., clear timers, unsubscribe).
- For API calls, use a centralized service (e.g.,
3. HTML & CSS
- HTML:
- Use semantic tags (
<header>,<main>,<section>,<article>). - Indentation: 2 spaces.
- Attribute values: Use double quotes (
href="...").
- Use semantic tags (
- CSS / Styled-Components:
- Naming: Use the BEM (Block__Element--Modifier) methodology for class names (e.g.,
.task-card,.task-card__title,.task-card--completed). - Organization: Group related properties logically (e.g., Box Model -> Positioning -> Typography -> Visual).
- Specificity: Avoid
!importantand overly specific selectors (e.g.,div#id .class). Aim for low specificity.
- Naming: Use the BEM (Block__Element--Modifier) methodology for class names (e.g.,
Part 2: Git & Version Control Workflow (CRITICAL)
This section directly addresses a key failure from our Alpha retrospective.
Branch Strategy:
-
main: Always deployable. Direct commits are forbidden. -
develop: Integration branch for features. Most PRs target here. -
feature/*: Branches for new development (e.g.,feature/password-reset,feature/task-cards). -
hotfix/*: Branches for critical bugs inmain.
-
Commit Convention:
- Format:
<type>(<scope>): <subject>(Based on Conventional Commits). - Types:
feat,fix,docs,style,refactor,test,chore. - Example:
feat(F1): implement new password reset confirmation screenorfix(F3): align task card layout on mobile.
- Format:
Pull Request (PR) Process:
- All changes must be introduced via a PR from a feature/hotfix branch.
- A PR requires at least one approval from a team member other than the author before merging.
- The PR description must link to the relevant Issue (e.g.,
Closes #12). - The PR must pass the mandatory pre-merge checklist (see Part 3).
Part 3: Pre-Merge Quality Checklist
Before any PR can be merged, the author must confirm the following:
- Code Functionality: The feature/bugfix works as described in the Issue.
- Self-Review: I have reviewed my own code for obvious errors and style violations.
- Linting: Code passes ESLint (for JS/TS) and Flake8/Black (for Python) without errors.
- Testing: For backend logic, corresponding unit tests are added/updated. For frontend components, manual testing has been performed on target devices/browsers.
- No Breaking Changes: The change does not break existing functionality (verified by running the core smoke tests).
- Documentation: Any necessary updates to README, API docs, or inline comments have been made.
Conclusion
These standards are not static rules but a living agreement. They are enforced through peer review in our PR process and serve as our shared foundation for writing clean, secure, and collaborative code. By adhering to them, we aim to eliminate the chaos of the Alpha phase and build FocusFlow into a robust, professional application.
相关推荐
战国BC298年世界历史地图矢量文件SHP格式.zip
本资源为《战国BC298年世界历史地图矢量文件SHP格式》压缩包,文件大小约 2.29 MB,便于集中下载、整理和使用。具体内容请结合压缩包内的实际文件与说明查看。 在当前可读取的目录中,可见属性表(.dbf)、投影说明文件(.prj)、Shapefile 主文件(.shp)、Shapefile 索引(.shx)。建议解压后保持原有目录结构,先浏览文件清单与说明,再选择需要的资料进行加载或整理。 应用方面,可根据实际资料用于学习练习、资料检索、研究整理或项目参考。使用时可先确定所需内容,建立清晰的文件分类,再按项目要求进行筛选、转换与汇总。 使用 Shapefile 数据时,请把实际配套的 .shp、.shx、.dbf 等文件保存在同一目录,并保持同名关联;加载后再检查坐标系与中文字段显示。如需叠加其它数据,请先统一坐标与字段口径。 数据来源、时间范围、坐标系、字段定义、精度和使用条件,请以实际文件及原始说明为准。本介绍不对文件名之外尚未核实的信息作额外承诺。
open-code-review · 自动化代码评审工具
Open Code Review 是一款 AI 驱动的代码审查 CLI 工具。它脱胎于阿里巴巴集团内部的官方 AI 代码审查助手——过去两年间,它已服务于数万名开发者,发现了数百万个代码缺陷。经过大规模生产环境的充分验证后,我们将其孵化为开源项目回馈社区。只需配置一个模型端点即可上手使用。 它读取 Git diff,通过具备工具调用能力的 Agent 将变更文件发送至可配置的 LLM,生成具有行级精度的结构化审查评论。该 Agent 可以读取完整文件内容、搜索代码库、检查其他变更文件以获取上下文,从而产出深度审查——而非仅停留在 diff 表面的浅层反馈。除了 diff 审查之外,ocr scan 还能对整个文件进行审查,适用于审计不熟悉的代码库或没有有意义 diff 的目录。
春秋BC537年世界历史地图矢量文件SHP格式.zip
本资源为《春秋BC537年世界历史地图矢量文件SHP格式》压缩包,文件大小约 1.86 MB,便于集中下载、整理和使用。具体内容请结合压缩包内的实际文件与说明查看。 在当前可读取的目录中,可见属性表(.dbf)、投影说明文件(.prj)、Shapefile 主文件(.shp)、Shapefile 索引(.shx)。建议解压后保持原有目录结构,先浏览文件清单与说明,再选择需要的资料进行加载或整理。 应用方面,可根据实际资料用于学习练习、资料检索、研究整理或项目参考。使用时可先确定所需内容,建立清晰的文件分类,再按项目要求进行筛选、转换与汇总。 使用 Shapefile 数据时,请把实际配套的 .shp、.shx、.dbf 等文件保存在同一目录,并保持同名关联;加载后再检查坐标系与中文字段显示。如需叠加其它数据,请先统一坐标与字段口径。 数据来源、时间范围、坐标系、字段定义、精度和使用条件,请以实际文件及原始说明为准。本介绍不对文件名之外尚未核实的信息作额外承诺。
春秋BC524年世界历史地图矢量文件SHP格式.zip
本资源为《春秋BC524年世界历史地图矢量文件SHP格式》压缩包,文件大小约 1.84 MB,便于集中下载、整理和使用。具体内容请结合压缩包内的实际文件与说明查看。 在当前可读取的目录中,可见属性表(.dbf)、投影说明文件(.prj)、Shapefile 主文件(.shp)、Shapefile 索引(.shx)。建议解压后保持原有目录结构,先浏览文件清单与说明,再选择需要的资料进行加载或整理。 应用方面,可根据实际资料用于学习练习、资料检索、研究整理或项目参考。使用时可先确定所需内容,建立清晰的文件分类,再按项目要求进行筛选、转换与汇总。 使用 Shapefile 数据时,请把实际配套的 .shp、.shx、.dbf 等文件保存在同一目录,并保持同名关联;加载后再检查坐标系与中文字段显示。如需叠加其它数据,请先统一坐标与字段口径。 数据来源、时间范围、坐标系、字段定义、精度和使用条件,请以实际文件及原始说明为准。本介绍不对文件名之外尚未核实的信息作额外承诺。
仿真抓取EVCD文件的demo工程
仿真抓取EVCD文件的demo工程


