FocusFlow β Sprint Code Standards

FOCUS_2025_SE 2025-12-28 15:05:03

目录

  • 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

Course2501_MU_SE_FZU
Assignment RequirementSixth Assignment - Beta Sprint
Team NameFocus_2025
Goal of this assignmentClarify Code Standards, Sprint Tasks, and Plans for the team Beta Sprint
Other referencesIEEE 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)
  • 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 (with statement) or explicit try...except...finally blocks 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.

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_UNDERSCORES for true constants.
  • 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 on axios or fetch.
    • Use the useEffect cleanup function to prevent memory leaks (e.g., clear timers, unsubscribe).

3. HTML & CSS

  • HTML:
    • Use semantic tags (<header>, <main>, <section>, <article>).
    • Indentation: 2 spaces.
    • Attribute values: Use double quotes (href="...").
  • 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 !important and overly specific selectors (e.g., div#id .class). Aim for low specificity.

Part 2: Git & Version Control Workflow (CRITICAL)

This section directly addresses a key failure from our Alpha retrospective.

  1. 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 in main.
  2. 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 screen or fix(F3): align task card layout on mobile.
  3. 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.

...全文
157 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复
内容概要:本文聚焦于“基于配电网韧性提升的应急移动电源预配置和动态调度”研究中的MPS预配置部分,属于SCI一区高水平论文的复现工作。通过Matlab编程实现,构建了面向极端事件下配电网快速恢复能力提升的优化模型,重点解决应急移动电源(MPS)在灾前的科学预配置问题。研究系统阐述了问题背景、建模逻辑与求解方法,强调科研过程中逻辑严谨性、借力高水平成果的重要性,并倡导在扎实基础上追求创新突破。资源包包含完整代码、数据及论文资料,支持读者复现结果并进一步开展动态调度等后续研究,对提升电力系统抗灾韧性具有重要的理论与实践价值。; 适合人群:具备电力系统分析、优化建模及Matlab编程基础的科研人员,特别适用于从事电网韧性、应急调度、微电网规划、综合能源系统等方向的硕士、博士研究生及高校研究人员。; 使用场景及目标:① 复现并深入理解SCI一区论文中关于MPS预配置的数学模型与算法实现;② 掌握利用Matlab进行电力系统应急优化仿真与韧性评估的技术方法;③ 探究应急电源空间配置与电网恢复性能间的量化关系,为实际电力系统防灾规划与调度决策提供理论依据和技术支撑。; 阅读建议:建议读者结合提供的网盘资源,按照文档结构循序渐进地学习,重点关注模型构建的物理意义、约束条件设定及Matlab代码的实现细节,务必动手运行与调试代码以加深理解。同时可参考团队发布的其他相关研究,拓展在智能优化算法、鲁棒调度等领域的综合应用能力。
内容概要:本文系统阐述了Private访问控制在芯片设计全生命周期中的实战应用,覆盖设计态、验证态、DFT态到制造态四大阶段,提出基于EDA工具链的四维防护体系。通过Synopsys Design Compiler约束脚本、UVM验证环境私有化配置以及Mentor Tessent DFT私有指令集实现,展示了如何在RTL设计、仿真验证、测试向量生成等关键环节实施精细化访问控制,有效防止IP泄露与非法调试。重点案例包括JTAG私有指令定义、扫描链信号隔离、测试向量AES-256加密及eFuse密钥保护机制,构建从硬件到流程的安全闭环。; 适合人群:从事芯片前端/后端设计、DFT开发、验证工程的技术人员,以及关注集成电路安全的架构师与项目管理人员,具备数字电路设计与EDA工具使用基础者更佳。; 使用场景及目标:①在芯片设计中实现IP核与敏感寄存器的访问隔离;②提升DFT测试安全性,防范通过JTAG接口进行的数据窃取;③构建企业级权限管理体系,支持多团队协作下的安全交付;④满足高安全等级芯片(如加密芯片、AI芯片)的合规性要求。; 阅读建议:此资源强调实战性,建议结合EDA工具实际操作相关脚本(TCL/UVM/SystemVerilog),重点关注私有指令设计、权限绑定与加密策略的集成应用,并在项目中评估安全与可测性的平衡,以实现高效可靠的安全闭环设计。

164

社区成员

发帖
与我相关
我的任务
社区描述
2501_MU_SE_FZU
软件工程 高校
社区管理员
  • FZU_SE_LQF
  • 助教_林日臻
  • 朱仕君
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧