Class: Fastlane::Actions::OclintJsonCompilationDatabaseAction
- Inherits:
-
Action
- Object
- Action
- Fastlane::Actions::OclintJsonCompilationDatabaseAction
- Defined in:
- lib/fastlane/plugin/oclint_json_compilation_database/actions/oclint_json_compilation_database_action.rb
Class Method Summary collapse
- .authors ⇒ Object
- .available_options ⇒ Object
- .category ⇒ Object
- .handle_error(ignore_exit_status) ⇒ Object
- .is_supported?(_platform) ⇒ Boolean
- .run(params) ⇒ Object
Class Method Details
.authors ⇒ Object
135 136 137 |
# File 'lib/fastlane/plugin/oclint_json_compilation_database/actions/oclint_json_compilation_database_action.rb', line 135 def self. ["Marcin Stepnowski"] end |
.available_options ⇒ Object
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 |
# File 'lib/fastlane/plugin/oclint_json_compilation_database/actions/oclint_json_compilation_database_action.rb', line 71 def self. [ FastlaneCore::ConfigItem.new(key: :executable, env_name: 'FL_OCLJCD_EXECUTABLE', description: 'Path to the `oclint-json-compilation-database` executable on your machine', optional: true, type: String, verify_block: proc do |value| UI.user_error!("Couldn't find executable path '#{File.(value)}'") unless File.exist?(value) end), FastlaneCore::ConfigItem.new(key: :build_path, env_name: 'FL_OCLJCD_BUILD_PATH', description: 'Specify the directory containing compile_commands.json', optional: true, type: String), FastlaneCore::ConfigItem.new(key: :include, env_name: 'FL_OCLJCD_INCLUDE', description: 'Extract files matching pattern', optional: true, type: Array), FastlaneCore::ConfigItem.new(key: :exclude, env_name: 'FL_OCLJCD_EXCLUDE', description: 'Remove files matching pattern', optional: true, type: Array), FastlaneCore::ConfigItem.new(key: :enable_clang_static_analyzer, env_name: 'FL_OCLJCD_EXCLUDE_ENABLE_CLANG_STATIC_ANALYZER', description: 'Enable Clang Static Analyzer, and integrate results into OCLint report', optional: true, default_value: false, type: Boolean), FastlaneCore::ConfigItem.new(key: :report_path, env_name: 'FL_OCLJCD_REPORT_PATH', description: 'The reports file path', optional: true, type: String), FastlaneCore::ConfigItem.new(key: :report_type, env_name: 'FL_OCLJCD_REPORT_TYPE', description: 'The type of the report. Available: text, html, xml, json, pmd, xcode', optional: true, type: String, verify_block: proc do |value| available = ['text', 'html', 'xml', 'json', 'pmd', 'xcode'] UI.user_error!("Available values are '#{available.join("', '")}'") unless available.include?(value) end), FastlaneCore::ConfigItem.new(key: :ignore_exit_status, env_name: "FL_OCLJCD_IGNORE_EXIT_STATUS", description: "Ignore the exit status of the oclint-json-compilation-database command, so that serious violations \ don't fail the build (true/false)", default_value: false, type: Boolean, optional: true) ] end |
.category ⇒ Object
127 128 129 |
# File 'lib/fastlane/plugin/oclint_json_compilation_database/actions/oclint_json_compilation_database_action.rb', line 127 def self.category :testing end |
.handle_error(ignore_exit_status) ⇒ Object
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/fastlane/plugin/oclint_json_compilation_database/actions/oclint_json_compilation_database_action.rb', line 55 def self.handle_error(ignore_exit_status) if ignore_exit_status failure_suffix = 'which would normally fail the build.' = 'fastlane will continue because the `ignore_exit_status` option was used! 🙈' else failure_suffix = 'which represents a failure.' = 'If you want fastlane to continue anyway, use the `ignore_exit_status` option. 🙈' end UI.important("") UI.important("oclint-json-compilation-database finished with status code other than 0, #{failure_suffix}") UI.important() UI.important("") UI.user_error!("oclint-json-compilation-database finished with errors") unless ignore_exit_status end |
.is_supported?(_platform) ⇒ Boolean
131 132 133 |
# File 'lib/fastlane/plugin/oclint_json_compilation_database/actions/oclint_json_compilation_database_action.rb', line 131 def self.is_supported?(_platform) true end |
.run(params) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/fastlane/plugin/oclint_json_compilation_database/actions/oclint_json_compilation_database_action.rb', line 6 def self.run(params) cmd = [] cmd << (params[:executable] || "oclint-json-compilation-database").dup build_path = params[:build_path] if build_path cmd << '-p' cmd << build_path end include = Array(params[:include]) include.each do |path| cmd << "--include" cmd << path end exclude = Array(params[:exclude]) exclude.each do |path| cmd << "--exclude" cmd << path end oclint_args = [] report_type = params[:report_type] if report_type oclint_args << "-report-type" oclint_args << report_type end oclint_args << "-enable-clang-static-analyzer" if params[:enable_clang_static_analyzer] if oclint_args.any? cmd << "--" cmd << oclint_args end report_path = params[:report_path] if report_path cmd << ">>" cmd << report_path end begin Actions.sh(cmd.join(' ')) rescue handle_error(params[:ignore_exit_status]) end end |