Skip to content

Commit 6995cdd

Browse files
committed
chore: strengthen CI pipeline and project quality standards
Add code coverage enforcement to CI (75% threshold, excluding generated l10n files), stricter analysis_options.yaml with rules for immutability, async safety and widget best practices, .editorconfig for cross-editor consistency, and project metadata in pubspec.yaml.
1 parent 0800041 commit 6995cdd

4 files changed

Lines changed: 50 additions & 2 deletions

File tree

.editorconfig

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
root = true
2+
3+
[*]
4+
end_of_line = lf
5+
insert_final_newline = true
6+
trim_trailing_whitespace = true
7+
charset = utf-8
8+
9+
[*.dart]
10+
indent_style = space
11+
indent_size = 2
12+
13+
[*.{yaml,yml}]
14+
indent_style = space
15+
indent_size = 2
16+
17+
[*.md]
18+
trim_trailing_whitespace = false
19+
20+
[Makefile]
21+
indent_style = tab

.github/workflows/ci.yml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,14 @@ jobs:
3131
- name: Analyze
3232
run: flutter analyze
3333

34-
- name: Run tests
35-
run: flutter test
34+
- name: Run tests with coverage
35+
run: flutter test --coverage
36+
37+
- name: Enforce coverage threshold
38+
run: |
39+
# Exclude generated l10n files from coverage report
40+
awk 'BEGIN{s=0} /^SF:.*lib\/l10n\//{s=1} /^end_of_record/{if(s){s=0;next}} !s' coverage/lcov.info > coverage/lcov_filtered.info
41+
COVERAGE=$(awk '/^LF:/{t+=substr($0,4)} /^LH:/{h+=substr($0,4)} END{if(t>0) printf "%.1f",h/t*100; else print "0"}' coverage/lcov_filtered.info)
42+
echo "Coverage: ${COVERAGE}% (excluding generated l10n)"
43+
THRESHOLD=75
44+
awk "BEGIN{exit ($COVERAGE < $THRESHOLD) ? 1 : 0}" || { echo "::error::Coverage ${COVERAGE}% is below the ${THRESHOLD}% threshold"; exit 1; }

analysis_options.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,25 @@ linter:
44
rules:
55
prefer_const_constructors: true
66
prefer_const_declarations: true
7+
prefer_const_literals_to_create_immutables: true
78
avoid_print: true
9+
prefer_final_fields: true
10+
prefer_final_locals: true
11+
unnecessary_this: true
12+
unnecessary_late: true
13+
unnecessary_nullable_for_final_variable_declarations: true
14+
use_super_parameters: true
15+
avoid_unnecessary_containers: true
16+
sized_box_for_whitespace: true
17+
sort_child_properties_last: true
18+
use_build_context_synchronously: true
19+
cancel_subscriptions: true
20+
always_declare_return_types: true
21+
unawaited_futures: true
822

923
analyzer:
1024
errors:
1125
missing_required_param: error
1226
missing_return: error
27+
exclude:
28+
- "lib/l10n/app_localizations*.dart"

pubspec.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ name: pictotap
22
description: A communication app for accessibility.
33
publish_to: none
44
version: 1.0.0+1
5+
homepage: https://endika.github.io/pictotap
6+
repository: https://github.com/endika/pictotap
57

68
environment:
79
sdk: ">=3.0.0 <4.0.0"

0 commit comments

Comments
 (0)