flutter_rb 0.8.2 → 1.0.0
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 +20 -20
- data/README.md +144 -144
- data/bin/frb +19 -19
- data/lib/checkstyle_report/checkstyle_report.rb +90 -90
- data/lib/flutter_rb/checks/check.rb +24 -24
- data/lib/flutter_rb/checks/plugin_directories_check.rb +33 -33
- data/lib/flutter_rb/checks/plugin_gradle_check.rb +57 -57
- data/lib/flutter_rb/checks/plugin_podspec_check.rb +109 -109
- data/lib/flutter_rb/checks/plugin_pubspec_check.rb +152 -152
- data/lib/flutter_rb/config/flutter_rb_config.rb +16 -16
- data/lib/flutter_rb/config/flutter_rb_config_initializer.rb +56 -56
- data/lib/flutter_rb/project/project.rb +53 -53
- data/lib/flutter_rb/project/specs/android/android_folder.rb +13 -13
- data/lib/flutter_rb/project/specs/android/gradle.rb +27 -27
- data/lib/flutter_rb/project/specs/flutter/dev_dependency.rb +11 -11
- data/lib/flutter_rb/project/specs/flutter/platform_plugin.rb +18 -18
- data/lib/flutter_rb/project/specs/flutter/pubspec.rb +69 -69
- data/lib/flutter_rb/project/specs/flutter/pubspec_info.rb +20 -20
- data/lib/flutter_rb/project/specs/ios/ios_folder.rb +14 -14
- data/lib/flutter_rb/project/specs/ios/podspec.rb +40 -40
- data/lib/flutter_rb/report/check_report.rb +47 -47
- data/lib/flutter_rb.rb +95 -93
- metadata +7 -35
@@ -1,18 +1,18 @@
|
|
1
|
-
module FlutterRb
|
2
|
-
# Flutter plugin, contains platform, package and plugin class
|
3
|
-
class PlatformPlugin
|
4
|
-
def initialize(platform, package, plugin_class)
|
5
|
-
@platform = platform
|
6
|
-
@package = package
|
7
|
-
@plugin_class = plugin_class
|
8
|
-
end
|
9
|
-
|
10
|
-
attr_reader :platform, :package, :plugin_class
|
11
|
-
end
|
12
|
-
|
13
|
-
# Supported platforms for this tool
|
14
|
-
class Platform
|
15
|
-
ANDROID = 'android'.freeze
|
16
|
-
IOS = 'ios'.freeze
|
17
|
-
end
|
18
|
-
end
|
1
|
+
module FlutterRb
|
2
|
+
# Flutter plugin, contains platform, package and plugin class
|
3
|
+
class PlatformPlugin
|
4
|
+
def initialize(platform, package, plugin_class)
|
5
|
+
@platform = platform
|
6
|
+
@package = package
|
7
|
+
@plugin_class = plugin_class
|
8
|
+
end
|
9
|
+
|
10
|
+
attr_reader :platform, :package, :plugin_class
|
11
|
+
end
|
12
|
+
|
13
|
+
# Supported platforms for this tool
|
14
|
+
class Platform
|
15
|
+
ANDROID = 'android'.freeze
|
16
|
+
IOS = 'ios'.freeze
|
17
|
+
end
|
18
|
+
end
|
@@ -1,69 +1,69 @@
|
|
1
|
-
require_relative './pubspec_info'
|
2
|
-
require_relative './dev_dependency'
|
3
|
-
require_relative './platform_plugin'
|
4
|
-
|
5
|
-
module FlutterRb
|
6
|
-
# pubspec.yaml representation
|
7
|
-
class Pubspec
|
8
|
-
def initialize(
|
9
|
-
path,
|
10
|
-
pubspec_info,
|
11
|
-
dev_dependencies,
|
12
|
-
platform_plugins
|
13
|
-
)
|
14
|
-
@path = path
|
15
|
-
@pubspec_info = pubspec_info
|
16
|
-
@dev_dependencies = dev_dependencies
|
17
|
-
@platform_plugins = platform_plugins
|
18
|
-
end
|
19
|
-
|
20
|
-
attr_reader :path, :pubspec_info, :dev_dependencies, :platform_plugins
|
21
|
-
end
|
22
|
-
|
23
|
-
# pubspec.yaml parser
|
24
|
-
class PubspecParser
|
25
|
-
def initialize(path, pubspec)
|
26
|
-
@path = path
|
27
|
-
@pubspec = pubspec
|
28
|
-
end
|
29
|
-
|
30
|
-
def parse
|
31
|
-
Pubspec.new(
|
32
|
-
@path,
|
33
|
-
pubspec_info(@pubspec),
|
34
|
-
dev_dependencies(@pubspec),
|
35
|
-
platform_plugins(@pubspec)
|
36
|
-
)
|
37
|
-
end
|
38
|
-
|
39
|
-
def pubspec_info(pubspec)
|
40
|
-
PubspecInfo.new(
|
41
|
-
pubspec['name'],
|
42
|
-
pubspec['description'],
|
43
|
-
pubspec['version'],
|
44
|
-
pubspec['author'],
|
45
|
-
pubspec['homepage']
|
46
|
-
)
|
47
|
-
end
|
48
|
-
|
49
|
-
def dev_dependencies(pubspec)
|
50
|
-
pubspec['dev_dependencies']&.map do |dev_dependency|
|
51
|
-
DevDependency.new(
|
52
|
-
dev_dependency.first,
|
53
|
-
dev_dependency.last
|
54
|
-
)
|
55
|
-
end
|
56
|
-
end
|
57
|
-
|
58
|
-
def platform_plugins(pubspec)
|
59
|
-
pubspec.dig('flutter', 'plugin', 'platforms')&.map do |platform_plugin|
|
60
|
-
plugin_info = platform_plugin.last
|
61
|
-
PlatformPlugin.new(
|
62
|
-
plugin_info['package'],
|
63
|
-
plugin_info['pluginClass'],
|
64
|
-
platform_plugin.first == Platform::ANDROID ? Platform::ANDROID : Platform::IOS
|
65
|
-
)
|
66
|
-
end
|
67
|
-
end
|
68
|
-
end
|
69
|
-
end
|
1
|
+
require_relative './pubspec_info'
|
2
|
+
require_relative './dev_dependency'
|
3
|
+
require_relative './platform_plugin'
|
4
|
+
|
5
|
+
module FlutterRb
|
6
|
+
# pubspec.yaml representation
|
7
|
+
class Pubspec
|
8
|
+
def initialize(
|
9
|
+
path,
|
10
|
+
pubspec_info,
|
11
|
+
dev_dependencies,
|
12
|
+
platform_plugins
|
13
|
+
)
|
14
|
+
@path = path
|
15
|
+
@pubspec_info = pubspec_info
|
16
|
+
@dev_dependencies = dev_dependencies
|
17
|
+
@platform_plugins = platform_plugins
|
18
|
+
end
|
19
|
+
|
20
|
+
attr_reader :path, :pubspec_info, :dev_dependencies, :platform_plugins
|
21
|
+
end
|
22
|
+
|
23
|
+
# pubspec.yaml parser
|
24
|
+
class PubspecParser
|
25
|
+
def initialize(path, pubspec)
|
26
|
+
@path = path
|
27
|
+
@pubspec = pubspec
|
28
|
+
end
|
29
|
+
|
30
|
+
def parse
|
31
|
+
Pubspec.new(
|
32
|
+
@path,
|
33
|
+
pubspec_info(@pubspec),
|
34
|
+
dev_dependencies(@pubspec),
|
35
|
+
platform_plugins(@pubspec)
|
36
|
+
)
|
37
|
+
end
|
38
|
+
|
39
|
+
def pubspec_info(pubspec)
|
40
|
+
PubspecInfo.new(
|
41
|
+
pubspec['name'],
|
42
|
+
pubspec['description'],
|
43
|
+
pubspec['version'],
|
44
|
+
pubspec['author'],
|
45
|
+
pubspec['homepage']
|
46
|
+
)
|
47
|
+
end
|
48
|
+
|
49
|
+
def dev_dependencies(pubspec)
|
50
|
+
pubspec['dev_dependencies']&.map do |dev_dependency|
|
51
|
+
DevDependency.new(
|
52
|
+
dev_dependency.first,
|
53
|
+
dev_dependency.last
|
54
|
+
)
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
def platform_plugins(pubspec)
|
59
|
+
pubspec.dig('flutter', 'plugin', 'platforms')&.map do |platform_plugin|
|
60
|
+
plugin_info = platform_plugin.last
|
61
|
+
PlatformPlugin.new(
|
62
|
+
plugin_info['package'],
|
63
|
+
plugin_info['pluginClass'],
|
64
|
+
platform_plugin.first == Platform::ANDROID ? Platform::ANDROID : Platform::IOS
|
65
|
+
)
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
@@ -1,20 +1,20 @@
|
|
1
|
-
module FlutterRb
|
2
|
-
# Flutter plugin info from pubspec.yaml
|
3
|
-
class PubspecInfo
|
4
|
-
def initialize(
|
5
|
-
name,
|
6
|
-
description,
|
7
|
-
version,
|
8
|
-
author,
|
9
|
-
homepage
|
10
|
-
)
|
11
|
-
@name = name
|
12
|
-
@description = description
|
13
|
-
@version = version
|
14
|
-
@author = author
|
15
|
-
@homepage = homepage
|
16
|
-
end
|
17
|
-
|
18
|
-
attr_reader :name, :description, :version, :author, :homepage
|
19
|
-
end
|
20
|
-
end
|
1
|
+
module FlutterRb
|
2
|
+
# Flutter plugin info from pubspec.yaml
|
3
|
+
class PubspecInfo
|
4
|
+
def initialize(
|
5
|
+
name,
|
6
|
+
description,
|
7
|
+
version,
|
8
|
+
author,
|
9
|
+
homepage
|
10
|
+
)
|
11
|
+
@name = name
|
12
|
+
@description = description
|
13
|
+
@version = version
|
14
|
+
@author = author
|
15
|
+
@homepage = homepage
|
16
|
+
end
|
17
|
+
|
18
|
+
attr_reader :name, :description, :version, :author, :homepage
|
19
|
+
end
|
20
|
+
end
|
@@ -1,14 +1,14 @@
|
|
1
|
-
require_relative './podspec'
|
2
|
-
|
3
|
-
module FlutterRb
|
4
|
-
# iOS representation
|
5
|
-
class IOSFolder
|
6
|
-
def initialize(path, pubspec)
|
7
|
-
@path = path
|
8
|
-
podspec_path = "#{path}/#{pubspec.pubspec_info.name}.podspec"
|
9
|
-
@podspec = File.exist?(podspec_path) ? PodspecParser.new(podspec_path).parse : nil
|
10
|
-
end
|
11
|
-
|
12
|
-
attr_reader :path, :podspec
|
13
|
-
end
|
14
|
-
end
|
1
|
+
require_relative './podspec'
|
2
|
+
|
3
|
+
module FlutterRb
|
4
|
+
# iOS representation
|
5
|
+
class IOSFolder
|
6
|
+
def initialize(path, pubspec)
|
7
|
+
@path = path
|
8
|
+
podspec_path = "#{path}/#{pubspec.pubspec_info.name}.podspec"
|
9
|
+
@podspec = File.exist?(podspec_path) ? PodspecParser.new(podspec_path).parse : nil
|
10
|
+
end
|
11
|
+
|
12
|
+
attr_reader :path, :podspec
|
13
|
+
end
|
14
|
+
end
|
@@ -1,40 +1,40 @@
|
|
1
|
-
require 'cocoapods'
|
2
|
-
|
3
|
-
module FlutterRb
|
4
|
-
# Podspec representation
|
5
|
-
class Podspec
|
6
|
-
def initialize(
|
7
|
-
path,
|
8
|
-
name,
|
9
|
-
version,
|
10
|
-
authors,
|
11
|
-
source
|
12
|
-
)
|
13
|
-
@path = path
|
14
|
-
@name = name
|
15
|
-
@version = version
|
16
|
-
@authors = authors
|
17
|
-
@source = source
|
18
|
-
end
|
19
|
-
|
20
|
-
attr_reader :path, :name, :version, :authors, :source
|
21
|
-
end
|
22
|
-
|
23
|
-
# Podspec parser
|
24
|
-
class PodspecParser
|
25
|
-
def initialize(path)
|
26
|
-
@path = path
|
27
|
-
end
|
28
|
-
|
29
|
-
def parse
|
30
|
-
podspec = Pod::Specification.from_file(@path)
|
31
|
-
@podspec = Podspec.new(
|
32
|
-
@path,
|
33
|
-
podspec.name,
|
34
|
-
podspec.version.version,
|
35
|
-
podspec.authors.nil? ? podspec.author : podspec.authors,
|
36
|
-
podspec.source
|
37
|
-
)
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
1
|
+
require 'cocoapods'
|
2
|
+
|
3
|
+
module FlutterRb
|
4
|
+
# Podspec representation
|
5
|
+
class Podspec
|
6
|
+
def initialize(
|
7
|
+
path,
|
8
|
+
name,
|
9
|
+
version,
|
10
|
+
authors,
|
11
|
+
source
|
12
|
+
)
|
13
|
+
@path = path
|
14
|
+
@name = name
|
15
|
+
@version = version
|
16
|
+
@authors = authors
|
17
|
+
@source = source
|
18
|
+
end
|
19
|
+
|
20
|
+
attr_reader :path, :name, :version, :authors, :source
|
21
|
+
end
|
22
|
+
|
23
|
+
# Podspec parser
|
24
|
+
class PodspecParser
|
25
|
+
def initialize(path)
|
26
|
+
@path = path
|
27
|
+
end
|
28
|
+
|
29
|
+
def parse
|
30
|
+
podspec = Pod::Specification.from_file(@path)
|
31
|
+
@podspec = Podspec.new(
|
32
|
+
@path,
|
33
|
+
podspec.name,
|
34
|
+
podspec.version.version,
|
35
|
+
podspec.authors.nil? ? podspec.author : podspec.authors,
|
36
|
+
podspec.source
|
37
|
+
)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -1,47 +1,47 @@
|
|
1
|
-
require 'colorize'
|
2
|
-
|
3
|
-
module FlutterRb
|
4
|
-
# Check report
|
5
|
-
class CheckReport
|
6
|
-
def initialize(
|
7
|
-
check_name,
|
8
|
-
check_report_status,
|
9
|
-
message,
|
10
|
-
path
|
11
|
-
)
|
12
|
-
@check_name = check_name
|
13
|
-
@check_report_status = check_report_status
|
14
|
-
@message = message
|
15
|
-
@path = path
|
16
|
-
end
|
17
|
-
|
18
|
-
def print(colorize: true)
|
19
|
-
if colorize
|
20
|
-
status_color = color_for_report_status(@check_report_status)
|
21
|
-
" * [#{@check_report_status.colorize(status_color)}] #{@check_name}: #{@message}"
|
22
|
-
else
|
23
|
-
" * [#{@check_report_status}] #{@check_name}: #{@message}"
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
def color_for_report_status(check_report_status)
|
28
|
-
case check_report_status
|
29
|
-
when CheckReportStatus::NORMAL
|
30
|
-
:green
|
31
|
-
when CheckReportStatus::WARNING
|
32
|
-
:yellow
|
33
|
-
when CheckReportStatus::ERROR
|
34
|
-
:red
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
attr_reader :check_name, :check_report_status, :message, :path
|
39
|
-
end
|
40
|
-
|
41
|
-
# Check report status
|
42
|
-
class CheckReportStatus
|
43
|
-
NORMAL = 'normal'.freeze
|
44
|
-
WARNING = 'warning'.freeze
|
45
|
-
ERROR = 'error'.freeze
|
46
|
-
end
|
47
|
-
end
|
1
|
+
require 'colorize'
|
2
|
+
|
3
|
+
module FlutterRb
|
4
|
+
# Check report
|
5
|
+
class CheckReport
|
6
|
+
def initialize(
|
7
|
+
check_name,
|
8
|
+
check_report_status,
|
9
|
+
message,
|
10
|
+
path
|
11
|
+
)
|
12
|
+
@check_name = check_name
|
13
|
+
@check_report_status = check_report_status
|
14
|
+
@message = message
|
15
|
+
@path = path
|
16
|
+
end
|
17
|
+
|
18
|
+
def print(colorize: true)
|
19
|
+
if colorize
|
20
|
+
status_color = color_for_report_status(@check_report_status)
|
21
|
+
" * [#{@check_report_status.colorize(status_color)}] #{@check_name}: #{@message}"
|
22
|
+
else
|
23
|
+
" * [#{@check_report_status}] #{@check_name}: #{@message}"
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def color_for_report_status(check_report_status)
|
28
|
+
case check_report_status
|
29
|
+
when CheckReportStatus::NORMAL
|
30
|
+
:green
|
31
|
+
when CheckReportStatus::WARNING
|
32
|
+
:yellow
|
33
|
+
when CheckReportStatus::ERROR
|
34
|
+
:red
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
attr_reader :check_name, :check_report_status, :message, :path
|
39
|
+
end
|
40
|
+
|
41
|
+
# Check report status
|
42
|
+
class CheckReportStatus
|
43
|
+
NORMAL = 'normal'.freeze
|
44
|
+
WARNING = 'warning'.freeze
|
45
|
+
ERROR = 'error'.freeze
|
46
|
+
end
|
47
|
+
end
|
data/lib/flutter_rb.rb
CHANGED
@@ -1,93 +1,95 @@
|
|
1
|
-
require_relative './flutter_rb/project/project'
|
2
|
-
require_relative './flutter_rb/checks/plugin_directories_check'
|
3
|
-
require_relative './flutter_rb/checks/plugin_pubspec_check'
|
4
|
-
require_relative './flutter_rb/checks/plugin_gradle_check'
|
5
|
-
require_relative './flutter_rb/checks/plugin_podspec_check'
|
6
|
-
require_relative './flutter_rb/config/flutter_rb_config_initializer'
|
7
|
-
|
8
|
-
require_relative './checkstyle_report/checkstyle_report'
|
9
|
-
|
10
|
-
module FlutterRb
|
11
|
-
# Start FlutterRb checks
|
12
|
-
class FlutterRb
|
13
|
-
def start(path, with_report)
|
14
|
-
project = ProjectParser.new(path).project
|
15
|
-
if project.nil?
|
16
|
-
exit_with_no_project
|
17
|
-
else
|
18
|
-
check_project(
|
19
|
-
project,
|
20
|
-
path,
|
21
|
-
with_report
|
22
|
-
)
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
def exit_with_no_project
|
27
|
-
puts 'No project'
|
28
|
-
exit(-1)
|
29
|
-
end
|
30
|
-
|
31
|
-
# rubocop:disable Metrics/AbcSize, Metrics/MethodLength
|
32
|
-
def check_project(project, path, with_report)
|
33
|
-
config_initializer = FlutterRbConfigInitializer.new
|
34
|
-
config_path = "#{path}/.flutter_rb.yaml"
|
35
|
-
config = File.exist?(config_path) ? config_initializer.parse(config_path) : config_initializer.default
|
36
|
-
checks = explore_project(
|
37
|
-
project,
|
38
|
-
config.flutter_checks,
|
39
|
-
config.android_checks,
|
40
|
-
config.ios_checks
|
41
|
-
)
|
42
|
-
checks.each { |check| puts check.print }
|
43
|
-
errors = checks.reject { |check| check.check_report_status == CheckReportStatus::NORMAL }
|
44
|
-
create_report(path, checks) if with_report
|
45
|
-
exit(errors.empty? ? 0 : -1)
|
46
|
-
end
|
47
|
-
# rubocop:enable Metrics/AbcSize, Metrics/MethodLength
|
48
|
-
|
49
|
-
def explore_project(
|
50
|
-
project,
|
51
|
-
flutter_checks,
|
52
|
-
android_checks,
|
53
|
-
ios_checks
|
54
|
-
)
|
55
|
-
result = []
|
56
|
-
result += flutter_checks.map { |check| check.check(project) }
|
57
|
-
result += android_checks.map { |check| check.check(project) } unless project.android_folder.nil?
|
58
|
-
result += ios_checks.map { |check| check.check(project) } unless project.ios_folder.nil?
|
59
|
-
result
|
60
|
-
end
|
61
|
-
|
62
|
-
# rubocop:disable Metrics/MethodLength
|
63
|
-
def create_report(path, checks)
|
64
|
-
errors = checks.map do |check|
|
65
|
-
CheckstyleReport::CheckstyleError.new(
|
66
|
-
level_for_report(check.check_report_status),
|
67
|
-
check.message,
|
68
|
-
check.path,
|
69
|
-
0,
|
70
|
-
0,
|
71
|
-
check.check_name
|
72
|
-
)
|
73
|
-
end
|
74
|
-
CheckstyleReport::CheckstyleReport.new(
|
75
|
-
path,
|
76
|
-
'frb-checkstyle-report',
|
77
|
-
errors
|
78
|
-
).create_report
|
79
|
-
end
|
80
|
-
# rubocop:enable Metrics/MethodLength
|
81
|
-
|
82
|
-
def level_for_report(check_report_status)
|
83
|
-
case check_report_status
|
84
|
-
when CheckReportStatus::NORMAL
|
85
|
-
CheckstyleReport::CheckstyleError::
|
86
|
-
when CheckReportStatus::WARNING
|
87
|
-
CheckstyleReport::CheckstyleError::
|
88
|
-
when CheckReportStatus::ERROR
|
89
|
-
CheckstyleReport::CheckstyleError::
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
end
|
1
|
+
require_relative './flutter_rb/project/project'
|
2
|
+
require_relative './flutter_rb/checks/plugin_directories_check'
|
3
|
+
require_relative './flutter_rb/checks/plugin_pubspec_check'
|
4
|
+
require_relative './flutter_rb/checks/plugin_gradle_check'
|
5
|
+
require_relative './flutter_rb/checks/plugin_podspec_check'
|
6
|
+
require_relative './flutter_rb/config/flutter_rb_config_initializer'
|
7
|
+
|
8
|
+
require_relative './checkstyle_report/checkstyle_report'
|
9
|
+
|
10
|
+
module FlutterRb
|
11
|
+
# Start FlutterRb checks
|
12
|
+
class FlutterRb
|
13
|
+
def start(path, with_report)
|
14
|
+
project = ProjectParser.new(path).project
|
15
|
+
if project.nil?
|
16
|
+
exit_with_no_project
|
17
|
+
else
|
18
|
+
check_project(
|
19
|
+
project,
|
20
|
+
path,
|
21
|
+
with_report
|
22
|
+
)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def exit_with_no_project
|
27
|
+
puts 'No project'
|
28
|
+
exit(-1)
|
29
|
+
end
|
30
|
+
|
31
|
+
# rubocop:disable Metrics/AbcSize, Metrics/MethodLength
|
32
|
+
def check_project(project, path, with_report)
|
33
|
+
config_initializer = FlutterRbConfigInitializer.new
|
34
|
+
config_path = "#{path}/.flutter_rb.yaml"
|
35
|
+
config = File.exist?(config_path) ? config_initializer.parse(config_path) : config_initializer.default
|
36
|
+
checks = explore_project(
|
37
|
+
project,
|
38
|
+
config.flutter_checks,
|
39
|
+
config.android_checks,
|
40
|
+
config.ios_checks
|
41
|
+
)
|
42
|
+
checks.each { |check| puts check.print }
|
43
|
+
errors = checks.reject { |check| check.check_report_status == CheckReportStatus::NORMAL }
|
44
|
+
create_report(path, checks) if with_report
|
45
|
+
exit(errors.empty? ? 0 : -1)
|
46
|
+
end
|
47
|
+
# rubocop:enable Metrics/AbcSize, Metrics/MethodLength
|
48
|
+
|
49
|
+
def explore_project(
|
50
|
+
project,
|
51
|
+
flutter_checks,
|
52
|
+
android_checks,
|
53
|
+
ios_checks
|
54
|
+
)
|
55
|
+
result = []
|
56
|
+
result += flutter_checks.map { |check| check.check(project) }
|
57
|
+
result += android_checks.map { |check| check.check(project) } unless project.android_folder.nil?
|
58
|
+
result += ios_checks.map { |check| check.check(project) } unless project.ios_folder.nil?
|
59
|
+
result
|
60
|
+
end
|
61
|
+
|
62
|
+
# rubocop:disable Metrics/MethodLength
|
63
|
+
def create_report(path, checks)
|
64
|
+
errors = checks.map do |check|
|
65
|
+
CheckstyleReport::CheckstyleError.new(
|
66
|
+
level_for_report(check.check_report_status),
|
67
|
+
check.message,
|
68
|
+
check.path,
|
69
|
+
0,
|
70
|
+
0,
|
71
|
+
check.check_name
|
72
|
+
)
|
73
|
+
end
|
74
|
+
CheckstyleReport::CheckstyleReport.new(
|
75
|
+
path,
|
76
|
+
'frb-checkstyle-report',
|
77
|
+
errors
|
78
|
+
).create_report
|
79
|
+
end
|
80
|
+
# rubocop:enable Metrics/MethodLength
|
81
|
+
|
82
|
+
def level_for_report(check_report_status)
|
83
|
+
case check_report_status
|
84
|
+
when CheckReportStatus::NORMAL
|
85
|
+
CheckstyleReport::CheckstyleError::SEVERITY_NORMAL
|
86
|
+
when CheckReportStatus::WARNING
|
87
|
+
CheckstyleReport::CheckstyleError::SEVERITY_WARNING
|
88
|
+
when CheckReportStatus::ERROR
|
89
|
+
CheckstyleReport::CheckstyleError::SEVERITY_ERROR
|
90
|
+
else
|
91
|
+
throw 'Unknown CheckReportStatus'
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|