ffmt 0.3.0__tar.gz → 0.3.1__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 (54) hide show
  1. {ffmt-0.3.0 → ffmt-0.3.1}/.github/workflows/ci.yml +1 -1
  2. {ffmt-0.3.0 → ffmt-0.3.1}/Cargo.lock +1 -1
  3. {ffmt-0.3.0 → ffmt-0.3.1}/Cargo.toml +1 -1
  4. {ffmt-0.3.0 → ffmt-0.3.1}/PKG-INFO +2 -2
  5. {ffmt-0.3.0 → ffmt-0.3.1}/README.md +1 -1
  6. {ffmt-0.3.0 → ffmt-0.3.1}/pyproject.toml +1 -1
  7. {ffmt-0.3.0 → ffmt-0.3.1}/src/formatter.rs +33 -0
  8. {ffmt-0.3.0 → ffmt-0.3.1}/tests/fixtures/simple.expected.fpp +2 -0
  9. {ffmt-0.3.0 → ffmt-0.3.1}/.github/workflows/release.yml +0 -0
  10. {ffmt-0.3.0 → ffmt-0.3.1}/.github/workflows/update-readme-version.yml +0 -0
  11. {ffmt-0.3.0 → ffmt-0.3.1}/.gitignore +0 -0
  12. {ffmt-0.3.0 → ffmt-0.3.1}/.markdownlint.json +0 -0
  13. {ffmt-0.3.0 → ffmt-0.3.1}/.pre-commit-hooks.yaml +0 -0
  14. {ffmt-0.3.0 → ffmt-0.3.1}/.readthedocs.yml +0 -0
  15. {ffmt-0.3.0 → ffmt-0.3.1}/LICENSE +0 -0
  16. {ffmt-0.3.0 → ffmt-0.3.1}/action.yml +0 -0
  17. {ffmt-0.3.0 → ffmt-0.3.1}/docs/ci.md +0 -0
  18. {ffmt-0.3.0 → ffmt-0.3.1}/docs/configuration.md +0 -0
  19. {ffmt-0.3.0 → ffmt-0.3.1}/docs/editors.md +0 -0
  20. {ffmt-0.3.0 → ffmt-0.3.1}/docs/getting-started.md +0 -0
  21. {ffmt-0.3.0 → ffmt-0.3.1}/docs/index.md +0 -0
  22. {ffmt-0.3.0 → ffmt-0.3.1}/docs/requirements.txt +0 -0
  23. {ffmt-0.3.0 → ffmt-0.3.1}/mkdocs.yml +0 -0
  24. {ffmt-0.3.0 → ffmt-0.3.1}/src/align.rs +0 -0
  25. {ffmt-0.3.0 → ffmt-0.3.1}/src/case_norm.rs +0 -0
  26. {ffmt-0.3.0 → ffmt-0.3.1}/src/classifier.rs +0 -0
  27. {ffmt-0.3.0 → ffmt-0.3.1}/src/cli.rs +0 -0
  28. {ffmt-0.3.0 → ffmt-0.3.1}/src/config.rs +0 -0
  29. {ffmt-0.3.0 → ffmt-0.3.1}/src/keyword_norm.rs +0 -0
  30. {ffmt-0.3.0 → ffmt-0.3.1}/src/lib.rs +0 -0
  31. {ffmt-0.3.0 → ffmt-0.3.1}/src/lsp.rs +0 -0
  32. {ffmt-0.3.0 → ffmt-0.3.1}/src/main.rs +0 -0
  33. {ffmt-0.3.0 → ffmt-0.3.1}/src/reader.rs +0 -0
  34. {ffmt-0.3.0 → ffmt-0.3.1}/src/scope.rs +0 -0
  35. {ffmt-0.3.0 → ffmt-0.3.1}/src/unicode.rs +0 -0
  36. {ffmt-0.3.0 → ffmt-0.3.1}/src/whitespace.rs +0 -0
  37. {ffmt-0.3.0 → ffmt-0.3.1}/tests/case_norm.rs +0 -0
  38. {ffmt-0.3.0 → ffmt-0.3.1}/tests/classifier.rs +0 -0
  39. {ffmt-0.3.0 → ffmt-0.3.1}/tests/config_integration.rs +0 -0
  40. {ffmt-0.3.0 → ffmt-0.3.1}/tests/fixtures/blank_lines.expected.fpp +0 -0
  41. {ffmt-0.3.0 → ffmt-0.3.1}/tests/fixtures/blank_lines.input.fpp +0 -0
  42. {ffmt-0.3.0 → ffmt-0.3.1}/tests/fixtures/call_block.expected.fpp +0 -0
  43. {ffmt-0.3.0 → ffmt-0.3.1}/tests/fixtures/call_block.input.fpp +0 -0
  44. {ffmt-0.3.0 → ffmt-0.3.1}/tests/fixtures/directives.expected.fpp +0 -0
  45. {ffmt-0.3.0 → ffmt-0.3.1}/tests/fixtures/directives.input.fpp +0 -0
  46. {ffmt-0.3.0 → ffmt-0.3.1}/tests/fixtures/doxygen_spacing.expected.fpp +0 -0
  47. {ffmt-0.3.0 → ffmt-0.3.1}/tests/fixtures/doxygen_spacing.input.fpp +0 -0
  48. {ffmt-0.3.0 → ffmt-0.3.1}/tests/fixtures/fypp.expected.fpp +0 -0
  49. {ffmt-0.3.0 → ffmt-0.3.1}/tests/fixtures/fypp.input.fpp +0 -0
  50. {ffmt-0.3.0 → ffmt-0.3.1}/tests/fixtures/simple.input.fpp +0 -0
  51. {ffmt-0.3.0 → ffmt-0.3.1}/tests/integration.rs +0 -0
  52. {ffmt-0.3.0 → ffmt-0.3.1}/tests/reader.rs +0 -0
  53. {ffmt-0.3.0 → ffmt-0.3.1}/tests/scope.rs +0 -0
  54. {ffmt-0.3.0 → ffmt-0.3.1}/tests/whitespace.rs +0 -0
@@ -126,7 +126,7 @@ jobs:
126
126
  strategy:
127
127
  fail-fast: false
128
128
  matrix:
129
- target: [cpu, gpu-acc, gpu-omp]
129
+ target: [cpu, gpu-omp]
130
130
  steps:
131
131
  - uses: actions/checkout@v4
132
132
 
@@ -156,7 +156,7 @@ checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f"
156
156
 
157
157
  [[package]]
158
158
  name = "ffmt"
159
- version = "0.3.0"
159
+ version = "0.3.1"
160
160
  dependencies = [
161
161
  "clap",
162
162
  "ignore",
@@ -1,6 +1,6 @@
1
1
  [package]
2
2
  name = "ffmt"
3
- version = "0.3.0"
3
+ version = "0.3.1"
4
4
  edition = "2021"
5
5
  description = "A fast, configurable Fortran formatter with Fypp, Doxygen, and OpenACC/OpenMP support"
6
6
  license = "MIT"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ffmt
3
- Version: 0.3.0
3
+ Version: 0.3.1
4
4
  Classifier: Development Status :: 4 - Beta
5
5
  Classifier: Intended Audience :: Developers
6
6
  Classifier: Intended Audience :: Science/Research
@@ -88,7 +88,7 @@ multdiv = false
88
88
  # pre-commit
89
89
  repos:
90
90
  - repo: https://github.com/sbryngelson/ffmt
91
- rev: v0.2.8
91
+ rev: v0.3.0
92
92
  hooks:
93
93
  - id: ffmt
94
94
  ```
@@ -71,7 +71,7 @@ multdiv = false
71
71
  # pre-commit
72
72
  repos:
73
73
  - repo: https://github.com/sbryngelson/ffmt
74
- rev: v0.2.8
74
+ rev: v0.3.0
75
75
  hooks:
76
76
  - id: ffmt
77
77
  ```
@@ -4,7 +4,7 @@ build-backend = "maturin"
4
4
 
5
5
  [project]
6
6
  name = "ffmt"
7
- version = "0.3.0"
7
+ version = "0.3.1"
8
8
  description = "A fast, configurable Fortran formatter with Fypp, Doxygen, and OpenACC/OpenMP support"
9
9
  license = { text = "MIT" }
10
10
  requires-python = ">=3.8"
@@ -517,6 +517,9 @@ pub fn format_with_config(source: &str, config: &Config, range: Option<(usize, u
517
517
  output_lines = apply(output_lines, &|lines| reformat_use_statements(lines, iw));
518
518
  }
519
519
 
520
+ // Ensure blank line before and after `implicit none`
521
+ output_lines = apply(output_lines, &ensure_implicit_none_spacing);
522
+
520
523
  // Remove blank lines immediately before block closers/continuations
521
524
  output_lines = apply(output_lines, &remove_blanks_before_closers);
522
525
 
@@ -1182,6 +1185,36 @@ fn compact_use_statements(lines: &[String]) -> Vec<String> {
1182
1185
  result
1183
1186
  }
1184
1187
 
1188
+ /// Ensure one blank line before and after `implicit none`.
1189
+ /// The blank line before separates it from `use` statements.
1190
+ /// The blank line after separates it from declarations.
1191
+ fn ensure_implicit_none_spacing(lines: &[String]) -> Vec<String> {
1192
+ let mut result = Vec::with_capacity(lines.len() + 4);
1193
+ for (i, line) in lines.iter().enumerate() {
1194
+ let trimmed = line.trim().to_ascii_lowercase();
1195
+ if trimmed == "implicit none" {
1196
+ // Ensure blank line before (unless at start or already blank)
1197
+ if i > 0 {
1198
+ let prev = result
1199
+ .last()
1200
+ .map(|s: &String| s.trim().is_empty())
1201
+ .unwrap_or(true);
1202
+ if !prev {
1203
+ result.push(String::new());
1204
+ }
1205
+ }
1206
+ result.push(line.clone());
1207
+ // Ensure blank line after (unless next is blank or end)
1208
+ if i + 1 < lines.len() && !lines[i + 1].trim().is_empty() {
1209
+ result.push(String::new());
1210
+ }
1211
+ } else {
1212
+ result.push(line.clone());
1213
+ }
1214
+ }
1215
+ result
1216
+ }
1217
+
1185
1218
  /// Remove blank lines immediately before block closers/continuations
1186
1219
  /// and immediately after block openers.
1187
1220
  fn remove_blanks_before_closers(lines: &[String]) -> Vec<String> {
@@ -1,7 +1,9 @@
1
1
  module m_test
2
2
 
3
3
  use m_types
4
+
4
5
  implicit none
6
+
5
7
  private; public :: s_foo
6
8
  integer :: x
7
9
  real :: y
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes