wexample-filestate-flutter 0.0.13__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 (25) hide show
  1. wexample_filestate_flutter-0.0.13/PKG-INFO +236 -0
  2. wexample_filestate_flutter-0.0.13/README.md +219 -0
  3. wexample_filestate_flutter-0.0.13/pyproject.toml +82 -0
  4. wexample_filestate_flutter-0.0.13/src/wexample_filestate_flutter/__init__.py +0 -0
  5. wexample_filestate_flutter-0.0.13/src/wexample_filestate_flutter/config_option/__init__.py +0 -0
  6. wexample_filestate_flutter-0.0.13/src/wexample_filestate_flutter/config_option/dart_format_config_option.py +11 -0
  7. wexample_filestate_flutter-0.0.13/src/wexample_filestate_flutter/config_value/__init__.py +0 -0
  8. wexample_filestate_flutter-0.0.13/src/wexample_filestate_flutter/config_value/flutter_config_value.py +27 -0
  9. wexample_filestate_flutter-0.0.13/src/wexample_filestate_flutter/const/__init__.py +0 -0
  10. wexample_filestate_flutter-0.0.13/src/wexample_filestate_flutter/const/flutter_file.py +4 -0
  11. wexample_filestate_flutter-0.0.13/src/wexample_filestate_flutter/file/__init__.py +0 -0
  12. wexample_filestate_flutter-0.0.13/src/wexample_filestate_flutter/file/flutter_file.py +12 -0
  13. wexample_filestate_flutter-0.0.13/src/wexample_filestate_flutter/option/__init__.py +0 -0
  14. wexample_filestate_flutter-0.0.13/src/wexample_filestate_flutter/option/flutter/__init__.py +0 -0
  15. wexample_filestate_flutter-0.0.13/src/wexample_filestate_flutter/option/flutter/abstract_flutter_file_content_option.py +96 -0
  16. wexample_filestate_flutter-0.0.13/src/wexample_filestate_flutter/option/flutter/dart_format_option.py +39 -0
  17. wexample_filestate_flutter-0.0.13/src/wexample_filestate_flutter/option/flutter_option.py +55 -0
  18. wexample_filestate_flutter-0.0.13/src/wexample_filestate_flutter/options_provider/__init__.py +0 -0
  19. wexample_filestate_flutter-0.0.13/src/wexample_filestate_flutter/options_provider/flutter_options_provider.py +22 -0
  20. wexample_filestate_flutter-0.0.13/src/wexample_filestate_flutter/py.typed +0 -0
  21. wexample_filestate_flutter-0.0.13/src/wexample_filestate_flutter/resources/__init__.py +0 -0
  22. wexample_filestate_flutter-0.0.13/src/wexample_filestate_flutter/resources/docker/Dockerfile.flutter-option +11 -0
  23. wexample_filestate_flutter-0.0.13/src/wexample_filestate_flutter/resources/docker/__init__.py +0 -0
  24. wexample_filestate_flutter-0.0.13/src/wexample_filestate_flutter/resources/docker/analysis_options.yaml +151 -0
  25. wexample_filestate_flutter-0.0.13/tests/.gitkeep +0 -0
@@ -0,0 +1,236 @@
1
+ Metadata-Version: 2.1
2
+ Name: wexample-filestate-flutter
3
+ Version: 0.0.13
4
+ Author-Email: weeger <contact@wexample.com>
5
+ License: MIT
6
+ Classifier: Programming Language :: Python :: 3
7
+ Classifier: License :: OSI Approved :: MIT License
8
+ Classifier: Operating System :: OS Independent
9
+ Requires-Python: >=3.10
10
+ Requires-Dist: attrs>=23.1.0
11
+ Requires-Dist: cattrs>=23.1.0
12
+ Requires-Dist: wexample-filestate==0.0.72
13
+ Provides-Extra: dev
14
+ Requires-Dist: pytest; extra == "dev"
15
+ Requires-Dist: pytest-cov; extra == "dev"
16
+ Description-Content-Type: text/markdown
17
+
18
+ # wexample-filestate-flutter
19
+
20
+ Version: 0.0.13
21
+
22
+ ## Table of Contents
23
+
24
+ - [Status Compatibility](#status-compatibility)
25
+ - [Api Reference](#api-reference)
26
+ - [Tests](#tests)
27
+ - [Code Quality](#code-quality)
28
+ - [Versioning](#versioning)
29
+ - [Changelog](#changelog)
30
+ - [Migration Notes](#migration-notes)
31
+ - [Roadmap](#roadmap)
32
+ - [Security](#security)
33
+ - [Privacy](#privacy)
34
+ - [Support](#support)
35
+ - [Contribution Guidelines](#contribution-guidelines)
36
+ - [Maintainers](#maintainers)
37
+ - [License](#license)
38
+ - [Useful Links](#useful-links)
39
+ - [Suite Integration](#suite-integration)
40
+ - [Compatibility Matrix](#compatibility-matrix)
41
+ - [Dependencies](#dependencies)
42
+ - [Suite Signature](#suite-signature)
43
+
44
+
45
+ ## Status & Compatibility
46
+
47
+ **Maturity**: Production-ready
48
+
49
+ **Python Support**: >=3.10
50
+
51
+ **OS Support**: Linux, macOS, Windows
52
+
53
+ **Status**: Actively maintained
54
+
55
+ ## API Reference
56
+
57
+ Full API documentation is available in the source code docstrings.
58
+
59
+ Key modules and classes are documented with type hints for better IDE support.
60
+
61
+ ## Tests
62
+
63
+ This project uses `pytest` for testing and `pytest-cov` for code coverage analysis.
64
+
65
+ ### Installation
66
+
67
+ First, install the required testing dependencies:
68
+ ```bash
69
+ .venv/bin/python -m pip install pytest pytest-cov
70
+ ```
71
+
72
+ ### Basic Usage
73
+
74
+ Run all tests with coverage:
75
+ ```bash
76
+ .venv/bin/python -m pytest --cov --cov-report=html
77
+ ```
78
+
79
+ ### Common Commands
80
+ ```bash
81
+ # Run tests with coverage for a specific module
82
+ .venv/bin/python -m pytest --cov=your_module
83
+
84
+ # Show which lines are not covered
85
+ .venv/bin/python -m pytest --cov=your_module --cov-report=term-missing
86
+
87
+ # Generate an HTML coverage report
88
+ .venv/bin/python -m pytest --cov=your_module --cov-report=html
89
+
90
+ # Combine terminal and HTML reports
91
+ .venv/bin/python -m pytest --cov=your_module --cov-report=term-missing --cov-report=html
92
+
93
+ # Run specific test file with coverage
94
+ .venv/bin/python -m pytest tests/test_file.py --cov=your_module --cov-report=term-missing
95
+ ```
96
+
97
+ ### Viewing HTML Reports
98
+
99
+ After generating an HTML report, open `htmlcov/index.html` in your browser to view detailed line-by-line coverage information.
100
+
101
+ ### Coverage Threshold
102
+
103
+ To enforce a minimum coverage percentage:
104
+ ```bash
105
+ .venv/bin/python -m pytest --cov=your_module --cov-fail-under=80
106
+ ```
107
+
108
+ This will cause the test suite to fail if coverage drops below 80%.
109
+
110
+ ## Code Quality & Typing
111
+
112
+ All the suite packages follow strict quality standards:
113
+
114
+ - **Type hints**: Full type coverage with mypy validation
115
+ - **Code formatting**: Enforced with black and isort
116
+ - **Linting**: Comprehensive checks with custom scripts and tools
117
+ - **Testing**: High test coverage requirements
118
+
119
+ These standards ensure reliability and maintainability across the suite.
120
+
121
+ ## Versioning & Compatibility Policy
122
+
123
+ Wexample packages follow **Semantic Versioning** (SemVer):
124
+
125
+ - **MAJOR**: Breaking changes
126
+ - **MINOR**: New features, backward compatible
127
+ - **PATCH**: Bug fixes, backward compatible
128
+
129
+ We maintain backward compatibility within major versions and provide clear migration guides for breaking changes.
130
+
131
+ ## Changelog
132
+
133
+ See [CHANGELOG.md](CHANGELOG.md) for detailed version history and release notes.
134
+
135
+ Major changes are documented with migration guides when applicable.
136
+
137
+ ## Migration Notes
138
+
139
+ When upgrading between major versions, refer to the migration guides in the documentation.
140
+
141
+ Breaking changes are clearly documented with upgrade paths and examples.
142
+
143
+ ## Known Limitations & Roadmap
144
+
145
+ Current limitations and planned features are tracked in the GitHub issues.
146
+
147
+ See the [project roadmap](https://github.com/wexample/python-filestate_flutter/issues) for upcoming features and improvements.
148
+
149
+ ## Security Policy
150
+
151
+ ### Reporting Vulnerabilities
152
+
153
+ If you discover a security vulnerability, please email contact@wexample.com.
154
+
155
+ **Do not** open public issues for security vulnerabilities.
156
+
157
+ We take security seriously and will respond promptly to verified reports.
158
+
159
+ ## Privacy & Telemetry
160
+
161
+ This package does **not** collect any telemetry or usage data.
162
+
163
+ Your privacy is respected — no data is transmitted to external services.
164
+
165
+ ## Support Channels
166
+
167
+ - **GitHub Issues**: Bug reports and feature requests
168
+ - **GitHub Discussions**: Questions and community support
169
+ - **Documentation**: Comprehensive guides and API reference
170
+ - **Email**: contact@wexample.com for general inquiries
171
+
172
+ Community support is available through GitHub Discussions.
173
+
174
+ ## Contribution Guidelines
175
+
176
+ We welcome contributions to the Wexample suite!
177
+
178
+ ### How to Contribute
179
+
180
+ 1. **Fork** the repository
181
+ 2. **Create** a feature branch
182
+ 3. **Make** your changes
183
+ 4. **Test** thoroughly
184
+ 5. **Submit** a pull request
185
+
186
+ ## Maintainers & Authors
187
+
188
+ Maintained by the Wexample team and community contributors.
189
+
190
+ See [CONTRIBUTORS.md](CONTRIBUTORS.md) for the full list of contributors.
191
+
192
+ ## License
193
+
194
+ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
195
+
196
+ Free to use in both personal and commercial projects.
197
+
198
+ ## Useful Links
199
+
200
+ - **Homepage**: https://github.com/wexample/python-filestate-flutter
201
+ - **Documentation**: [docs.wexample.com](https://docs.wexample.com)
202
+ - **Issue Tracker**: https://github.com/wexample/python-filestate-flutter/issues
203
+ - **Discussions**: https://github.com/wexample/python-filestate-flutter/discussions
204
+ - **PyPI**: [pypi.org/project/wexample-filestate-flutter](https://pypi.org/project/wexample-filestate-flutter/)
205
+
206
+ ## Integration in the Suite
207
+
208
+ This package is part of the **Wexample Suite** — a collection of high-quality Python packages designed to work seamlessly together.
209
+
210
+ ### Related Packages
211
+
212
+ The suite includes packages for configuration management, file handling, prompts, and more. Each package can be used independently or as part of the integrated suite.
213
+
214
+ Visit the [Wexample Suite documentation](https://docs.wexample.com) for the complete package ecosystem.
215
+
216
+ ## Compatibility Matrix
217
+
218
+ This package is part of the Wexample suite and is compatible with other suite packages.
219
+
220
+ Refer to each package's documentation for specific version compatibility requirements.
221
+
222
+ ## Dependencies
223
+
224
+ - attrs: >=23.1.0
225
+ - cattrs: >=23.1.0
226
+ - wexample-filestate: ==0.0.72
227
+
228
+
229
+ # About us
230
+
231
+ [Wexample](https://wexample.com) stands as a cornerstone of the digital ecosystem — a collective of seasoned engineers, researchers, and creators driven by a relentless pursuit of technological excellence. More than a media platform, it has grown into a vibrant community where innovation meets craftsmanship, and where every line of code reflects a commitment to clarity, durability, and shared intelligence.
232
+
233
+ This packages suite embodies this spirit. Trusted by professionals and enthusiasts alike, it delivers a consistent, high-quality foundation for modern development — open, elegant, and battle-tested. Its reputation is built on years of collaboration, refinement, and rigorous attention to detail, making it a natural choice for those who demand both robustness and beauty in their tools.
234
+
235
+ Wexample cultivates a culture of mastery. Each package, each contribution carries the mark of a community that values precision, ethics, and innovation — a community proud to shape the future of digital craftsmanship.
236
+
@@ -0,0 +1,219 @@
1
+ # wexample-filestate-flutter
2
+
3
+ Version: 0.0.13
4
+
5
+ ## Table of Contents
6
+
7
+ - [Status Compatibility](#status-compatibility)
8
+ - [Api Reference](#api-reference)
9
+ - [Tests](#tests)
10
+ - [Code Quality](#code-quality)
11
+ - [Versioning](#versioning)
12
+ - [Changelog](#changelog)
13
+ - [Migration Notes](#migration-notes)
14
+ - [Roadmap](#roadmap)
15
+ - [Security](#security)
16
+ - [Privacy](#privacy)
17
+ - [Support](#support)
18
+ - [Contribution Guidelines](#contribution-guidelines)
19
+ - [Maintainers](#maintainers)
20
+ - [License](#license)
21
+ - [Useful Links](#useful-links)
22
+ - [Suite Integration](#suite-integration)
23
+ - [Compatibility Matrix](#compatibility-matrix)
24
+ - [Dependencies](#dependencies)
25
+ - [Suite Signature](#suite-signature)
26
+
27
+
28
+ ## Status & Compatibility
29
+
30
+ **Maturity**: Production-ready
31
+
32
+ **Python Support**: >=3.10
33
+
34
+ **OS Support**: Linux, macOS, Windows
35
+
36
+ **Status**: Actively maintained
37
+
38
+ ## API Reference
39
+
40
+ Full API documentation is available in the source code docstrings.
41
+
42
+ Key modules and classes are documented with type hints for better IDE support.
43
+
44
+ ## Tests
45
+
46
+ This project uses `pytest` for testing and `pytest-cov` for code coverage analysis.
47
+
48
+ ### Installation
49
+
50
+ First, install the required testing dependencies:
51
+ ```bash
52
+ .venv/bin/python -m pip install pytest pytest-cov
53
+ ```
54
+
55
+ ### Basic Usage
56
+
57
+ Run all tests with coverage:
58
+ ```bash
59
+ .venv/bin/python -m pytest --cov --cov-report=html
60
+ ```
61
+
62
+ ### Common Commands
63
+ ```bash
64
+ # Run tests with coverage for a specific module
65
+ .venv/bin/python -m pytest --cov=your_module
66
+
67
+ # Show which lines are not covered
68
+ .venv/bin/python -m pytest --cov=your_module --cov-report=term-missing
69
+
70
+ # Generate an HTML coverage report
71
+ .venv/bin/python -m pytest --cov=your_module --cov-report=html
72
+
73
+ # Combine terminal and HTML reports
74
+ .venv/bin/python -m pytest --cov=your_module --cov-report=term-missing --cov-report=html
75
+
76
+ # Run specific test file with coverage
77
+ .venv/bin/python -m pytest tests/test_file.py --cov=your_module --cov-report=term-missing
78
+ ```
79
+
80
+ ### Viewing HTML Reports
81
+
82
+ After generating an HTML report, open `htmlcov/index.html` in your browser to view detailed line-by-line coverage information.
83
+
84
+ ### Coverage Threshold
85
+
86
+ To enforce a minimum coverage percentage:
87
+ ```bash
88
+ .venv/bin/python -m pytest --cov=your_module --cov-fail-under=80
89
+ ```
90
+
91
+ This will cause the test suite to fail if coverage drops below 80%.
92
+
93
+ ## Code Quality & Typing
94
+
95
+ All the suite packages follow strict quality standards:
96
+
97
+ - **Type hints**: Full type coverage with mypy validation
98
+ - **Code formatting**: Enforced with black and isort
99
+ - **Linting**: Comprehensive checks with custom scripts and tools
100
+ - **Testing**: High test coverage requirements
101
+
102
+ These standards ensure reliability and maintainability across the suite.
103
+
104
+ ## Versioning & Compatibility Policy
105
+
106
+ Wexample packages follow **Semantic Versioning** (SemVer):
107
+
108
+ - **MAJOR**: Breaking changes
109
+ - **MINOR**: New features, backward compatible
110
+ - **PATCH**: Bug fixes, backward compatible
111
+
112
+ We maintain backward compatibility within major versions and provide clear migration guides for breaking changes.
113
+
114
+ ## Changelog
115
+
116
+ See [CHANGELOG.md](CHANGELOG.md) for detailed version history and release notes.
117
+
118
+ Major changes are documented with migration guides when applicable.
119
+
120
+ ## Migration Notes
121
+
122
+ When upgrading between major versions, refer to the migration guides in the documentation.
123
+
124
+ Breaking changes are clearly documented with upgrade paths and examples.
125
+
126
+ ## Known Limitations & Roadmap
127
+
128
+ Current limitations and planned features are tracked in the GitHub issues.
129
+
130
+ See the [project roadmap](https://github.com/wexample/python-filestate_flutter/issues) for upcoming features and improvements.
131
+
132
+ ## Security Policy
133
+
134
+ ### Reporting Vulnerabilities
135
+
136
+ If you discover a security vulnerability, please email contact@wexample.com.
137
+
138
+ **Do not** open public issues for security vulnerabilities.
139
+
140
+ We take security seriously and will respond promptly to verified reports.
141
+
142
+ ## Privacy & Telemetry
143
+
144
+ This package does **not** collect any telemetry or usage data.
145
+
146
+ Your privacy is respected — no data is transmitted to external services.
147
+
148
+ ## Support Channels
149
+
150
+ - **GitHub Issues**: Bug reports and feature requests
151
+ - **GitHub Discussions**: Questions and community support
152
+ - **Documentation**: Comprehensive guides and API reference
153
+ - **Email**: contact@wexample.com for general inquiries
154
+
155
+ Community support is available through GitHub Discussions.
156
+
157
+ ## Contribution Guidelines
158
+
159
+ We welcome contributions to the Wexample suite!
160
+
161
+ ### How to Contribute
162
+
163
+ 1. **Fork** the repository
164
+ 2. **Create** a feature branch
165
+ 3. **Make** your changes
166
+ 4. **Test** thoroughly
167
+ 5. **Submit** a pull request
168
+
169
+ ## Maintainers & Authors
170
+
171
+ Maintained by the Wexample team and community contributors.
172
+
173
+ See [CONTRIBUTORS.md](CONTRIBUTORS.md) for the full list of contributors.
174
+
175
+ ## License
176
+
177
+ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
178
+
179
+ Free to use in both personal and commercial projects.
180
+
181
+ ## Useful Links
182
+
183
+ - **Homepage**: https://github.com/wexample/python-filestate-flutter
184
+ - **Documentation**: [docs.wexample.com](https://docs.wexample.com)
185
+ - **Issue Tracker**: https://github.com/wexample/python-filestate-flutter/issues
186
+ - **Discussions**: https://github.com/wexample/python-filestate-flutter/discussions
187
+ - **PyPI**: [pypi.org/project/wexample-filestate-flutter](https://pypi.org/project/wexample-filestate-flutter/)
188
+
189
+ ## Integration in the Suite
190
+
191
+ This package is part of the **Wexample Suite** — a collection of high-quality Python packages designed to work seamlessly together.
192
+
193
+ ### Related Packages
194
+
195
+ The suite includes packages for configuration management, file handling, prompts, and more. Each package can be used independently or as part of the integrated suite.
196
+
197
+ Visit the [Wexample Suite documentation](https://docs.wexample.com) for the complete package ecosystem.
198
+
199
+ ## Compatibility Matrix
200
+
201
+ This package is part of the Wexample suite and is compatible with other suite packages.
202
+
203
+ Refer to each package's documentation for specific version compatibility requirements.
204
+
205
+ ## Dependencies
206
+
207
+ - attrs: >=23.1.0
208
+ - cattrs: >=23.1.0
209
+ - wexample-filestate: ==0.0.72
210
+
211
+
212
+ # About us
213
+
214
+ [Wexample](https://wexample.com) stands as a cornerstone of the digital ecosystem — a collective of seasoned engineers, researchers, and creators driven by a relentless pursuit of technological excellence. More than a media platform, it has grown into a vibrant community where innovation meets craftsmanship, and where every line of code reflects a commitment to clarity, durability, and shared intelligence.
215
+
216
+ This packages suite embodies this spirit. Trusted by professionals and enthusiasts alike, it delivers a consistent, high-quality foundation for modern development — open, elegant, and battle-tested. Its reputation is built on years of collaboration, refinement, and rigorous attention to detail, making it a natural choice for those who demand both robustness and beauty in their tools.
217
+
218
+ Wexample cultivates a culture of mastery. Each package, each contribution carries the mark of a community that values precision, ethics, and innovation — a community proud to shape the future of digital craftsmanship.
219
+
@@ -0,0 +1,82 @@
1
+ [build-system]
2
+ requires = [
3
+ "pdm-backend",
4
+ ]
5
+ build-backend = "pdm.backend"
6
+
7
+ [project]
8
+ name = "wexample-filestate-flutter"
9
+ version = "0.0.13"
10
+ authors = [
11
+ { name = "weeger", email = "contact@wexample.com" },
12
+ ]
13
+ requires-python = ">=3.10"
14
+ classifiers = [
15
+ "Programming Language :: Python :: 3",
16
+ "License :: OSI Approved :: MIT License",
17
+ "Operating System :: OS Independent",
18
+ ]
19
+ dependencies = [
20
+ "attrs>=23.1.0",
21
+ "cattrs>=23.1.0",
22
+ "wexample-filestate==0.0.72",
23
+ ]
24
+
25
+ [project.readme]
26
+ file = "README.md"
27
+ content-type = "text/markdown"
28
+
29
+ [project.license]
30
+ text = "MIT"
31
+
32
+ [project.optional-dependencies]
33
+ dev = [
34
+ "pytest",
35
+ "pytest-cov",
36
+ ]
37
+
38
+ [tool.setuptools.packages.find]
39
+ include = [
40
+ "*",
41
+ ]
42
+ exclude = [
43
+ "wexample_filestate_flutter.testing*",
44
+ ]
45
+
46
+ [tool.pdm]
47
+ distribution = true
48
+
49
+ [tool.pdm.build]
50
+ package-dir = "src"
51
+ packages = [
52
+ { include = "wexample_filestate_flutter", from = "src" },
53
+ ]
54
+
55
+ [tool.pytest.ini_options]
56
+ testpaths = [
57
+ "tests",
58
+ ]
59
+ pythonpath = [
60
+ "src",
61
+ ]
62
+
63
+ [tool.coverage.run]
64
+ source = [
65
+ "wexample_filestate_flutter",
66
+ ]
67
+ omit = [
68
+ "*/tests/*",
69
+ "*/.venv/*",
70
+ "*/venv/*",
71
+ ]
72
+
73
+ [tool.coverage.report]
74
+ exclude_lines = [
75
+ "pragma: no cover",
76
+ "def __repr__",
77
+ "raise AssertionError",
78
+ "raise NotImplementedError",
79
+ "if __name__ == .__main__.:",
80
+ "if TYPE_CHECKING:",
81
+ "@abstractmethod",
82
+ ]
@@ -0,0 +1,11 @@
1
+ from __future__ import annotations
2
+
3
+ from wexample_config.config_option.abstract_config_option import AbstractConfigOption
4
+ from wexample_helpers.decorator.base_class import base_class
5
+
6
+
7
+ @base_class
8
+ class DartFormatConfigOption(AbstractConfigOption):
9
+ @staticmethod
10
+ def get_name() -> str:
11
+ return "dart_format"
@@ -0,0 +1,27 @@
1
+ from __future__ import annotations
2
+
3
+ from typing import Any
4
+
5
+ from wexample_config.config_value.config_value import ConfigValue
6
+ from wexample_helpers.classes.field import public_field
7
+ from wexample_helpers.decorator.base_class import base_class
8
+
9
+
10
+ @base_class
11
+ class FlutterConfigValue(ConfigValue):
12
+ dart_format: bool | None = public_field(
13
+ default=None,
14
+ description="Format and fix Dart/Flutter code using dart format and dart fix",
15
+ )
16
+ raw: Any = public_field(
17
+ default=None, description="Disabled raw value for this config."
18
+ )
19
+
20
+ def to_option_raw_value(self) -> Any:
21
+ from wexample_filestate_flutter.config_option.dart_format_config_option import (
22
+ DartFormatConfigOption,
23
+ )
24
+
25
+ return {
26
+ DartFormatConfigOption.get_name(): self.dart_format,
27
+ }
@@ -0,0 +1,4 @@
1
+ from __future__ import annotations
2
+
3
+ FLUTTER_FILE_EXTENSIONS = [".dart"]
4
+ FLUTTER_FILE_EXTENSION = ".dart"
@@ -0,0 +1,12 @@
1
+ from __future__ import annotations
2
+
3
+ from typing import ClassVar
4
+
5
+ from wexample_filestate.item.item_target_file import ItemTargetFile
6
+
7
+
8
+ class FlutterFile(ItemTargetFile):
9
+ EXTENSION_ENV: ClassVar[str] = "dart"
10
+
11
+ def _expected_file_name_extension(self) -> str | None:
12
+ return FlutterFile.EXTENSION_ENV
@@ -0,0 +1,96 @@
1
+ from __future__ import annotations
2
+
3
+ from pathlib import Path
4
+ from typing import TYPE_CHECKING, ClassVar
5
+
6
+ from wexample_filestate.option.abstract_file_content_option import (
7
+ AbstractFileContentOption,
8
+ )
9
+ from wexample_filestate.option.mixin.with_docker_option_mixin import (
10
+ WithDockerOptionMixin,
11
+ )
12
+ from wexample_helpers.decorator.base_class import base_class
13
+
14
+ if TYPE_CHECKING:
15
+ from wexample_filestate.const.types_state_items import TargetFileOrDirectoryType
16
+
17
+
18
+ @base_class
19
+ class AbstractFlutterFileContentOption(
20
+ WithDockerOptionMixin, AbstractFileContentOption
21
+ ):
22
+ _CONTAINER_ROOT: ClassVar[str] = "/var/www/html"
23
+ # Avoid re-running flutter pub get for every file during the same Python process
24
+ _prepared_roots: ClassVar[set[str]] = set()
25
+
26
+ def _cleanup_host_cache(self, target: TargetFileOrDirectoryType) -> None:
27
+ """Remove host-generated Dart cache files that contain absolute paths.
28
+
29
+ These caches often point to the host's pub cache (e.g., /home/<user>/.pub-cache)
30
+ and break inside the container, so we wipe them before running commands there.
31
+ """
32
+ import shutil
33
+
34
+ root_path = target.get_root().get_path()
35
+
36
+ dart_tool = root_path / ".dart_tool"
37
+ if dart_tool.exists():
38
+ shutil.rmtree(dart_tool, ignore_errors=True)
39
+
40
+ packages_file = root_path / ".packages"
41
+ if packages_file.exists():
42
+ packages_file.unlink(missing_ok=True)
43
+
44
+ def _get_docker_image_name(self) -> str:
45
+ """Return the Docker image name for Flutter options."""
46
+ return "wex-flutter-option"
47
+
48
+ def _get_dockerfile_path(self) -> Path:
49
+ """Return the path to the Flutter Dockerfile."""
50
+ # Get the path relative to this file
51
+ current_file = Path(__file__)
52
+ package_root = current_file.parent.parent.parent
53
+ return package_root / "resources" / "docker" / "Dockerfile.flutter-option"
54
+
55
+ def _prepare_container_environment(self, target: TargetFileOrDirectoryType) -> None:
56
+ """Ensure caches are clean and dependencies are resolved inside the container."""
57
+ root_key = str(target.get_root().get_path().resolve())
58
+ if root_key in self._prepared_roots:
59
+ return
60
+
61
+ # Remove host-specific cache artifacts first
62
+ self._cleanup_host_cache(target)
63
+
64
+ # Make sure the container exists before running pub get
65
+ self._ensure_docker_container(target)
66
+
67
+ # Re-install dependencies inside the container to regenerate package_config with container paths.
68
+ # Prefer flutter pub when available (flutter SDK projects), otherwise fall back to dart pub.
69
+ self._execute_in_docker(
70
+ target=target,
71
+ command=[
72
+ "bash",
73
+ "-lc",
74
+ "export PATH=/usr/local/flutter/bin:/usr/lib/dart/bin:$PATH && "
75
+ f"cd {self._CONTAINER_ROOT} && "
76
+ "if command -v flutter >/dev/null 2>&1; then "
77
+ "flutter pub get; "
78
+ "else "
79
+ "dart pub get; "
80
+ "fi",
81
+ ],
82
+ )
83
+ self._prepared_roots.add(root_key)
84
+
85
+ def _run_from_container_root(
86
+ self, target: TargetFileOrDirectoryType, shell_command: str
87
+ ) -> str:
88
+ """Helper to run a shell command from the project root inside the container."""
89
+ return self._execute_in_docker(
90
+ target=target,
91
+ command=[
92
+ "bash",
93
+ "-lc",
94
+ f"export PATH=/usr/local/flutter/bin:/usr/lib/dart/bin:$PATH && cd {self._CONTAINER_ROOT} && {shell_command}",
95
+ ],
96
+ )
@@ -0,0 +1,39 @@
1
+ from __future__ import annotations
2
+
3
+ from typing import TYPE_CHECKING
4
+
5
+ from wexample_helpers.decorator.base_class import base_class
6
+
7
+ from .abstract_flutter_file_content_option import AbstractFlutterFileContentOption
8
+
9
+ if TYPE_CHECKING:
10
+ from wexample_filestate.const.types_state_items import TargetFileOrDirectoryType
11
+
12
+
13
+ @base_class
14
+ class DartFormatOption(AbstractFlutterFileContentOption):
15
+ def get_description(self) -> str:
16
+ return "Format and fix Dart/Flutter code using dart format and dart fix."
17
+
18
+ def _apply_content_change(self, target: TargetFileOrDirectoryType) -> str:
19
+ """Format and fix Dart/Flutter code using dart format and dart fix via Docker."""
20
+ # Clean host caches and ensure dependencies are resolved inside the container
21
+ self._prepare_container_environment(target)
22
+
23
+ # Get the file path inside the container
24
+ container_file_path = self._get_container_file_path(target)
25
+
26
+ # First, apply dart fix to auto-fix issues
27
+ self._run_from_container_root(
28
+ target=target,
29
+ shell_command=f"dart fix --apply {container_file_path}",
30
+ )
31
+
32
+ # Then, format the code
33
+ self._run_from_container_root(
34
+ target=target,
35
+ shell_command=f"dart format {container_file_path}",
36
+ )
37
+
38
+ # Read the fixed and formatted content from the file (it was modified in place)
39
+ return target.read_text()
@@ -0,0 +1,55 @@
1
+ from __future__ import annotations
2
+
3
+ from typing import TYPE_CHECKING, Any, Union
4
+
5
+ from wexample_config.config_option.abstract_config_option import AbstractConfigOption
6
+ from wexample_config.config_option.abstract_nested_config_option import (
7
+ AbstractNestedConfigOption,
8
+ )
9
+ from wexample_filestate.enum.scopes import Scope
10
+ from wexample_filestate.operation.abstract_operation import AbstractOperation
11
+ from wexample_filestate.option.mixin.option_mixin import OptionMixin
12
+ from wexample_filestate.option.mixin.with_docker_option_mixin import (
13
+ WithDockerOptionMixin,
14
+ )
15
+ from wexample_helpers.decorator.base_class import base_class
16
+
17
+ if TYPE_CHECKING:
18
+ from wexample_filestate.const.types_state_items import TargetFileOrDirectoryType
19
+
20
+
21
+ @base_class
22
+ class FlutterOption(OptionMixin, WithDockerOptionMixin, AbstractNestedConfigOption):
23
+ @staticmethod
24
+ def get_raw_value_allowed_type() -> Any:
25
+ from wexample_filestate_flutter.config_value.flutter_config_value import (
26
+ FlutterConfigValue,
27
+ )
28
+
29
+ return Union[list[str], dict, FlutterConfigValue]
30
+
31
+ def create_required_operation(
32
+ self, target: TargetFileOrDirectoryType, scopes: set[Scope]
33
+ ) -> AbstractOperation | None:
34
+ return self._create_child_required_operation(target=target, scopes=scopes)
35
+
36
+ def get_allowed_options(self) -> list[type[AbstractConfigOption]]:
37
+ # Import all the config options for each Flutter operation
38
+ from wexample_filestate_flutter.option.flutter.dart_format_option import (
39
+ DartFormatOption,
40
+ )
41
+
42
+ return [
43
+ # filestate: flutter-iterable-sort
44
+ DartFormatOption,
45
+ ]
46
+
47
+ def set_value(self, raw_value: Any) -> None:
48
+ # Convert list form to dict form for consistency
49
+ if isinstance(raw_value, list):
50
+ dict_value = {}
51
+ for option_name in raw_value:
52
+ dict_value[option_name] = True
53
+ raw_value = dict_value
54
+
55
+ super().set_value(raw_value=raw_value)
@@ -0,0 +1,22 @@
1
+ from __future__ import annotations
2
+
3
+ from typing import TYPE_CHECKING
4
+
5
+ from wexample_config.options_provider.abstract_options_provider import (
6
+ AbstractOptionsProvider,
7
+ )
8
+
9
+ if TYPE_CHECKING:
10
+ from wexample_config.config_option.abstract_config_option import (
11
+ AbstractConfigOption,
12
+ )
13
+
14
+
15
+ class FlutterOptionsProvider(AbstractOptionsProvider):
16
+ @classmethod
17
+ def get_options(cls) -> list[type[AbstractConfigOption]]:
18
+ from wexample_filestate_flutter.option.flutter_option import FlutterOption
19
+
20
+ return [
21
+ FlutterOption,
22
+ ]
@@ -0,0 +1,11 @@
1
+ # Base image with Flutter SDK (includes Dart)
2
+ FROM ghcr.io/cirruslabs/flutter:stable
3
+
4
+ # Copy analysis options configuration
5
+ COPY analysis_options.yaml /root/analysis_options.yaml
6
+
7
+ # Set working directory
8
+ WORKDIR /var/www/html
9
+
10
+ # Keep container running
11
+ CMD ["tail", "-f", "/dev/null"]
@@ -0,0 +1,151 @@
1
+ # Dart/Flutter analysis options for code quality
2
+ analyzer:
3
+ strong-mode:
4
+ implicit-casts: false
5
+ implicit-dynamic: false
6
+ errors:
7
+ # Treat missing required parameters as errors
8
+ missing_required_param: error
9
+ # Treat missing returns as errors
10
+ missing_return: error
11
+ # Treat invalid assignments as errors
12
+ invalid_assignment: error
13
+ # Treat dead code as warnings
14
+ dead_code: warning
15
+ # Treat unused imports as warnings
16
+ unused_import: warning
17
+ # Treat unused local variables as warnings
18
+ unused_local_variable: warning
19
+ exclude:
20
+ - "**/*.g.dart"
21
+ - "**/*.freezed.dart"
22
+ - "**/generated/**"
23
+ - "**/build/**"
24
+ - "**/node_modules/**"
25
+
26
+ linter:
27
+ rules:
28
+ # Error rules
29
+ - avoid_empty_else
30
+ - avoid_print
31
+ - avoid_relative_lib_imports
32
+ - avoid_returning_null_for_future
33
+ - avoid_slow_async_io
34
+ - avoid_types_as_parameter_names
35
+ - cancel_subscriptions
36
+ - close_sinks
37
+ - comment_references
38
+ - control_flow_in_finally
39
+ - empty_statements
40
+ - hash_and_equals
41
+ - invariant_booleans
42
+ - iterable_contains_unrelated_type
43
+ - list_remove_unrelated_type
44
+ - literal_only_boolean_expressions
45
+ - no_adjacent_strings_in_list
46
+ - no_duplicate_case_values
47
+ - prefer_void_to_null
48
+ - test_types_in_equals
49
+ - throw_in_finally
50
+ - unnecessary_statements
51
+ - unrelated_type_equality_checks
52
+ - valid_regexps
53
+
54
+ # Style rules
55
+ - always_declare_return_types
56
+ - always_put_control_body_on_new_line
57
+ - always_require_non_null_named_parameters
58
+ - annotate_overrides
59
+ - avoid_bool_literals_in_conditional_expressions
60
+ - avoid_catches_without_on_clauses
61
+ - avoid_catching_errors
62
+ - avoid_function_literals_in_foreach_calls
63
+ - avoid_init_to_null
64
+ - avoid_null_checks_in_equality_operators
65
+ - avoid_renaming_method_parameters
66
+ - avoid_return_types_on_setters
67
+ - avoid_returning_null
68
+ - avoid_returning_null_for_void
69
+ - avoid_shadowing_type_parameters
70
+ - avoid_single_cascade_in_expression_statements
71
+ - avoid_unnecessary_containers
72
+ - avoid_unused_constructor_parameters
73
+ - await_only_futures
74
+ - camel_case_extensions
75
+ - camel_case_types
76
+ - cascade_invocations
77
+ - constant_identifier_names
78
+ - curly_braces_in_flow_control_structures
79
+ - directives_ordering
80
+ - empty_catches
81
+ - empty_constructor_bodies
82
+ - file_names
83
+ - implementation_imports
84
+ - library_names
85
+ - library_prefixes
86
+ - non_constant_identifier_names
87
+ - null_closures
88
+ - omit_local_variable_types
89
+ - one_member_abstracts
90
+ - only_throw_errors
91
+ - overridden_fields
92
+ - package_api_docs
93
+ - package_prefixed_library_names
94
+ - prefer_adjacent_string_concatenation
95
+ - prefer_asserts_in_initializer_lists
96
+ - prefer_collection_literals
97
+ - prefer_conditional_assignment
98
+ - prefer_const_constructors
99
+ - prefer_const_constructors_in_immutables
100
+ - prefer_const_declarations
101
+ - prefer_const_literals_to_create_immutables
102
+ - prefer_constructors_over_static_methods
103
+ - prefer_contains
104
+ - prefer_equal_for_default_values
105
+ - prefer_final_fields
106
+ - prefer_final_in_for_each
107
+ - prefer_final_locals
108
+ - prefer_for_elements_to_map_fromIterable
109
+ - prefer_function_declarations_over_variables
110
+ - prefer_generic_function_type_aliases
111
+ - prefer_if_elements_to_conditional_expressions
112
+ - prefer_if_null_operators
113
+ - prefer_initializing_formals
114
+ - prefer_inlined_adds
115
+ - prefer_int_literals
116
+ - prefer_interpolation_to_compose_strings
117
+ - prefer_is_empty
118
+ - prefer_is_not_empty
119
+ - prefer_is_not_operator
120
+ - prefer_iterable_whereType
121
+ - prefer_null_aware_operators
122
+ - prefer_single_quotes
123
+ - prefer_spread_collections
124
+ - prefer_typing_uninitialized_variables
125
+ - provide_deprecation_message
126
+ - recursive_getters
127
+ - slash_for_doc_comments
128
+ - sort_child_properties_last
129
+ - sort_constructors_first
130
+ - sort_unnamed_constructors_first
131
+ - type_annotate_public_apis
132
+ - type_init_formals
133
+ - unawaited_futures
134
+ - unnecessary_await_in_return
135
+ - unnecessary_brace_in_string_interps
136
+ - unnecessary_const
137
+ - unnecessary_getters_setters
138
+ - unnecessary_lambdas
139
+ - unnecessary_new
140
+ - unnecessary_null_aware_assignments
141
+ - unnecessary_null_in_if_null_operators
142
+ - unnecessary_overrides
143
+ - unnecessary_parenthesis
144
+ - unnecessary_this
145
+ - use_full_hex_values_for_flutter_colors
146
+ - use_function_type_syntax_for_parameters
147
+ - use_rethrow_when_possible
148
+ - use_setters_to_change_properties
149
+ - use_string_buffers
150
+ - use_to_and_as_if_applicable
151
+ - void_checks
File without changes