ffmt 0.2.7__tar.gz → 0.3.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {ffmt-0.2.7 → ffmt-0.3.0}/.github/workflows/ci.yml +23 -0
- {ffmt-0.2.7 → ffmt-0.3.0}/.gitignore +1 -0
- ffmt-0.3.0/.markdownlint.json +7 -0
- ffmt-0.3.0/.readthedocs.yml +13 -0
- {ffmt-0.2.7 → ffmt-0.3.0}/Cargo.lock +1 -1
- {ffmt-0.2.7 → ffmt-0.3.0}/Cargo.toml +1 -1
- ffmt-0.3.0/PKG-INFO +109 -0
- ffmt-0.3.0/README.md +91 -0
- ffmt-0.3.0/docs/ci.md +50 -0
- ffmt-0.3.0/docs/configuration.md +499 -0
- ffmt-0.3.0/docs/editors.md +62 -0
- ffmt-0.3.0/docs/getting-started.md +76 -0
- ffmt-0.3.0/docs/index.md +56 -0
- ffmt-0.3.0/docs/requirements.txt +2 -0
- ffmt-0.3.0/mkdocs.yml +42 -0
- {ffmt-0.2.7 → ffmt-0.3.0}/pyproject.toml +1 -1
- {ffmt-0.2.7 → ffmt-0.3.0}/src/align.rs +49 -35
- {ffmt-0.2.7 → ffmt-0.3.0}/src/classifier.rs +56 -17
- {ffmt-0.2.7 → ffmt-0.3.0}/src/cli.rs +30 -36
- {ffmt-0.2.7 → ffmt-0.3.0}/src/config.rs +137 -49
- {ffmt-0.2.7 → ffmt-0.3.0}/src/formatter.rs +1083 -188
- {ffmt-0.2.7 → ffmt-0.3.0}/src/lsp.rs +5 -14
- {ffmt-0.2.7 → ffmt-0.3.0}/src/reader.rs +13 -8
- {ffmt-0.2.7 → ffmt-0.3.0}/src/unicode.rs +21 -21
- {ffmt-0.2.7 → ffmt-0.3.0}/src/whitespace.rs +34 -25
- {ffmt-0.2.7 → ffmt-0.3.0}/tests/case_norm.rs +16 -4
- {ffmt-0.2.7 → ffmt-0.3.0}/tests/classifier.rs +84 -21
- ffmt-0.3.0/tests/config_integration.rs +516 -0
- {ffmt-0.2.7 → ffmt-0.3.0}/tests/fixtures/blank_lines.expected.fpp +0 -1
- {ffmt-0.2.7 → ffmt-0.3.0}/tests/integration.rs +4 -1
- {ffmt-0.2.7 → ffmt-0.3.0}/tests/reader.rs +6 -2
- {ffmt-0.2.7 → ffmt-0.3.0}/tests/whitespace.rs +6 -23
- ffmt-0.2.7/PKG-INFO +0 -211
- ffmt-0.2.7/README.md +0 -193
- ffmt-0.2.7/tests/config_integration.rs +0 -133
- {ffmt-0.2.7 → ffmt-0.3.0}/.github/workflows/release.yml +0 -0
- {ffmt-0.2.7 → ffmt-0.3.0}/.github/workflows/update-readme-version.yml +0 -0
- {ffmt-0.2.7 → ffmt-0.3.0}/.pre-commit-hooks.yaml +0 -0
- {ffmt-0.2.7 → ffmt-0.3.0}/LICENSE +0 -0
- {ffmt-0.2.7 → ffmt-0.3.0}/action.yml +0 -0
- {ffmt-0.2.7 → ffmt-0.3.0}/src/case_norm.rs +0 -0
- {ffmt-0.2.7 → ffmt-0.3.0}/src/keyword_norm.rs +0 -0
- {ffmt-0.2.7 → ffmt-0.3.0}/src/lib.rs +9 -9
- {ffmt-0.2.7 → ffmt-0.3.0}/src/main.rs +0 -0
- {ffmt-0.2.7 → ffmt-0.3.0}/src/scope.rs +0 -0
- {ffmt-0.2.7 → ffmt-0.3.0}/tests/fixtures/blank_lines.input.fpp +0 -0
- {ffmt-0.2.7 → ffmt-0.3.0}/tests/fixtures/call_block.expected.fpp +0 -0
- {ffmt-0.2.7 → ffmt-0.3.0}/tests/fixtures/call_block.input.fpp +0 -0
- {ffmt-0.2.7 → ffmt-0.3.0}/tests/fixtures/directives.expected.fpp +0 -0
- {ffmt-0.2.7 → ffmt-0.3.0}/tests/fixtures/directives.input.fpp +0 -0
- {ffmt-0.2.7 → ffmt-0.3.0}/tests/fixtures/doxygen_spacing.expected.fpp +0 -0
- {ffmt-0.2.7 → ffmt-0.3.0}/tests/fixtures/doxygen_spacing.input.fpp +0 -0
- {ffmt-0.2.7 → ffmt-0.3.0}/tests/fixtures/fypp.expected.fpp +0 -0
- {ffmt-0.2.7 → ffmt-0.3.0}/tests/fixtures/fypp.input.fpp +0 -0
- {ffmt-0.2.7 → ffmt-0.3.0}/tests/fixtures/simple.expected.fpp +0 -0
- {ffmt-0.2.7 → ffmt-0.3.0}/tests/fixtures/simple.input.fpp +0 -0
- {ffmt-0.2.7 → ffmt-0.3.0}/tests/scope.rs +1 -1
|
@@ -12,6 +12,9 @@ jobs:
|
|
|
12
12
|
steps:
|
|
13
13
|
- uses: actions/checkout@v4
|
|
14
14
|
- uses: dtolnay/rust-toolchain@stable
|
|
15
|
+
with:
|
|
16
|
+
components: clippy, rustfmt
|
|
17
|
+
- run: cargo fmt --check
|
|
15
18
|
- run: cargo test
|
|
16
19
|
- run: cargo clippy -- -D warnings
|
|
17
20
|
|
|
@@ -163,6 +166,26 @@ jobs:
|
|
|
163
166
|
JOBS=${{ matrix.target == 'cpu' && '$(nproc)' || '2' }}
|
|
164
167
|
./mfc.sh build -j $JOBS $GPU_FLAG
|
|
165
168
|
|
|
169
|
+
docs:
|
|
170
|
+
name: Documentation
|
|
171
|
+
runs-on: ubuntu-latest
|
|
172
|
+
steps:
|
|
173
|
+
- uses: actions/checkout@v4
|
|
174
|
+
- uses: actions/setup-python@v5
|
|
175
|
+
with:
|
|
176
|
+
python-version: "3.12"
|
|
177
|
+
|
|
178
|
+
- name: Install docs dependencies
|
|
179
|
+
run: pip install mkdocs-material
|
|
180
|
+
|
|
181
|
+
- name: Build documentation
|
|
182
|
+
run: mkdocs build --strict
|
|
183
|
+
|
|
184
|
+
- name: Lint Markdown
|
|
185
|
+
uses: DavidAnson/markdownlint-cli2-action@v19
|
|
186
|
+
with:
|
|
187
|
+
globs: "docs/**/*.md,README.md"
|
|
188
|
+
|
|
166
189
|
build-wheels:
|
|
167
190
|
name: Build wheels (${{ matrix.os }})
|
|
168
191
|
runs-on: ${{ matrix.os }}
|
ffmt-0.3.0/PKG-INFO
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: ffmt
|
|
3
|
+
Version: 0.3.0
|
|
4
|
+
Classifier: Development Status :: 4 - Beta
|
|
5
|
+
Classifier: Intended Audience :: Developers
|
|
6
|
+
Classifier: Intended Audience :: Science/Research
|
|
7
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
8
|
+
Classifier: Programming Language :: Fortran
|
|
9
|
+
Classifier: Programming Language :: Rust
|
|
10
|
+
Classifier: Topic :: Software Development :: Quality Assurance
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Summary: A fast, configurable Fortran formatter with Fypp, Doxygen, and OpenACC/OpenMP support
|
|
13
|
+
Keywords: fortran,formatter,linter,code-quality
|
|
14
|
+
License: MIT
|
|
15
|
+
Requires-Python: >=3.8
|
|
16
|
+
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
|
|
17
|
+
|
|
18
|
+
# ffmt
|
|
19
|
+
|
|
20
|
+
[](https://pypi.org/project/ffmt/)
|
|
21
|
+
[](https://github.com/sbryngelson/ffmt/actions/workflows/ci.yml)
|
|
22
|
+
[](https://opensource.org/licenses/MIT)
|
|
23
|
+
[](https://github.com/marketplace/actions/ffmt-fortran-formatter)
|
|
24
|
+
[](https://ffmt-fortran.readthedocs.io)
|
|
25
|
+
|
|
26
|
+
A fast, configurable Fortran formatter with support for Fypp, Doxygen, and OpenACC/OpenMP directives. Written in Rust. Installable via `pip`.
|
|
27
|
+
|
|
28
|
+
**[Documentation](https://ffmt-fortran.readthedocs.io)** | **[Configuration](https://ffmt-fortran.readthedocs.io/en/latest/configuration/)** | **[Changelog](https://github.com/sbryngelson/ffmt/releases)**
|
|
29
|
+
|
|
30
|
+
## Installation
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
pip install ffmt
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Or via Cargo:
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
cargo install ffmt
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Quick start
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
ffmt src/ # format in-place
|
|
46
|
+
ffmt --check src/ # CI mode (exit 1 if changes needed)
|
|
47
|
+
ffmt --diff src/ # show colored diff
|
|
48
|
+
ffmt -j 8 src/ # parallel
|
|
49
|
+
cat file.fpp | ffmt - # stdin/stdout
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Features
|
|
53
|
+
|
|
54
|
+
- **Code** -- indentation, whitespace normalization, keyword casing, named ends, line wrapping, operator modernization (`.eq.` -> `==`), double-colon enforcement, trailing semicolon removal
|
|
55
|
+
- **Comments** -- rewrapping, inline spacing (S102), `!<` alignment, `!&`/`& !` cleanup, format suppression (`! ffmt off/on`)
|
|
56
|
+
- **Structure** -- blank line management around openers/closers/`#ifdef`, declaration `::` alignment, declaration/use compaction
|
|
57
|
+
- **Preprocessor** -- Fypp (`#:if`, `$:`, `@:`), C preprocessor (`#ifdef`), OpenACC (`!$acc`), OpenMP (`!$omp`)
|
|
58
|
+
- **Opt-in** -- multi-statement splitting, assignment alignment, `&` column alignment, use-statement reformatting
|
|
59
|
+
|
|
60
|
+
Most options accept `true`, `false`, or `"preserve"`. See the [configuration reference](https://ffmt-fortran.readthedocs.io/en/latest/configuration/) for all options.
|
|
61
|
+
|
|
62
|
+
## Configuration
|
|
63
|
+
|
|
64
|
+
Create `ffmt.toml` or add `[tool.ffmt]` to `pyproject.toml`:
|
|
65
|
+
|
|
66
|
+
```toml
|
|
67
|
+
indent-width = 4
|
|
68
|
+
line-length = 132
|
|
69
|
+
keyword-case = "lower"
|
|
70
|
+
modernize-operators = true
|
|
71
|
+
enforce-double-colon = true
|
|
72
|
+
|
|
73
|
+
[whitespace]
|
|
74
|
+
relational = true
|
|
75
|
+
multdiv = false
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## CI
|
|
79
|
+
|
|
80
|
+
```yaml
|
|
81
|
+
# GitHub Actions
|
|
82
|
+
- uses: sbryngelson/ffmt@latest
|
|
83
|
+
with:
|
|
84
|
+
args: "--check src/"
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
```yaml
|
|
88
|
+
# pre-commit
|
|
89
|
+
repos:
|
|
90
|
+
- repo: https://github.com/sbryngelson/ffmt
|
|
91
|
+
rev: v0.2.8
|
|
92
|
+
hooks:
|
|
93
|
+
- id: ffmt
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## Other Fortran formatters
|
|
97
|
+
|
|
98
|
+
| Formatter | Language | Status | Notes |
|
|
99
|
+
|-----------|----------|--------|-------|
|
|
100
|
+
| [fprettify](https://github.com/fortran-lang/fprettify) | Python | Unmaintained | Free-form only. Fypp support. |
|
|
101
|
+
| [findent](https://github.com/wvermin/findent) | C | Active | Indentation and fixed/free conversion. |
|
|
102
|
+
| [Codee Formatter](https://www.codee.com) | Proprietary | Active | Commercial. Tree-sitter based. |
|
|
103
|
+
| [LFortran fmt](https://lfortran.org) | Rust | In development | AST-based. |
|
|
104
|
+
| [Fortitude](https://github.com/PlasmaFAIR/fortitude) | Rust | Active | Linter with auto-fix. |
|
|
105
|
+
|
|
106
|
+
## License
|
|
107
|
+
|
|
108
|
+
MIT
|
|
109
|
+
|
ffmt-0.3.0/README.md
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
# ffmt
|
|
2
|
+
|
|
3
|
+
[](https://pypi.org/project/ffmt/)
|
|
4
|
+
[](https://github.com/sbryngelson/ffmt/actions/workflows/ci.yml)
|
|
5
|
+
[](https://opensource.org/licenses/MIT)
|
|
6
|
+
[](https://github.com/marketplace/actions/ffmt-fortran-formatter)
|
|
7
|
+
[](https://ffmt-fortran.readthedocs.io)
|
|
8
|
+
|
|
9
|
+
A fast, configurable Fortran formatter with support for Fypp, Doxygen, and OpenACC/OpenMP directives. Written in Rust. Installable via `pip`.
|
|
10
|
+
|
|
11
|
+
**[Documentation](https://ffmt-fortran.readthedocs.io)** | **[Configuration](https://ffmt-fortran.readthedocs.io/en/latest/configuration/)** | **[Changelog](https://github.com/sbryngelson/ffmt/releases)**
|
|
12
|
+
|
|
13
|
+
## Installation
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
pip install ffmt
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Or via Cargo:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
cargo install ffmt
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Quick start
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
ffmt src/ # format in-place
|
|
29
|
+
ffmt --check src/ # CI mode (exit 1 if changes needed)
|
|
30
|
+
ffmt --diff src/ # show colored diff
|
|
31
|
+
ffmt -j 8 src/ # parallel
|
|
32
|
+
cat file.fpp | ffmt - # stdin/stdout
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Features
|
|
36
|
+
|
|
37
|
+
- **Code** -- indentation, whitespace normalization, keyword casing, named ends, line wrapping, operator modernization (`.eq.` -> `==`), double-colon enforcement, trailing semicolon removal
|
|
38
|
+
- **Comments** -- rewrapping, inline spacing (S102), `!<` alignment, `!&`/`& !` cleanup, format suppression (`! ffmt off/on`)
|
|
39
|
+
- **Structure** -- blank line management around openers/closers/`#ifdef`, declaration `::` alignment, declaration/use compaction
|
|
40
|
+
- **Preprocessor** -- Fypp (`#:if`, `$:`, `@:`), C preprocessor (`#ifdef`), OpenACC (`!$acc`), OpenMP (`!$omp`)
|
|
41
|
+
- **Opt-in** -- multi-statement splitting, assignment alignment, `&` column alignment, use-statement reformatting
|
|
42
|
+
|
|
43
|
+
Most options accept `true`, `false`, or `"preserve"`. See the [configuration reference](https://ffmt-fortran.readthedocs.io/en/latest/configuration/) for all options.
|
|
44
|
+
|
|
45
|
+
## Configuration
|
|
46
|
+
|
|
47
|
+
Create `ffmt.toml` or add `[tool.ffmt]` to `pyproject.toml`:
|
|
48
|
+
|
|
49
|
+
```toml
|
|
50
|
+
indent-width = 4
|
|
51
|
+
line-length = 132
|
|
52
|
+
keyword-case = "lower"
|
|
53
|
+
modernize-operators = true
|
|
54
|
+
enforce-double-colon = true
|
|
55
|
+
|
|
56
|
+
[whitespace]
|
|
57
|
+
relational = true
|
|
58
|
+
multdiv = false
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## CI
|
|
62
|
+
|
|
63
|
+
```yaml
|
|
64
|
+
# GitHub Actions
|
|
65
|
+
- uses: sbryngelson/ffmt@latest
|
|
66
|
+
with:
|
|
67
|
+
args: "--check src/"
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
```yaml
|
|
71
|
+
# pre-commit
|
|
72
|
+
repos:
|
|
73
|
+
- repo: https://github.com/sbryngelson/ffmt
|
|
74
|
+
rev: v0.2.8
|
|
75
|
+
hooks:
|
|
76
|
+
- id: ffmt
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## Other Fortran formatters
|
|
80
|
+
|
|
81
|
+
| Formatter | Language | Status | Notes |
|
|
82
|
+
|-----------|----------|--------|-------|
|
|
83
|
+
| [fprettify](https://github.com/fortran-lang/fprettify) | Python | Unmaintained | Free-form only. Fypp support. |
|
|
84
|
+
| [findent](https://github.com/wvermin/findent) | C | Active | Indentation and fixed/free conversion. |
|
|
85
|
+
| [Codee Formatter](https://www.codee.com) | Proprietary | Active | Commercial. Tree-sitter based. |
|
|
86
|
+
| [LFortran fmt](https://lfortran.org) | Rust | In development | AST-based. |
|
|
87
|
+
| [Fortitude](https://github.com/PlasmaFAIR/fortitude) | Rust | Active | Linter with auto-fix. |
|
|
88
|
+
|
|
89
|
+
## License
|
|
90
|
+
|
|
91
|
+
MIT
|
ffmt-0.3.0/docs/ci.md
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# CI Integration
|
|
2
|
+
|
|
3
|
+
## GitHub Actions
|
|
4
|
+
|
|
5
|
+
```yaml
|
|
6
|
+
- uses: sbryngelson/ffmt@latest
|
|
7
|
+
with:
|
|
8
|
+
args: "--check src/"
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## pre-commit
|
|
12
|
+
|
|
13
|
+
```yaml
|
|
14
|
+
repos:
|
|
15
|
+
- repo: https://github.com/sbryngelson/ffmt
|
|
16
|
+
rev: v0.2.8
|
|
17
|
+
hooks:
|
|
18
|
+
- id: ffmt
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
To auto-update to the latest version:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
pre-commit autoupdate
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Or use [pre-commit.ci](https://pre-commit.ci/) to update hooks automatically via pull requests.
|
|
28
|
+
|
|
29
|
+
## GitLab CI
|
|
30
|
+
|
|
31
|
+
```yaml
|
|
32
|
+
format:
|
|
33
|
+
image: python:3.12
|
|
34
|
+
script:
|
|
35
|
+
- pip install ffmt
|
|
36
|
+
- ffmt --check src/
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Generic CI
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
pip install ffmt
|
|
43
|
+
ffmt --check src/
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
The `--check` flag exits with code 1 if any files would be changed, making it suitable for CI gates. Use `--diff` to see what would change:
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
ffmt --diff src/
|
|
50
|
+
```
|