FocusFlow β Sprint Code Standards

FOCUS_2025_SE FOCUS_2025_SE 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区

目录

  • 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.

...全文

相关推荐

弱电网下光伏并网逆变器序阻抗建模仿真复现扫频法【序阻抗判断稳定性】

内容概要:本文聚焦于弱电网条件下光伏并网逆变器的序阻抗建模与稳定性分析,系统阐述了基于扫频法的阻抗特性仿真与复现方法。通过构建正负序阻抗模型,深入剖析逆变器在弱电网环境中的动态响应特性,结合锁相环、电流环等关键控制环节对系统阻抗的影响机制,采用序阻抗稳定性判据评估多机并网或复杂电网条件下的系统稳定裕度。研究在Simulink平台中实现激励信号注入、频率响应采集与阻抗曲线绘制,为高比例新能源接入背景下并网系统的稳定性分析提供了可靠的仿真手段与理论支撑,尤其适用于SCI级别论文成果的复现与拓展验证。; 适合人群:电力电子、新能源并网技术及相关领域的硕士/博士研究生、科研人员,以及从事光伏逆变器、微电网稳定控制开发的工程技术人员。; 使用场景及目标:①掌握扫频法在电力电子装置阻抗建模中的具体实施流程;②理解并应用基于序阻抗的稳定性判据进行系统稳定边界分析;③用于高水平学术论文(如SCI期刊)中阻抗建模与稳定性分析部分的仿真复现与方法验证; 阅读建议:建议读者结合文中所述方法与提供的参考文献,自主搭建Simulink仿真模型,逐步完成扰动信号设计、数据采集、傅里叶分析及阻抗拟合全过程,深入探究控制参数变化对系统阻抗特性和稳定性的具体影响,强化理论与实践的融合能力。

欢多天天写代码

三相并网逆变器虚拟阻抗+统一有源阻尼策略SVPWM+SPWM调制仿真

内容概要:本文档系统性地介绍了三相并网逆变器的核心控制技术及其在复杂电网环境下的仿真应用,重点涵盖虚拟阻抗与统一有源阻尼策略在SVPWM和SPWM调制方式下的实现方法,旨在提升逆变器的稳定性与电能质量。内容包括无功功率扰动孤岛检测、中点电位平衡控制、低电压穿越(LVRT)、模型预测控制(MPC)、正负序分离、电网前馈控制等关键技术,并扩展至风储联合调频、微电网下垂控制、虚拟同步发电机(VSG)、构网型逆变器等多种典型电力系统应用场景。所有技术均配有基于Simulink/Matlab平台的完整仿真模型、参考文献及说明文档,强调理论分析与仿真实践的深度融合,突出科研中“借力”与创新思维的重要性。; 适合人群:电气工程、自动化、新能源等相关专业的研究生、科研人员及从事电力电子与可再生能源系统开发的工程师;具备MATLAB/Simulink仿真基础和电力系统专业知识的技术人员。; 使用场景及目标:①开展三相并网逆变器控制策略的研究与优化设计;②复现高水平学术论文中的控制算法;③完成毕业课题、科研项目或工程仿真验证;④掌握虚拟阻抗、有源阻尼、SVPWM/SPWM调制、MPC、VSG等核心技术的建模与实现方法;⑤支撑微电网、构网型变流器等前沿方向的科研攻关。; 阅读建议:建议按照资源目录结构化学习,优先选择与自身研究方向契合的内容模块,结合提供的仿真模型、参考文献和说明材料进行实操演练,注重从理论推导到仿真实现的全过程理解,充分利用共享网盘资源深化技术掌握,提升科研效率与创新能力。

欢多天天写代码

chromedriver-win32-159.0.8133.0(Canary).zip

chromedriver-win32-159.0.8133.0(Canary).zip

LCG元

计算机“101计划”《人工智能引论》教学大纲+课件+实训案例

计算机“101计划”《人工智能引论》教学大纲+课件+实训案例

qq_38220914

语音输入法离线语音输入转文字工具2.0支持双档本地识别模型,中英混说精准转写,纯离线运行保护隐私,让打字更高效.zip

大家好,我是大飞哥。日常打字时,频繁切换输入法、断网无法语音转写、或担心语音数据被传至云端,是许多办公族和内容创作者的共同痛点。这款离线语音输入工具 ,正是为此量身打造的 Windows 桌面语音辅助利器。它的核心使命就是按住快捷键说话,松开文字自动上屏,全程本地离线识别,让您在任何可输入文字的窗口内都能实现高效、私密的语音输入,彻底告别网络依赖与隐私焦虑。 在核心功能上,软件内置了两档本地语音识别模型,通过主界面下拉框即可随时切换。默认的“离线·标准”模式响应极快,支持中英混说且自带标点,非常适合日常聊天与文档撰写;而“离线·精准”模式则对纯中文、方言口音及长段落口述的识别准确度更高。更贴心的是,它具备实时预览与一键取消机制,说话过程中若发现说错,按下 Esc 即可取消,一个字都不会误输入;若目标窗口不支持直接写入,文字会自动存入剪贴板,方便您按 Ctrl+V 粘贴,确保每次发声都不白费。 这款工具在具体场景中的表现十分亮眼。对于办公白领,在填写表格、撰写邮件或使用微信、QQ 沟通时,无需频繁切换窗口,按住右键说话即可快速完成信息录入;对于程序员与文字工作者,在代码编辑器或文档中口述注释与段落,能显著提升创作效率;对于经常出差的商务人士,在飞机、高铁等断网环境下,它依然能稳定工作,不经过任何服务器,真正做到了“说了什么只有自己知道”,私密性极佳。 使用体验方面,软件将极简操作贯彻到底。解压后双击 大飞哥语音输入,右下角托盘出现蓝色话筒图标即代表准备就绪。用户只需将光标点进目标输入框,按住右 Alt说话,说完松开,文字便会自动写入。主界面提供了设置快捷键与开机自动启动选项,方便用户按习惯自定义组合键;关闭主窗口并不会退出程序,而是缩至托盘持续待命,彻底退出只需右键托盘或点击主界面按钮,逻辑清晰,零门槛上手。

大飞哥软件自习室
评论
收藏 已收藏
分享
返回顶部