flutter_rb 1.1.1 → 1.2.1
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.
- checksums.yaml +4 -4
- data/LICENSE +1 -1
- data/README.md +42 -9
- data/bin/frb +1 -16
- data/lib/checkstyle_report/checkstyle_report.rb +78 -36
- data/lib/flutter_rb/checks/check.rb +16 -16
- data/lib/flutter_rb/checks/plugin_directories_check.rb +16 -12
- data/lib/flutter_rb/checks/plugin_gradle_check.rb +37 -22
- data/lib/flutter_rb/checks/plugin_podspec_check.rb +78 -47
- data/lib/flutter_rb/checks/plugin_pubspec_check.rb +110 -70
- data/lib/flutter_rb/config/flutter_rb_config.rb +15 -5
- data/lib/flutter_rb/config/flutter_rb_config_initializer.rb +11 -7
- data/lib/flutter_rb/project/project.rb +37 -10
- data/lib/flutter_rb/project/specs/android/android_folder.rb +14 -3
- data/lib/flutter_rb/project/specs/android/gradle.rb +35 -11
- data/lib/flutter_rb/project/specs/flutter/dev_dependency.rb +14 -4
- data/lib/flutter_rb/project/specs/flutter/platform_plugin.rb +24 -6
- data/lib/flutter_rb/project/specs/flutter/pubspec.rb +47 -16
- data/lib/flutter_rb/project/specs/flutter/pubspec_info.rb +27 -7
- data/lib/flutter_rb/project/specs/ios/ios_folder.rb +18 -4
- data/lib/flutter_rb/project/specs/ios/podspec.rb +44 -10
- data/lib/flutter_rb/report/check_report.rb +32 -10
- data/lib/flutter_rb.rb +42 -40
- metadata +16 -2
data/lib/flutter_rb.rb
CHANGED
@@ -12,11 +12,17 @@ require_relative './checkstyle_report/checkstyle_report'
|
|
12
12
|
module FlutterRb
|
13
13
|
# FlutterRb entry
|
14
14
|
class FlutterRb
|
15
|
+
# This class is the entry point for FlutterRb checks.
|
16
|
+
# It provides methods to start the checks, handle project parsing,
|
17
|
+
# explore project directories, create reports, and handle exit codes.
|
18
|
+
|
15
19
|
# Start FlutterRb checks
|
16
|
-
#
|
17
|
-
# @param
|
20
|
+
#
|
21
|
+
# @param path [String] The path to the Flutter project directory
|
22
|
+
# @param with_report [Boolean] Whether to generate a report or not
|
18
23
|
def start(path, with_report)
|
19
24
|
project = ProjectParser.new(path).project
|
25
|
+
|
20
26
|
if project.nil?
|
21
27
|
exit_with_no_project
|
22
28
|
else
|
@@ -28,16 +34,21 @@ module FlutterRb
|
|
28
34
|
end
|
29
35
|
end
|
30
36
|
|
31
|
-
#
|
37
|
+
# Exit the program with a message indicating no project found
|
38
|
+
#
|
39
|
+
# @return [Void]
|
32
40
|
def exit_with_no_project
|
33
41
|
puts 'No project'
|
42
|
+
|
34
43
|
exit(-1)
|
35
44
|
end
|
36
45
|
|
37
|
-
#
|
38
|
-
#
|
39
|
-
# @param
|
40
|
-
# @param
|
46
|
+
# Check the Flutter project
|
47
|
+
#
|
48
|
+
# @param project [Project] The parsed Flutter project
|
49
|
+
# @param path [String] The path to the Flutter project directory
|
50
|
+
# @param with_report [Boolean] Whether to generate a report or not
|
51
|
+
# @return [Void]
|
41
52
|
def check_project(project, path, with_report)
|
42
53
|
config_initializer = FlutterRbConfigInitializer.new
|
43
54
|
config_path = "#{path}/.flutter_rb.yaml"
|
@@ -48,45 +59,36 @@ module FlutterRb
|
|
48
59
|
config.android_checks,
|
49
60
|
config.ios_checks
|
50
61
|
)
|
62
|
+
|
51
63
|
checks.each { |check| puts check.print }
|
52
|
-
errors = checks.reject
|
53
|
-
|
54
|
-
end
|
64
|
+
errors = checks.reject { |check| check.check_report_status == CheckReportStatus::NORMAL }
|
65
|
+
|
55
66
|
create_report(path, checks) if with_report
|
67
|
+
|
56
68
|
exit(errors.empty? ? 0 : -1)
|
57
69
|
end
|
58
70
|
|
59
|
-
#
|
60
|
-
|
61
|
-
#
|
62
|
-
# @param
|
63
|
-
# @param
|
64
|
-
# @param
|
65
|
-
# @
|
71
|
+
# Explore the Flutter project directories and perform checks
|
72
|
+
#
|
73
|
+
# @param project [Project] The parsed Flutter project
|
74
|
+
# @param flutter_checks [Check[]] The checks to perform on the Flutter project
|
75
|
+
# @param android_checks [Check[]] The checks to perform on the Android project
|
76
|
+
# @param ios_checks [Check[]] The checks to perform on the iOS project
|
77
|
+
# @return [Check[]] The results of the performed checks
|
66
78
|
def explore_project(project, flutter_checks, android_checks, ios_checks)
|
67
79
|
result = []
|
68
|
-
result += flutter_checks.map
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
result += android_checks.map do |check|
|
73
|
-
check.check(project)
|
74
|
-
end
|
75
|
-
end
|
76
|
-
unless project.ios_folder.nil?
|
77
|
-
result += ios_checks.map do |check|
|
78
|
-
check.check(project)
|
79
|
-
end
|
80
|
-
end
|
80
|
+
result += flutter_checks.map { |check| check.check(project) }
|
81
|
+
result += android_checks.map { |check| check.check(project) } unless project.android_folder.nil?
|
82
|
+
result += ios_checks.map { |check| check.check(project) } unless project.ios_folder.nil?
|
83
|
+
|
81
84
|
result
|
82
85
|
end
|
83
86
|
|
84
|
-
#
|
85
|
-
|
86
|
-
#
|
87
|
-
# @param
|
88
|
-
# @
|
89
|
-
# @return {CheckstyleReport}
|
87
|
+
# Create a report based on the performed checks
|
88
|
+
#
|
89
|
+
# @param path [String] The path to the Flutter project directory
|
90
|
+
# @param checks [Check[]] The results of the performed checks
|
91
|
+
# @return [CheckstyleReport] The created report
|
90
92
|
def create_report(path, checks)
|
91
93
|
errors = checks.map do |check|
|
92
94
|
CheckstyleReport::CheckstyleError.new(
|
@@ -105,10 +107,10 @@ module FlutterRb
|
|
105
107
|
).create_report
|
106
108
|
end
|
107
109
|
|
108
|
-
#
|
109
|
-
|
110
|
-
# @param
|
111
|
-
# @return
|
110
|
+
# Determine the severity level for a check report status
|
111
|
+
#
|
112
|
+
# @param check_report_status [CheckReportStatus] The status of the check report
|
113
|
+
# @return [String] The severity level for the report
|
112
114
|
def level_for_report(check_report_status)
|
113
115
|
case check_report_status
|
114
116
|
when CheckReportStatus::NORMAL
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: flutter_rb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Artem Fomchenkov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-07-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cocoapods
|
@@ -94,6 +94,20 @@ dependencies:
|
|
94
94
|
- - '='
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: 12.3.3
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: rdoc
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - '='
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: 6.6.2
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - '='
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: 6.6.2
|
97
111
|
- !ruby/object:Gem::Dependency
|
98
112
|
name: rubocop
|
99
113
|
requirement: !ruby/object:Gem::Requirement
|