Class: PmdTester::Options
- Inherits:
-
Object
- Object
- PmdTester::Options
- Includes:
- PmdTester
- Defined in:
- lib/pmdtester/parsers/options.rb
Overview
The Options is a class responsible of parsing all the command line options
Constant Summary collapse
- ANY =
'any'- LOCAL =
'local'- ONLINE =
'online'- SINGLE =
'single'- DEFAULT_CONFIG_PATH =
ResourceLocator.locate('config/all-java.xml')
- DEFAULT_LIST_PATH =
ResourceLocator.locate('config/project-list.xml')
- DEFAULT_BASELINE_URL_PREFIX =
'https://sourceforge.net/projects/pmd/files/pmd-regression-tester/'
Constants included from PmdTester
BASE, PATCH, PR_NUM_ENV_VAR, VERSION
Instance Attribute Summary collapse
-
#auto_config_flag ⇒ Object
readonly
Returns the value of attribute auto_config_flag.
-
#base_branch ⇒ Object
readonly
Returns the value of attribute base_branch.
-
#base_config ⇒ Object
Returns the value of attribute base_config.
-
#baseline_download_url_prefix ⇒ Object
readonly
Returns the value of attribute baseline_download_url_prefix.
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#debug_flag ⇒ Object
readonly
Returns the value of attribute debug_flag.
-
#error_recovery ⇒ Object
readonly
Returns the value of attribute error_recovery.
-
#filter_set ⇒ Object
Returns the value of attribute filter_set.
-
#filter_with_patch_config ⇒ Object
readonly
Returns the value of attribute filter_with_patch_config.
-
#html_flag ⇒ Object
readonly
Returns the value of attribute html_flag.
-
#keep_reports ⇒ Object
readonly
Returns the value of attribute keep_reports.
-
#local_git_repo ⇒ Object
readonly
Returns the value of attribute local_git_repo.
-
#mode ⇒ Object
readonly
Returns the value of attribute mode.
-
#patch_branch ⇒ Object
readonly
Returns the value of attribute patch_branch.
-
#patch_config ⇒ Object
Returns the value of attribute patch_config.
-
#project_list ⇒ Object
readonly
Returns the value of attribute project_list.
-
#run_cpd ⇒ Object
readonly
Returns the value of attribute run_cpd.
-
#run_pmd ⇒ Object
readonly
Returns the value of attribute run_pmd.
-
#threads ⇒ Object
readonly
Returns the value of attribute threads.
Instance Method Summary collapse
-
#initialize(argv) ⇒ Options
constructor
A new instance of Options.
Methods included from PmdTester
Constructor Details
#initialize(argv) ⇒ Options
Returns a new instance of Options.
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/pmdtester/parsers/options.rb', line 43 def initialize(argv) = parse(argv) @local_git_repo = [:r] @base_branch = [:b] @patch_branch = [:p] @base_config = [:bc] @patch_config = [:pc] @config = [:c] @project_list = [:l] @mode = [:m] @threads = [:t] @html_flag = [:f] @auto_config_flag = [:a] @filter_with_patch_config = .filter_with_patch_config? @debug_flag = [:d] @filter_set = nil @keep_reports = .keep_reports? @error_recovery = .error_recovery? url = [:baseline_download_url] @run_cpd = !.no_cpd? @run_pmd = !.no_pmd? @baseline_download_url_prefix = if url[-1] == '/' url else "#{url}/" end # if the 'config' option is selected then `config` overrides `base_config` and `patch_config` @base_config = @config if !@config.nil? && @mode == 'local' @patch_config = @config if !@config.nil? && @mode == 'local' logger.level = @debug_flag ? Logger::DEBUG : Logger::INFO end |
Instance Attribute Details
#auto_config_flag ⇒ Object (readonly)
Returns the value of attribute auto_config_flag.
33 34 35 |
# File 'lib/pmdtester/parsers/options.rb', line 33 def auto_config_flag @auto_config_flag end |
#base_branch ⇒ Object (readonly)
Returns the value of attribute base_branch.
24 25 26 |
# File 'lib/pmdtester/parsers/options.rb', line 24 def base_branch @base_branch end |
#base_config ⇒ Object
Returns the value of attribute base_config.
26 27 28 |
# File 'lib/pmdtester/parsers/options.rb', line 26 def base_config @base_config end |
#baseline_download_url_prefix ⇒ Object (readonly)
Returns the value of attribute baseline_download_url_prefix.
39 40 41 |
# File 'lib/pmdtester/parsers/options.rb', line 39 def baseline_download_url_prefix @baseline_download_url_prefix end |
#config ⇒ Object (readonly)
Returns the value of attribute config.
28 29 30 |
# File 'lib/pmdtester/parsers/options.rb', line 28 def config @config end |
#debug_flag ⇒ Object (readonly)
Returns the value of attribute debug_flag.
35 36 37 |
# File 'lib/pmdtester/parsers/options.rb', line 35 def debug_flag @debug_flag end |
#error_recovery ⇒ Object (readonly)
Returns the value of attribute error_recovery.
38 39 40 |
# File 'lib/pmdtester/parsers/options.rb', line 38 def error_recovery @error_recovery end |
#filter_set ⇒ Object
Returns the value of attribute filter_set.
36 37 38 |
# File 'lib/pmdtester/parsers/options.rb', line 36 def filter_set @filter_set end |
#filter_with_patch_config ⇒ Object (readonly)
Returns the value of attribute filter_with_patch_config.
34 35 36 |
# File 'lib/pmdtester/parsers/options.rb', line 34 def filter_with_patch_config @filter_with_patch_config end |
#html_flag ⇒ Object (readonly)
Returns the value of attribute html_flag.
32 33 34 |
# File 'lib/pmdtester/parsers/options.rb', line 32 def html_flag @html_flag end |
#keep_reports ⇒ Object (readonly)
Returns the value of attribute keep_reports.
37 38 39 |
# File 'lib/pmdtester/parsers/options.rb', line 37 def keep_reports @keep_reports end |
#local_git_repo ⇒ Object (readonly)
Returns the value of attribute local_git_repo.
23 24 25 |
# File 'lib/pmdtester/parsers/options.rb', line 23 def local_git_repo @local_git_repo end |
#mode ⇒ Object (readonly)
Returns the value of attribute mode.
30 31 32 |
# File 'lib/pmdtester/parsers/options.rb', line 30 def mode @mode end |
#patch_branch ⇒ Object (readonly)
Returns the value of attribute patch_branch.
25 26 27 |
# File 'lib/pmdtester/parsers/options.rb', line 25 def patch_branch @patch_branch end |
#patch_config ⇒ Object
Returns the value of attribute patch_config.
27 28 29 |
# File 'lib/pmdtester/parsers/options.rb', line 27 def patch_config @patch_config end |
#project_list ⇒ Object (readonly)
Returns the value of attribute project_list.
29 30 31 |
# File 'lib/pmdtester/parsers/options.rb', line 29 def project_list @project_list end |
#run_cpd ⇒ Object (readonly)
Returns the value of attribute run_cpd.
40 41 42 |
# File 'lib/pmdtester/parsers/options.rb', line 40 def run_cpd @run_cpd end |
#run_pmd ⇒ Object (readonly)
Returns the value of attribute run_pmd.
41 42 43 |
# File 'lib/pmdtester/parsers/options.rb', line 41 def run_pmd @run_pmd end |
#threads ⇒ Object (readonly)
Returns the value of attribute threads.
31 32 33 |
# File 'lib/pmdtester/parsers/options.rb', line 31 def threads @threads end |