3 Star 9 Fork 0

满鉴霆 / formatting

Create your Gitee Account
Explore and code with more than 12 million developers,Free private repositories !:)
Sign up
Clone or Download
contribute
Sync branch
Cancel
Notice: Creating folder will generate an empty file .keep, because not support in Git
Loading...
README
MIT

Formatting 源码格式自动化调整工具

如果喜欢请Star,这是对本开源项目最大的鼓励,谢谢


本文件会自动递归遍历指定文件夹下的所有文件或者指定的文件(默认对.c/.h/.cpp/.hpp,也可以改成你想要的文件类型)进行扫描:

  • 将源文件编码统一为UTF-8

  • 将TAB键替换为4空格

  • 将每行末尾多余的空格删除,并统一换行符为'\n'

  • 将RT-Thread版权信息的截至年份修改至今年(若文件不涉及此问题,程序会自动忽略)

  • 将上海睿赛德版权信息的截至年份修改至今年(若文件不涉及此问题,程序会自动忽略)

安装依赖软件包

pip install -r requirements.txt

使用方法

方法一

直接运行脚本,根据提示信息,输入要扫描的文件夹或者文件名即可。

▸ python formatting.py
Please enter work path or file to format: test_dir

方法二

可以直接在命令行参数中指定需要格式化的文件夹或者文件名

▸ python formatting.py [dir/file_name]

教学视频

https://www.bilibili.com/video/BV1XN411Q7n3

使用协议

本软件为MIT协议,可以自由免费使用,无论是个人目的还是商业目的,但是发现本脚本有任何问题,请提PR协助修复。

The MIT License (MIT) Copyright (c) 2021 Meco Jianting Man Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

About

源码格式自动化调整工具 expand collapse
Cancel

Releases

No release

Contributors

All

Activities

Load More
can not load any more
Python
1
https://gitee.com/mysterywolf/formatting.git
git@gitee.com:mysterywolf/formatting.git
mysterywolf
formatting
formatting
master

Search