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.
Files changed (57) hide show
  1. {ffmt-0.2.7 → ffmt-0.3.0}/.github/workflows/ci.yml +23 -0
  2. {ffmt-0.2.7 → ffmt-0.3.0}/.gitignore +1 -0
  3. ffmt-0.3.0/.markdownlint.json +7 -0
  4. ffmt-0.3.0/.readthedocs.yml +13 -0
  5. {ffmt-0.2.7 → ffmt-0.3.0}/Cargo.lock +1 -1
  6. {ffmt-0.2.7 → ffmt-0.3.0}/Cargo.toml +1 -1
  7. ffmt-0.3.0/PKG-INFO +109 -0
  8. ffmt-0.3.0/README.md +91 -0
  9. ffmt-0.3.0/docs/ci.md +50 -0
  10. ffmt-0.3.0/docs/configuration.md +499 -0
  11. ffmt-0.3.0/docs/editors.md +62 -0
  12. ffmt-0.3.0/docs/getting-started.md +76 -0
  13. ffmt-0.3.0/docs/index.md +56 -0
  14. ffmt-0.3.0/docs/requirements.txt +2 -0
  15. ffmt-0.3.0/mkdocs.yml +42 -0
  16. {ffmt-0.2.7 → ffmt-0.3.0}/pyproject.toml +1 -1
  17. {ffmt-0.2.7 → ffmt-0.3.0}/src/align.rs +49 -35
  18. {ffmt-0.2.7 → ffmt-0.3.0}/src/classifier.rs +56 -17
  19. {ffmt-0.2.7 → ffmt-0.3.0}/src/cli.rs +30 -36
  20. {ffmt-0.2.7 → ffmt-0.3.0}/src/config.rs +137 -49
  21. {ffmt-0.2.7 → ffmt-0.3.0}/src/formatter.rs +1083 -188
  22. {ffmt-0.2.7 → ffmt-0.3.0}/src/lsp.rs +5 -14
  23. {ffmt-0.2.7 → ffmt-0.3.0}/src/reader.rs +13 -8
  24. {ffmt-0.2.7 → ffmt-0.3.0}/src/unicode.rs +21 -21
  25. {ffmt-0.2.7 → ffmt-0.3.0}/src/whitespace.rs +34 -25
  26. {ffmt-0.2.7 → ffmt-0.3.0}/tests/case_norm.rs +16 -4
  27. {ffmt-0.2.7 → ffmt-0.3.0}/tests/classifier.rs +84 -21
  28. ffmt-0.3.0/tests/config_integration.rs +516 -0
  29. {ffmt-0.2.7 → ffmt-0.3.0}/tests/fixtures/blank_lines.expected.fpp +0 -1
  30. {ffmt-0.2.7 → ffmt-0.3.0}/tests/integration.rs +4 -1
  31. {ffmt-0.2.7 → ffmt-0.3.0}/tests/reader.rs +6 -2
  32. {ffmt-0.2.7 → ffmt-0.3.0}/tests/whitespace.rs +6 -23
  33. ffmt-0.2.7/PKG-INFO +0 -211
  34. ffmt-0.2.7/README.md +0 -193
  35. ffmt-0.2.7/tests/config_integration.rs +0 -133
  36. {ffmt-0.2.7 → ffmt-0.3.0}/.github/workflows/release.yml +0 -0
  37. {ffmt-0.2.7 → ffmt-0.3.0}/.github/workflows/update-readme-version.yml +0 -0
  38. {ffmt-0.2.7 → ffmt-0.3.0}/.pre-commit-hooks.yaml +0 -0
  39. {ffmt-0.2.7 → ffmt-0.3.0}/LICENSE +0 -0
  40. {ffmt-0.2.7 → ffmt-0.3.0}/action.yml +0 -0
  41. {ffmt-0.2.7 → ffmt-0.3.0}/src/case_norm.rs +0 -0
  42. {ffmt-0.2.7 → ffmt-0.3.0}/src/keyword_norm.rs +0 -0
  43. {ffmt-0.2.7 → ffmt-0.3.0}/src/lib.rs +9 -9
  44. {ffmt-0.2.7 → ffmt-0.3.0}/src/main.rs +0 -0
  45. {ffmt-0.2.7 → ffmt-0.3.0}/src/scope.rs +0 -0
  46. {ffmt-0.2.7 → ffmt-0.3.0}/tests/fixtures/blank_lines.input.fpp +0 -0
  47. {ffmt-0.2.7 → ffmt-0.3.0}/tests/fixtures/call_block.expected.fpp +0 -0
  48. {ffmt-0.2.7 → ffmt-0.3.0}/tests/fixtures/call_block.input.fpp +0 -0
  49. {ffmt-0.2.7 → ffmt-0.3.0}/tests/fixtures/directives.expected.fpp +0 -0
  50. {ffmt-0.2.7 → ffmt-0.3.0}/tests/fixtures/directives.input.fpp +0 -0
  51. {ffmt-0.2.7 → ffmt-0.3.0}/tests/fixtures/doxygen_spacing.expected.fpp +0 -0
  52. {ffmt-0.2.7 → ffmt-0.3.0}/tests/fixtures/doxygen_spacing.input.fpp +0 -0
  53. {ffmt-0.2.7 → ffmt-0.3.0}/tests/fixtures/fypp.expected.fpp +0 -0
  54. {ffmt-0.2.7 → ffmt-0.3.0}/tests/fixtures/fypp.input.fpp +0 -0
  55. {ffmt-0.2.7 → ffmt-0.3.0}/tests/fixtures/simple.expected.fpp +0 -0
  56. {ffmt-0.2.7 → ffmt-0.3.0}/tests/fixtures/simple.input.fpp +0 -0
  57. {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 }}
@@ -1,3 +1,4 @@
1
1
  /target/
2
2
  .ffmt_cache/
3
3
  Cargo.lock
4
+ site/
@@ -0,0 +1,7 @@
1
+ {
2
+ "MD013": false,
3
+ "MD033": false,
4
+ "MD046": false,
5
+ "MD024": false,
6
+ "MD040": false
7
+ }
@@ -0,0 +1,13 @@
1
+ version: 2
2
+
3
+ build:
4
+ os: ubuntu-22.04
5
+ tools:
6
+ python: "3.12"
7
+
8
+ mkdocs:
9
+ configuration: mkdocs.yml
10
+
11
+ python:
12
+ install:
13
+ - requirements: docs/requirements.txt
@@ -156,7 +156,7 @@ checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f"
156
156
 
157
157
  [[package]]
158
158
  name = "ffmt"
159
- version = "0.2.7"
159
+ version = "0.3.0"
160
160
  dependencies = [
161
161
  "clap",
162
162
  "ignore",
@@ -1,6 +1,6 @@
1
1
  [package]
2
2
  name = "ffmt"
3
- version = "0.2.7"
3
+ version = "0.3.0"
4
4
  edition = "2021"
5
5
  description = "A fast, configurable Fortran formatter with Fypp, Doxygen, and OpenACC/OpenMP support"
6
6
  license = "MIT"
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
+ [![PyPI](https://img.shields.io/pypi/v/ffmt.svg)](https://pypi.org/project/ffmt/)
21
+ [![CI](https://github.com/sbryngelson/ffmt/actions/workflows/ci.yml/badge.svg)](https://github.com/sbryngelson/ffmt/actions/workflows/ci.yml)
22
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
23
+ [![GitHub Marketplace](https://img.shields.io/badge/Marketplace-ffmt-blue?logo=github)](https://github.com/marketplace/actions/ffmt-fortran-formatter)
24
+ [![Docs](https://readthedocs.org/projects/ffmt-fortran/badge/?version=latest)](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
+ [![PyPI](https://img.shields.io/pypi/v/ffmt.svg)](https://pypi.org/project/ffmt/)
4
+ [![CI](https://github.com/sbryngelson/ffmt/actions/workflows/ci.yml/badge.svg)](https://github.com/sbryngelson/ffmt/actions/workflows/ci.yml)
5
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
6
+ [![GitHub Marketplace](https://img.shields.io/badge/Marketplace-ffmt-blue?logo=github)](https://github.com/marketplace/actions/ffmt-fortran-formatter)
7
+ [![Docs](https://readthedocs.org/projects/ffmt-fortran/badge/?version=latest)](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
+ ```