singapore_cpf_calculator 1.3.4 → 1.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (129) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/build.yml +37 -0
  3. data/.rubocop.yml +81 -0
  4. data/.rubocop_todo.yml +326 -0
  5. data/README.md +2 -0
  6. data/lib/singapore_cpf_calculator/age_group.rb +27 -5
  7. data/lib/singapore_cpf_calculator/base_calculator.rb +14 -2
  8. data/lib/singapore_cpf_calculator/requirements/group_above_65_to_70_years.rb +13 -0
  9. data/lib/singapore_cpf_calculator/requirements/group_above_70_years.rb +13 -0
  10. data/lib/singapore_cpf_calculator/requirements.rb +3 -0
  11. data/lib/singapore_cpf_calculator/residency_module_common.rb +5 -1
  12. data/lib/singapore_cpf_calculator/version.rb +1 -1
  13. data/lib/singapore_cpf_calculator/year_2016.rb +2 -2
  14. data/lib/singapore_cpf_calculator/year_2022/citizen_or_spr_3/age_55_below_contribution_calculator.rb +8 -0
  15. data/lib/singapore_cpf_calculator/year_2022/citizen_or_spr_3/age_55_to_60_contribution_calculator.rb +32 -0
  16. data/lib/singapore_cpf_calculator/year_2022/citizen_or_spr_3/age_60_to_65_contribution_calculator.rb +32 -0
  17. data/lib/singapore_cpf_calculator/year_2022/citizen_or_spr_3/age_65_to_70_contribution_calculator.rb +32 -0
  18. data/lib/singapore_cpf_calculator/year_2022/citizen_or_spr_3/age_70_up_contribution_calculator.rb +32 -0
  19. data/lib/singapore_cpf_calculator/year_2022/citizen_or_spr_3/citizen_or_spr3_base.rb +9 -0
  20. data/lib/singapore_cpf_calculator/year_2022/citizen_or_spr_3.rb +40 -0
  21. data/lib/singapore_cpf_calculator/year_2022/spr_1_fg/age_55_below_contribution_calculator.rb +11 -0
  22. data/lib/singapore_cpf_calculator/year_2022/spr_1_fg/age_55_to_60_contribution_calculator.rb +32 -0
  23. data/lib/singapore_cpf_calculator/year_2022/spr_1_fg/age_60_to_65_contribution_calculator.rb +32 -0
  24. data/lib/singapore_cpf_calculator/year_2022/spr_1_fg/age_65_to_70_contribution_calculator.rb +32 -0
  25. data/lib/singapore_cpf_calculator/year_2022/spr_1_fg/age_70_up_contribution_calculator.rb +32 -0
  26. data/lib/singapore_cpf_calculator/year_2022/spr_1_fg.rb +40 -0
  27. data/lib/singapore_cpf_calculator/year_2022/spr_1_gg/age_55_below_contribution_calculator.rb +11 -0
  28. data/lib/singapore_cpf_calculator/year_2022/spr_1_gg/age_55_to_60_contribution_calculator.rb +12 -0
  29. data/lib/singapore_cpf_calculator/year_2022/spr_1_gg/age_60_to_65_contribution_calculator.rb +11 -0
  30. data/lib/singapore_cpf_calculator/year_2022/spr_1_gg/age_65_up_contribution_calculator.rb +14 -0
  31. data/lib/singapore_cpf_calculator/year_2022/spr_1_gg.rb +34 -0
  32. data/lib/singapore_cpf_calculator/year_2022/spr_2_fg/age_55_below_contribution_calculator.rb +11 -0
  33. data/lib/singapore_cpf_calculator/year_2022/spr_2_fg/age_55_to_60_contribution_calculator.rb +32 -0
  34. data/lib/singapore_cpf_calculator/year_2022/spr_2_fg/age_60_to_65_contribution_calculator.rb +32 -0
  35. data/lib/singapore_cpf_calculator/year_2022/spr_2_fg/age_65_to_70_contribution_calculator.rb +32 -0
  36. data/lib/singapore_cpf_calculator/year_2022/spr_2_fg/age_70_up_contribution_calculator.rb +32 -0
  37. data/lib/singapore_cpf_calculator/year_2022/spr_2_fg.rb +40 -0
  38. data/lib/singapore_cpf_calculator/year_2022/spr_2_gg/age_55_below_contribution_calculator.rb +11 -0
  39. data/lib/singapore_cpf_calculator/year_2022/spr_2_gg/age_55_to_60_contribution_calculator.rb +11 -0
  40. data/lib/singapore_cpf_calculator/year_2022/spr_2_gg/age_60_to_65_contribution_calculator.rb +11 -0
  41. data/lib/singapore_cpf_calculator/year_2022/spr_2_gg/age_65_up_contribution_calculator.rb +11 -0
  42. data/lib/singapore_cpf_calculator/year_2022/spr_2_gg.rb +34 -0
  43. data/lib/singapore_cpf_calculator/year_2022.rb +35 -0
  44. data/lib/singapore_cpf_calculator/year_2023/citizen_or_spr_3/age_55_below_contribution_calculator.rb +8 -0
  45. data/lib/singapore_cpf_calculator/year_2023/citizen_or_spr_3/age_55_to_60_contribution_calculator.rb +32 -0
  46. data/lib/singapore_cpf_calculator/year_2023/citizen_or_spr_3/age_60_to_65_contribution_calculator.rb +32 -0
  47. data/lib/singapore_cpf_calculator/year_2023/citizen_or_spr_3/age_65_to_70_contribution_calculator.rb +32 -0
  48. data/lib/singapore_cpf_calculator/year_2023/citizen_or_spr_3/age_70_up_contribution_calculator.rb +9 -0
  49. data/lib/singapore_cpf_calculator/year_2023/citizen_or_spr_3/citizen_or_spr3_base.rb +8 -0
  50. data/lib/singapore_cpf_calculator/year_2023/citizen_or_spr_3.rb +40 -0
  51. data/lib/singapore_cpf_calculator/year_2023/spr_1_fg/age_55_below_contribution_calculator.rb +11 -0
  52. data/lib/singapore_cpf_calculator/year_2023/spr_1_fg/age_55_to_60_contribution_calculator.rb +32 -0
  53. data/lib/singapore_cpf_calculator/year_2023/spr_1_fg/age_60_to_65_contribution_calculator.rb +32 -0
  54. data/lib/singapore_cpf_calculator/year_2023/spr_1_fg/age_65_to_70_contribution_calculator.rb +32 -0
  55. data/lib/singapore_cpf_calculator/year_2023/spr_1_fg/age_70_up_contribution_calculator.rb +8 -0
  56. data/lib/singapore_cpf_calculator/year_2023/spr_1_fg.rb +40 -0
  57. data/lib/singapore_cpf_calculator/year_2023/spr_1_gg.rb +29 -0
  58. data/lib/singapore_cpf_calculator/year_2023/spr_2_fg/age_55_below_contribution_calculator.rb +11 -0
  59. data/lib/singapore_cpf_calculator/year_2023/spr_2_fg/age_55_to_60_contribution_calculator.rb +32 -0
  60. data/lib/singapore_cpf_calculator/year_2023/spr_2_fg/age_60_to_65_contribution_calculator.rb +32 -0
  61. data/lib/singapore_cpf_calculator/year_2023/spr_2_fg/age_65_to_70_contribution_calculator.rb +32 -0
  62. data/lib/singapore_cpf_calculator/year_2023/spr_2_fg/age_70_up_contribution_calculator.rb +8 -0
  63. data/lib/singapore_cpf_calculator/year_2023/spr_2_fg.rb +40 -0
  64. data/lib/singapore_cpf_calculator/year_2023/spr_2_gg.rb +29 -0
  65. data/lib/singapore_cpf_calculator/year_2023/year_2023.rb +35 -0
  66. data/lib/singapore_cpf_calculator/year_2023.rb +35 -0
  67. data/lib/singapore_cpf_calculator.rb +10 -1
  68. data/singapore_cpf_calculator.gemspec +5 -3
  69. data/spec/singapore_cpf_calculator/age_group_spec.rb +15 -3
  70. data/spec/singapore_cpf_calculator/year_2016/citizen_or_spr_3/age_55_to_60_contribution_calculator_spec.rb +1 -1
  71. data/spec/singapore_cpf_calculator/year_2016/citizen_or_spr_3/age_60_to_65_contribution_calculator_spec.rb +2 -2
  72. data/spec/singapore_cpf_calculator/year_2016/citizen_or_spr_3_spec.rb +3 -3
  73. data/spec/singapore_cpf_calculator/year_2016/spr_1_fg/age_55_to_60_contribution_calculator_spec.rb +1 -1
  74. data/spec/singapore_cpf_calculator/year_2016/spr_1_fg/age_60_to_65_contribution_calculator_spec.rb +1 -1
  75. data/spec/singapore_cpf_calculator/year_2016/spr_2_fg/age_60_to_65_contribution_calculator_spec.rb +1 -1
  76. data/spec/singapore_cpf_calculator/year_2022/citizen_or_spr_3/age_55_below_contribution_calculator_spec.rb +63 -0
  77. data/spec/singapore_cpf_calculator/year_2022/citizen_or_spr_3/age_55_to_60_contribution_calculator_spec.rb +63 -0
  78. data/spec/singapore_cpf_calculator/year_2022/citizen_or_spr_3/age_60_to_65_contribution_calculator_spec.rb +63 -0
  79. data/spec/singapore_cpf_calculator/year_2022/citizen_or_spr_3/age_65_to_70_contribution_calculator_spec.rb +63 -0
  80. data/spec/singapore_cpf_calculator/year_2022/citizen_or_spr_3/age_70_up_contribution_spec.rb +63 -0
  81. data/spec/singapore_cpf_calculator/year_2022/citizen_or_spr_3_spec.rb +242 -0
  82. data/spec/singapore_cpf_calculator/year_2022/spr_1_fg/age_55_below_contribution_calculator_spec.rb +63 -0
  83. data/spec/singapore_cpf_calculator/year_2022/spr_1_fg/age_55_to_60_contribution_calculator_spec.rb +63 -0
  84. data/spec/singapore_cpf_calculator/year_2022/spr_1_fg/age_60_to_65_contribution_calculator_spec.rb +63 -0
  85. data/spec/singapore_cpf_calculator/year_2022/spr_1_fg/age_65_to_70_contribution_calculator_spec.rb +63 -0
  86. data/spec/singapore_cpf_calculator/year_2022/spr_1_fg/age_70_up_contribution_calculator_spec.rb +63 -0
  87. data/spec/singapore_cpf_calculator/year_2022/spr_1_fg_spec.rb +176 -0
  88. data/spec/singapore_cpf_calculator/year_2022/spr_1_gg/age_55_below_contribution_calculator_spec.rb +63 -0
  89. data/spec/singapore_cpf_calculator/year_2022/spr_1_gg/age_55_to_60_contribution_calculator_spec.rb +63 -0
  90. data/spec/singapore_cpf_calculator/year_2022/spr_1_gg/age_60_to_65_contribution_calculator_spec.rb +63 -0
  91. data/spec/singapore_cpf_calculator/year_2022/spr_1_gg/age_65_up_contribution_calculator_spec.rb +63 -0
  92. data/spec/singapore_cpf_calculator/year_2022/spr_1_gg_spec.rb +158 -0
  93. data/spec/singapore_cpf_calculator/year_2022/spr_2_fg/age_55_below_contribution_calculator_spec.rb +63 -0
  94. data/spec/singapore_cpf_calculator/year_2022/spr_2_fg/age_55_to_60_contribution_calculator_spec.rb +63 -0
  95. data/spec/singapore_cpf_calculator/year_2022/spr_2_fg/age_60_to_65_contribution_calculator_spec.rb +63 -0
  96. data/spec/singapore_cpf_calculator/year_2022/spr_2_fg/age_65_to_70_contribution_calculator_spec.rb +63 -0
  97. data/spec/singapore_cpf_calculator/year_2022/spr_2_fg/age_70_up_contribution_calculator_spec.rb +63 -0
  98. data/spec/singapore_cpf_calculator/year_2022/spr_2_fg_spec.rb +176 -0
  99. data/spec/singapore_cpf_calculator/year_2022/spr_2_gg/age_55_below_contribution_calculator_spec.rb +63 -0
  100. data/spec/singapore_cpf_calculator/year_2022/spr_2_gg/age_55_to_60_contribution_calculator_spec.rb +63 -0
  101. data/spec/singapore_cpf_calculator/year_2022/spr_2_gg/age_60_to_65_contribution_calculator_spec.rb +63 -0
  102. data/spec/singapore_cpf_calculator/year_2022/spr_2_gg/age_65_up_contribution_calculator_spec.rb +63 -0
  103. data/spec/singapore_cpf_calculator/year_2022/spr_2_gg_spec.rb +158 -0
  104. data/spec/singapore_cpf_calculator/year_2022_spec.rb +192 -0
  105. data/spec/singapore_cpf_calculator/year_2023/citizen_or_spr_3/age_55_below_contribution_calculator_spec.rb +63 -0
  106. data/spec/singapore_cpf_calculator/year_2023/citizen_or_spr_3/age_55_to_60_contribution_calculator_spec.rb +63 -0
  107. data/spec/singapore_cpf_calculator/year_2023/citizen_or_spr_3/age_60_to_65_contribution_calculator_spec.rb +63 -0
  108. data/spec/singapore_cpf_calculator/year_2023/citizen_or_spr_3/age_65_to_70_contribution_calculator_spec.rb +63 -0
  109. data/spec/singapore_cpf_calculator/year_2023/citizen_or_spr_3/age_70_up_contribution_spec.rb +63 -0
  110. data/spec/singapore_cpf_calculator/year_2023/citizen_or_spr_3_spec.rb +242 -0
  111. data/spec/singapore_cpf_calculator/year_2023/spr_1_fg/age_55_below_contribution_calculator_spec.rb +63 -0
  112. data/spec/singapore_cpf_calculator/year_2023/spr_1_fg/age_55_to_60_contribution_calculator_spec.rb +63 -0
  113. data/spec/singapore_cpf_calculator/year_2023/spr_1_fg/age_60_to_65_contribution_calculator_spec.rb +63 -0
  114. data/spec/singapore_cpf_calculator/year_2023/spr_1_fg/age_65_to_70_contribution_calculator_spec.rb +63 -0
  115. data/spec/singapore_cpf_calculator/year_2023/spr_1_fg/age_70_up_contribution_calculator_spec.rb +63 -0
  116. data/spec/singapore_cpf_calculator/year_2023/spr_1_fg_spec.rb +176 -0
  117. data/spec/singapore_cpf_calculator/year_2023/spr_1_gg_spec.rb +158 -0
  118. data/spec/singapore_cpf_calculator/year_2023/spr_2_fg/age_55_below_contribution_calculator_spec.rb +63 -0
  119. data/spec/singapore_cpf_calculator/year_2023/spr_2_fg/age_55_to_60_contribution_calculator_spec.rb +63 -0
  120. data/spec/singapore_cpf_calculator/year_2023/spr_2_fg/age_60_to_65_contribution_calculator_spec.rb +63 -0
  121. data/spec/singapore_cpf_calculator/year_2023/spr_2_fg/age_65_to_70_contribution_calculator_spec.rb +63 -0
  122. data/spec/singapore_cpf_calculator/year_2023/spr_2_fg/age_70_up_contribution_calculator_spec.rb +63 -0
  123. data/spec/singapore_cpf_calculator/year_2023/spr_2_fg_spec.rb +176 -0
  124. data/spec/singapore_cpf_calculator/year_2023/spr_2_gg_spec.rb +158 -0
  125. data/spec/singapore_cpf_calculator/year_2023_spec.rb +193 -0
  126. data/spec/singapore_cpf_calculator_spec.rb +58 -20
  127. data/spec/spec_helper.rb +6 -1
  128. metadata +148 -104
  129. data/.travis.yml +0 -15
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2b0d8aa374278f946ccb6f54e778961317d15d455a0f0eeae1eb4bd4af7b251a
4
- data.tar.gz: a711ea455d39a43a8d3dc2b598c02db1a35e8e95b15121139a53b4dbb6640255
3
+ metadata.gz: 2b85cdba0115d5685010383b5b5772ff9f6ef4ba72e04b30f33cbfb9e3b62985
4
+ data.tar.gz: e388948f1433617bcfd6d3a6f9bf840a7c44ce5d6571281d42554903303aa29e
5
5
  SHA512:
6
- metadata.gz: bb687c0f164156933033b3b2a8a2a00231d62c761e0c10aa8ee4d4569c98addf63d2cf9e6a30fcb8beaa4070a33e7e58defeae7fe1ea5127f11c7efb0f376e29
7
- data.tar.gz: 6969152787d83f823a60087d293b9eeea8267ae5e871ea7b3a0d9cb8712a4dc91e74e89a7b2f0d089dad70a41ce9e9abeb4ecdf2a47fba2ea370d1cd2b2346a7
6
+ metadata.gz: ec11e37d2f9f5b22edfac103eaf3bf033049d08af50de054d56ba62b7b03a4becb27c226eb18b3a5ab08f38e12d8db1e2712cd788e46370b211c42949a1bbd84
7
+ data.tar.gz: a389646868afe3c426e6d47044d87f4985841033efe7bb1b3dad0e3aee81f39c7361b55eb38b07e384e95cd342b9bd3be13adf7576ba98ec19145861cfd67c13
@@ -0,0 +1,37 @@
1
+ # This workflow uses actions that are not certified by GitHub.
2
+ # They are provided by a third-party and are governed by
3
+ # separate terms of service, privacy policy, and support
4
+ # documentation.
5
+ # This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
6
+ # For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
7
+
8
+ name: build
9
+
10
+ on: [push, pull_request]
11
+
12
+ jobs:
13
+ test:
14
+ runs-on: ubuntu-20.04
15
+ strategy:
16
+ fail-fast: false
17
+ matrix:
18
+ ruby:
19
+ - 3.2
20
+ - 3.1
21
+ - '3.0'
22
+ - 2.7
23
+ - 2.6
24
+ - 2.5
25
+ - jruby-9.2.17.0
26
+ - jruby-9.3.3.0
27
+
28
+ steps:
29
+ - uses: actions/checkout@v2
30
+ - uses: ruby/setup-ruby@v1
31
+ with:
32
+ ruby-version: ${{ matrix.ruby }}
33
+ bundler-cache: true
34
+ - name: RSpec Test suite
35
+ run: bundle exec rspec
36
+ - name: Rubocop Linter
37
+ run: bundle exec rubocop
data/.rubocop.yml ADDED
@@ -0,0 +1,81 @@
1
+ inherit_from: .rubocop_todo.yml
2
+
3
+ AllCops:
4
+ NewCops: enable
5
+
6
+ Style/StringLiterals:
7
+ Enabled: false
8
+ Layout/SpaceInsideParens:
9
+ Enabled: false
10
+ Layout/SpaceInsideStringInterpolation:
11
+ Enabled: false
12
+ Layout/EmptyLinesAroundBlockBody:
13
+ Enabled: false
14
+ Style/FrozenStringLiteralComment:
15
+ Enabled: false
16
+ Layout/SpaceInsideBlockBraces:
17
+ Enabled: false
18
+ Metrics/BlockLength:
19
+ IgnoredMethods:
20
+ - describe
21
+ - context
22
+ - foreach # CSV parsing
23
+
24
+ Layout/DotPosition:
25
+ EnforcedStyle: trailing
26
+ Enabled: true
27
+
28
+ Layout/LineLength:
29
+ Max: 120
30
+
31
+ Metrics/AbcSize:
32
+ Max: 15
33
+ IgnoredMethods:
34
+ - is_cpf_equal?
35
+ - calculated_employee_contribution
36
+ - calculated_total_contribution
37
+ - age_grouping_for_2022_and_later
38
+ - age_grouping_for_2015_and_earlier
39
+
40
+ Metrics/ClassLength:
41
+ Max: 40
42
+ Exclude:
43
+ - lib/singapore_cpf_calculator/age_group.rb
44
+ - lib/singapore_cpf_calculator/base_calculator.rb
45
+
46
+ Metrics/CyclomaticComplexity:
47
+ Max: 6
48
+ IgnoredMethods:
49
+ - is_cpf_equal?
50
+ - age_grouping_for_2015_and_earlier
51
+ - age_grouping_for_2015_and_later
52
+ - age_grouping_for_2022_and_later
53
+ - validate_params
54
+
55
+ ## Configuration parameters: CountComments, CountAsOne, ExcludedMethods, .
56
+ Metrics/MethodLength:
57
+ Max: 7
58
+ IgnoredMethods:
59
+ - is_cpf_equal?
60
+ - age_grouping_for_2015_and_earlier
61
+ - age_grouping_for_2016_and_later
62
+ - age_grouping_for_2022_and_later
63
+ - calculated_employee_contribution
64
+ - calculated_total_contribution
65
+ - calculate
66
+ - residency_modules
67
+ - validate_params
68
+
69
+ Metrics/ParameterLists:
70
+ Max: 5
71
+ Exclude:
72
+ - lib/singapore_cpf_calculator.rb
73
+
74
+ Metrics/PerceivedComplexity:
75
+ Max: 7
76
+ IgnoredMethods:
77
+ - is_cpf_equal?
78
+ - age_grouping_for_2015_and_earlier
79
+ - age_grouping_for_2015_and_later
80
+ - age_grouping_for_2022_and_later
81
+ - validate_params
data/.rubocop_todo.yml ADDED
@@ -0,0 +1,326 @@
1
+ # This configuration was generated by
2
+ # `rubocop --auto-gen-config`
3
+ # on 2022-03-16 01:46:16 UTC using RuboCop version 1.26.0.
4
+ # The point is for the user to remove these configuration records
5
+ # one by one as the offenses are removed from the code base.
6
+ # Note that changes in the inspected code, or installation of new
7
+ # versions of RuboCop, may require this file to be generated again.
8
+
9
+ # Offense count: 1
10
+ # This cop supports safe auto-correction (--auto-correct).
11
+ # Configuration parameters: TreatCommentsAsGroupSeparators, ConsiderPunctuation, Include.
12
+ # Include: **/*.gemfile, **/Gemfile, **/gems.rb
13
+ Bundler/OrderedGems:
14
+ Exclude:
15
+ - 'Gemfile'
16
+
17
+ # Offense count: 1
18
+ # Configuration parameters: Include.
19
+ # Include: **/*.gemspec
20
+ Gemspec/RequiredRubyVersion:
21
+ Exclude:
22
+ - 'singapore_cpf_calculator.gemspec'
23
+
24
+ # Offense count: 3
25
+ # This cop supports safe auto-correction (--auto-correct).
26
+ # Configuration parameters: EnforcedStyle, IndentationWidth.
27
+ # SupportedStyles: with_first_argument, with_fixed_indentation
28
+ Layout/ArgumentAlignment:
29
+ Exclude:
30
+ - 'spec/singapore_cpf_calculator_spec.rb'
31
+
32
+ # Offense count: 1
33
+ # This cop supports safe auto-correction (--auto-correct).
34
+ # Configuration parameters: EnforcedStyleAlignWith.
35
+ # SupportedStylesAlignWith: either, start_of_block, start_of_line
36
+ Layout/BlockAlignment:
37
+ Exclude:
38
+ - 'spec/singapore_cpf_calculator/year_2014/citizen_or_spr_3_spec.rb'
39
+
40
+ # Offense count: 2
41
+ # This cop supports safe auto-correction (--auto-correct).
42
+ Layout/ClosingParenthesisIndentation:
43
+ Exclude:
44
+ - 'lib/singapore_cpf_calculator/citizen_or_spr_3_common.rb'
45
+
46
+ # Offense count: 1
47
+ # This cop supports safe auto-correction (--auto-correct).
48
+ # Configuration parameters: EnforcedStyleAlignWith, Severity.
49
+ # SupportedStylesAlignWith: start_of_line, def
50
+ Layout/DefEndAlignment:
51
+ Exclude:
52
+ - 'lib/singapore_cpf_calculator/year_2022.rb'
53
+
54
+ # Offense count: 1
55
+ # This cop supports safe auto-correction (--auto-correct).
56
+ Layout/EmptyLineAfterGuardClause:
57
+ Exclude:
58
+ - 'lib/singapore_cpf_calculator.rb'
59
+
60
+ # Offense count: 1
61
+ # This cop supports safe auto-correction (--auto-correct).
62
+ Layout/EmptyLineAfterMagicComment:
63
+ Exclude:
64
+ - 'singapore_cpf_calculator.gemspec'
65
+
66
+ # Offense count: 21
67
+ # This cop supports safe auto-correction (--auto-correct).
68
+ Layout/EmptyLines:
69
+ Exclude:
70
+ - 'lib/singapore_cpf_calculator/year_2014/citizen_or_spr_3/age_50_to_55_contribution_calculator.rb'
71
+ - 'lib/singapore_cpf_calculator/year_2014/spr_1_fg/age_50_below_contribution_calculator.rb'
72
+ - 'lib/singapore_cpf_calculator/year_2015/spr_1_fg.rb'
73
+ - 'lib/singapore_cpf_calculator/year_2016/spr_1_fg.rb'
74
+ - 'spec/singapore_cpf_calculator/year_2014_spec.rb'
75
+ - 'spec/singapore_cpf_calculator/year_2015_spec.rb'
76
+ - 'spec/singapore_cpf_calculator/year_2016_spec.rb'
77
+ - 'spec/singapore_cpf_calculator/year_2022_spec.rb'
78
+
79
+ # Offense count: 230
80
+ # This cop supports safe auto-correction (--auto-correct).
81
+ # Configuration parameters: EnforcedStyle.
82
+ # SupportedStyles: empty_lines, empty_lines_except_namespace, empty_lines_special, no_empty_lines, beginning_only, ending_only
83
+ Layout/EmptyLinesAroundClassBody:
84
+ Enabled: false
85
+
86
+ # Offense count: 327
87
+ # This cop supports safe auto-correction (--auto-correct).
88
+ # Configuration parameters: EnforcedStyle.
89
+ # SupportedStyles: empty_lines, empty_lines_except_namespace, empty_lines_special, no_empty_lines
90
+ Layout/EmptyLinesAroundModuleBody:
91
+ Enabled: false
92
+
93
+ # Offense count: 2
94
+ # This cop supports safe auto-correction (--auto-correct).
95
+ # Configuration parameters: AllowForAlignment, AllowBeforeTrailingComments, ForceEqualSignAlignment.
96
+ Layout/ExtraSpacing:
97
+ Exclude:
98
+ - 'lib/singapore_cpf_calculator/year_2016/citizen_or_spr_3/age_55_to_60_contribution_calculator.rb'
99
+ - 'lib/singapore_cpf_calculator/year_2022/citizen_or_spr_3/age_55_to_60_contribution_calculator.rb'
100
+
101
+ # Offense count: 3
102
+ # This cop supports safe auto-correction (--auto-correct).
103
+ # Configuration parameters: AllowMultipleStyles, EnforcedHashRocketStyle, EnforcedColonStyle, EnforcedLastArgumentHashStyle.
104
+ # SupportedHashRocketStyles: key, separator, table
105
+ # SupportedColonStyles: key, separator, table
106
+ # SupportedLastArgumentHashStyles: always_inspect, always_ignore, ignore_implicit, ignore_explicit
107
+ Layout/HashAlignment:
108
+ Exclude:
109
+ - 'spec/singapore_cpf_calculator_spec.rb'
110
+
111
+ # Offense count: 2
112
+ # This cop supports safe auto-correction (--auto-correct).
113
+ # Configuration parameters: EnforcedStyle.
114
+ # SupportedStyles: normal, indented_internal_methods
115
+ Layout/IndentationConsistency:
116
+ Exclude:
117
+ - 'lib/singapore_cpf_calculator/year_2022.rb'
118
+ - 'spec/singapore_cpf_calculator/year_2014/citizen_or_spr_3_spec.rb'
119
+
120
+ # Offense count: 2
121
+ # This cop supports safe auto-correction (--auto-correct).
122
+ # Configuration parameters: Width, IgnoredPatterns.
123
+ Layout/IndentationWidth:
124
+ Exclude:
125
+ - 'lib/singapore_cpf_calculator/year_2022.rb'
126
+
127
+ # Offense count: 4
128
+ # This cop supports safe auto-correction (--auto-correct).
129
+ Layout/LeadingEmptyLines:
130
+ Exclude:
131
+ - 'lib/singapore_cpf_calculator/spr_1_fg_common.rb'
132
+ - 'lib/singapore_cpf_calculator/spr_1_gg_common.rb'
133
+ - 'lib/singapore_cpf_calculator/spr_2_fg_common.rb'
134
+ - 'lib/singapore_cpf_calculator/spr_2_gg_common.rb'
135
+
136
+ # Offense count: 2
137
+ # This cop supports safe auto-correction (--auto-correct).
138
+ # Configuration parameters: AllowForAlignment, EnforcedStyleForExponentOperator.
139
+ # SupportedStylesForExponentOperator: space, no_space
140
+ Layout/SpaceAroundOperators:
141
+ Exclude:
142
+ - 'lib/singapore_cpf_calculator/year_2016/citizen_or_spr_3/age_55_to_60_contribution_calculator.rb'
143
+ - 'lib/singapore_cpf_calculator/year_2022/citizen_or_spr_3/age_55_to_60_contribution_calculator.rb'
144
+
145
+ # Offense count: 2
146
+ # This cop supports safe auto-correction (--auto-correct).
147
+ Layout/SpaceBeforeComma:
148
+ Exclude:
149
+ - 'spec/singapore_cpf_calculator/year_2016/spr_2_gg/age_55_to_60_contribution_calculator_spec.rb'
150
+ - 'spec/singapore_cpf_calculator/year_2022/spr_2_gg/age_55_to_60_contribution_calculator_spec.rb'
151
+
152
+ # Offense count: 2
153
+ # This cop supports safe auto-correction (--auto-correct).
154
+ # Configuration parameters: EnforcedStyleForEmptyBraces.
155
+ # SupportedStyles: space, no_space, compact
156
+ # SupportedStylesForEmptyBraces: space, no_space
157
+ Layout/SpaceInsideHashLiteralBraces:
158
+ EnforcedStyle: no_space
159
+
160
+ # Offense count: 2
161
+ # This cop supports safe auto-correction (--auto-correct).
162
+ # Configuration parameters: EnforcedStyle.
163
+ # SupportedStyles: final_newline, final_blank_line
164
+ Layout/TrailingEmptyLines:
165
+ Exclude:
166
+ - 'Rakefile'
167
+ - 'lib/singapore_cpf_calculator/requirements.rb'
168
+
169
+ # Offense count: 2
170
+ # This cop supports safe auto-correction (--auto-correct).
171
+ # Configuration parameters: AllowUnusedKeywordArguments, IgnoreEmptyMethods, IgnoreNotImplementedMethods.
172
+ Lint/UnusedMethodArgument:
173
+ Exclude:
174
+ - 'lib/singapore_cpf_calculator/before_spr.rb'
175
+
176
+ # Offense count: 152
177
+ # Configuration parameters: EnforcedStyle, CheckMethodNames, CheckSymbols, AllowedIdentifiers.
178
+ # SupportedStyles: snake_case, normalcase, non_integer
179
+ Naming/VariableNumber:
180
+ Enabled: false
181
+
182
+ # Offense count: 1
183
+ # This cop supports safe auto-correction (--auto-correct).
184
+ Style/BlockComments:
185
+ Exclude:
186
+ - 'spec/spec_helper.rb'
187
+
188
+ # Offense count: 127
189
+ # This cop supports safe auto-correction (--auto-correct).
190
+ # Configuration parameters: EnforcedStyle, ProceduralMethods, FunctionalMethods, IgnoredMethods, AllowBracesOnProceduralOneLiners, BracesRequiredMethods.
191
+ # SupportedStyles: line_count_based, semantic, braces_for_chaining, always_braces
192
+ # ProceduralMethods: benchmark, bm, bmbm, create, each_with_object, measure, new, realtime, tap, with_object
193
+ # FunctionalMethods: let, let!, subject, watch
194
+ # IgnoredMethods: lambda, proc, it
195
+ Style/BlockDelimiters:
196
+ Enabled: false
197
+
198
+ # Offense count: 1
199
+ # This cop supports safe auto-correction (--auto-correct).
200
+ # Configuration parameters: EnforcedStyle.
201
+ # SupportedStyles: is_a?, kind_of?
202
+ Style/ClassCheck:
203
+ Exclude:
204
+ - 'lib/singapore_cpf_calculator/cpf_contribution.rb'
205
+
206
+ # Offense count: 14
207
+ # Configuration parameters: AllowedConstants.
208
+ Style/Documentation:
209
+ Exclude:
210
+ - 'spec/**/*'
211
+ - 'test/**/*'
212
+ - 'lib/singapore_cpf_calculator.rb'
213
+ - 'lib/singapore_cpf_calculator/requirements.rb'
214
+ - 'lib/singapore_cpf_calculator/requirements/group_50_years_and_below.rb'
215
+ - 'lib/singapore_cpf_calculator/requirements/group_55_years_and_below.rb'
216
+ - 'lib/singapore_cpf_calculator/requirements/group_above_50_to_55_years.rb'
217
+ - 'lib/singapore_cpf_calculator/requirements/group_above_55_to_60_years.rb'
218
+ - 'lib/singapore_cpf_calculator/requirements/group_above_60_to_65_years.rb'
219
+ - 'lib/singapore_cpf_calculator/requirements/group_above_65_to_70_years.rb'
220
+ - 'lib/singapore_cpf_calculator/requirements/group_above_65_years.rb'
221
+ - 'lib/singapore_cpf_calculator/requirements/group_above_70_years.rb'
222
+ - 'lib/singapore_cpf_calculator/residency_module_common.rb'
223
+ - 'lib/singapore_cpf_calculator/spr_status.rb'
224
+ - 'lib/singapore_cpf_calculator/year_2012_to_2015_aw_ceiling_module.rb'
225
+ - 'lib/singapore_cpf_calculator/year_common.rb'
226
+
227
+ # Offense count: 6
228
+ # This cop supports safe auto-correction (--auto-correct).
229
+ Style/EmptyCaseCondition:
230
+ Exclude:
231
+ - 'lib/singapore_cpf_calculator/age_group.rb'
232
+ - 'lib/singapore_cpf_calculator/base_calculator.rb'
233
+ - 'lib/singapore_cpf_calculator/spr_status.rb'
234
+
235
+ # Offense count: 1
236
+ # This cop supports safe auto-correction (--auto-correct).
237
+ # Configuration parameters: EnforcedStyle.
238
+ # SupportedStyles: empty, nil, both
239
+ Style/EmptyElse:
240
+ Exclude:
241
+ - 'lib/singapore_cpf_calculator/spr_status.rb'
242
+
243
+ # Offense count: 1
244
+ # This cop supports safe auto-correction (--auto-correct).
245
+ Style/Encoding:
246
+ Exclude:
247
+ - 'singapore_cpf_calculator.gemspec'
248
+
249
+ # Offense count: 1
250
+ # This cop supports safe auto-correction (--auto-correct).
251
+ Style/ExpandPathArguments:
252
+ Exclude:
253
+ - 'singapore_cpf_calculator.gemspec'
254
+
255
+ # Offense count: 2
256
+ # Configuration parameters: MinBodyLength.
257
+ Style/GuardClause:
258
+ Exclude:
259
+ - 'lib/singapore_cpf_calculator.rb'
260
+ - 'lib/singapore_cpf_calculator/base_calculator.rb'
261
+
262
+ # Offense count: 1
263
+ # This cop supports safe auto-correction (--auto-correct).
264
+ Style/KeywordParametersOrder:
265
+ Exclude:
266
+ - 'lib/singapore_cpf_calculator.rb'
267
+
268
+ # Offense count: 1
269
+ # This cop supports safe auto-correction (--auto-correct).
270
+ Style/LineEndConcatenation:
271
+ Exclude:
272
+ - 'spec/spec_helper.rb'
273
+
274
+ # Offense count: 1
275
+ # This cop supports safe auto-correction (--auto-correct).
276
+ # Configuration parameters: IgnoredMethods.
277
+ Style/MethodCallWithoutArgsParentheses:
278
+ Exclude:
279
+ - 'lib/singapore_cpf_calculator/base_calculator.rb'
280
+
281
+ # Offense count: 1
282
+ # This cop supports safe auto-correction (--auto-correct).
283
+ # Configuration parameters: EnforcedStyle.
284
+ # SupportedStyles: literals, strict
285
+ Style/MutableConstant:
286
+ Exclude:
287
+ - 'lib/singapore_cpf_calculator/version.rb'
288
+
289
+ # Offense count: 12
290
+ # This cop supports safe auto-correction (--auto-correct).
291
+ # Configuration parameters: AllowedMethods.
292
+ # AllowedMethods: be, be_a, be_an, be_between, be_falsey, be_kind_of, be_instance_of, be_truthy, be_within, eq, eql, end_with, include, match, raise_error, respond_to, start_with
293
+ Style/NestedParenthesizedCalls:
294
+ Exclude:
295
+ - 'spec/singapore_cpf_calculator/year_2014_spec.rb'
296
+ - 'spec/singapore_cpf_calculator/year_2015_spec.rb'
297
+ - 'spec/singapore_cpf_calculator/year_2016_spec.rb'
298
+ - 'spec/singapore_cpf_calculator/year_2022_spec.rb'
299
+
300
+ # Offense count: 24
301
+ # This cop supports safe auto-correction (--auto-correct).
302
+ # Configuration parameters: EnforcedStyleForMultiline.
303
+ # SupportedStylesForMultiline: comma, consistent_comma, no_comma
304
+ Style/TrailingCommaInArrayLiteral:
305
+ Enabled: false
306
+
307
+ # Offense count: 1
308
+ # This cop supports safe auto-correction (--auto-correct).
309
+ # Configuration parameters: MinSize, WordRegex.
310
+ # SupportedStyles: percent, brackets
311
+ Style/WordArray:
312
+ EnforcedStyle: brackets
313
+
314
+ # Offense count: 8
315
+ # This cop supports unsafe auto-correction (--auto-correct-all).
316
+ # Configuration parameters: EnforcedStyle.
317
+ # SupportedStyles: forbid_for_all_comparison_operators, forbid_for_equality_operators_only, require_for_all_comparison_operators, require_for_equality_operators_only
318
+ Style/YodaCondition:
319
+ Exclude:
320
+ - 'lib/singapore_cpf_calculator/age_group.rb'
321
+
322
+ # Offense count: 1
323
+ # This cop supports safe auto-correction (--auto-correct).
324
+ # Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
325
+ # URISchemes: http, https
326
+
data/README.md CHANGED
@@ -11,6 +11,8 @@ Central Provident Fund (CPF) contributions.
11
11
 
12
12
  ## Support
13
13
 
14
+ * [Year 2023](https://www.cpf.gov.sg/content/dam/web/employer/employer-obligations/documents/CPF%20con%20rates%20from%201%20January%202023.pdf)
15
+ * [Year 2022](https://www.cpf.gov.sg/content/dam/web/employer/employer-obligations/documents/CPFContributionRatesTable_1Jan2022.pdf)
14
16
  * [Year 2015](http://mycpf.cpf.gov.sg/NR/rdonlyres/9F38419D-1342-4426-820E-32BA8FDE5C6D/0/CPFContributionandAllocationRatesfrom1January2015.pdf)
15
17
  * Singapore Citizens or Singapore Permanent Residents (3rd Year Onwards)
16
18
  * Singapore Permanent Residents (SPRs) during 1st Year of SPR Status
@@ -16,16 +16,19 @@ module SingaporeCPFCalculator
16
16
  # - :group_above_55_to_60_years
17
17
  # - :group_above_60_to_65_years
18
18
  # - :group_above_65_years
19
- def get(current_date, birthdate:)
20
- new(current_date, birthdate: birthdate).get
19
+ # - :group_above_65_to_70_years
20
+ # - :group_above_70_years
21
+ def get(current_date, birthdate:, has_70_up: false)
22
+ new(current_date, birthdate: birthdate, has_70_up: has_70_up).get
21
23
  end
22
24
  end
23
25
 
24
26
  # @param [Date] current_date
25
27
  # @param [Date] birthdate:
26
- def initialize(current_date, birthdate:)
28
+ def initialize(current_date, birthdate:, has_70_up:)
27
29
  @current_date = current_date
28
30
  @birthdate = birthdate
31
+ @has_70_up = has_70_up
29
32
  end
30
33
 
31
34
  # @return [Symbol] the symbol representation of the age group
@@ -35,17 +38,21 @@ module SingaporeCPFCalculator
35
38
  # - :group_above_55_to_60_years
36
39
  # - :group_above_60_to_65_years
37
40
  # - :group_above_65_years
41
+ # - :group_above_65_to_70_years
42
+ # - :group_above_70_years
38
43
  def get
39
44
  if current_date.year <= 2015
40
45
  age_grouping_for_2015_and_earlier
41
- else
46
+ elsif current_date.year <= 2021 || !has_70_up
42
47
  age_grouping_for_2016_and_later
48
+ else
49
+ age_grouping_for_2022_and_later
43
50
  end
44
51
  end
45
52
 
46
53
  private
47
54
 
48
- attr_reader :current_date, :birthdate
55
+ attr_reader :current_date, :birthdate, :has_70_up
49
56
 
50
57
  def age
51
58
  @age ||= effective_age
@@ -89,6 +96,21 @@ module SingaporeCPFCalculator
89
96
  end
90
97
  end
91
98
 
99
+ def age_grouping_for_2022_and_later
100
+ case
101
+ when age < 55
102
+ :group_55_years_and_below
103
+ when 55 <= age && age < 60
104
+ :group_above_55_to_60_years
105
+ when 60 <= age && age < 65
106
+ :group_above_60_to_65_years
107
+ when 65 <= age && age < 70
108
+ :group_above_65_to_70_years
109
+ else # 70 <= age
110
+ :group_above_70_years
111
+ end
112
+ end
113
+
92
114
  end
93
115
 
94
116
  end
@@ -5,8 +5,8 @@ module SingaporeCPFCalculator
5
5
  class << self
6
6
  # @param [Fixnum] age
7
7
  # @return [true, false] returns true if the calculator applies to the employee's age.
8
- def applies_to?(date, birthdate:)
9
- AgeGroup.get(date, birthdate: birthdate) == required_age_group
8
+ def applies_to?(date, birthdate:, has_70_up:)
9
+ AgeGroup.get(date, birthdate: birthdate, has_70_up: has_70_up) == required_age_group
10
10
  end
11
11
 
12
12
  # @param [BigDecimal] ordinary_wages:
@@ -31,7 +31,9 @@ module SingaporeCPFCalculator
31
31
  private
32
32
 
33
33
  def required_age_group
34
+ # :nocov:
34
35
  raise NotImplementedError, "sub classes needs to implement .required_age_group"
36
+ # :nocov:
35
37
  end
36
38
  end
37
39
 
@@ -126,23 +128,33 @@ module SingaporeCPFCalculator
126
128
 
127
129
  # TC Rate 1 is
128
130
  def tc_rate_1
131
+ # :nocov:
129
132
  raise NotImplementedError, "sub classes needs to implement #tc_rate_1"
133
+ # :nocov:
130
134
  end
131
135
 
132
136
  def tc_rate_2
137
+ # :nocov:
133
138
  raise NotImplementedError, "sub classes needs to implement #tc_rate_2"
139
+ # :nocov:
134
140
  end
135
141
 
136
142
  def ec_rate
143
+ # :nocov:
137
144
  raise NotImplementedError, "sub classes needs to implement #ec_rate"
145
+ # :nocov:
138
146
  end
139
147
 
140
148
  def adjustment_rate
149
+ # :nocov:
141
150
  raise NotImplementedError, "sub classes needs to implement #adjustment_rate"
151
+ # :nocov:
142
152
  end
143
153
 
144
154
  def capped_ordinary_wages
155
+ # :nocov:
145
156
  raise NotImplementedError, "sub classes needs to implement #capped_ordinary_wages"
157
+ # :nocov:
146
158
  end
147
159
 
148
160
  # precision helper
@@ -0,0 +1,13 @@
1
+ module SingaporeCPFCalculator
2
+ module Requirements
3
+ module GroupAbove65To70Years
4
+
5
+ private
6
+
7
+ def required_age_group
8
+ :group_above_65_to_70_years
9
+ end
10
+
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,13 @@
1
+ module SingaporeCPFCalculator
2
+ module Requirements
3
+ module GroupAbove70Years
4
+
5
+ private
6
+
7
+ def required_age_group
8
+ :group_above_70_years
9
+ end
10
+
11
+ end
12
+ end
13
+ end
@@ -8,4 +8,7 @@ require_relative "requirements/group_55_years_and_below"
8
8
  require_relative "requirements/group_above_50_to_55_years"
9
9
  require_relative "requirements/group_above_55_to_60_years"
10
10
  require_relative "requirements/group_above_60_to_65_years"
11
+ require_relative "requirements/group_above_65_to_70_years"
11
12
  require_relative "requirements/group_above_65_years"
13
+ require_relative "requirements/group_above_70_years"
14
+
@@ -5,7 +5,11 @@ module SingaporeCPFCalculator
5
5
  # @param [Date] birthdate
6
6
  # @return [#calculator] returns the CPF calculator that matches the age.
7
7
  def calculator_for(date, birthdate:)
8
- calculators.find { |calculator| calculator.applies_to? date, birthdate: birthdate }
8
+ calculators.find { |calculator| calculator.applies_to? date, birthdate: birthdate, has_70_up: has_70_up }
9
+ end
10
+
11
+ def has_70_up
12
+ false
9
13
  end
10
14
 
11
15
  end
@@ -1,3 +1,3 @@
1
1
  module SingaporeCPFCalculator
2
- VERSION = "1.3.4"
2
+ VERSION = "1.5.0"
3
3
  end
@@ -14,9 +14,9 @@ module SingaporeCPFCalculator
14
14
  include YearCommon
15
15
 
16
16
  # @param [Date] date when the CPF contribution is to be calculated for.
17
- # @return [true, false] true when the date's year is 2015
17
+ # @return [true, false] true when the date's year is within 2016~2022
18
18
  def applies_to?(date)
19
- date.year >= 2016
19
+ date.year >= 2016 && date.year < 2022
20
20
  end
21
21
 
22
22
  private
@@ -0,0 +1,8 @@
1
+ module SingaporeCPFCalculator
2
+ module Year2022
3
+ module CitizenOrSPR3
4
+ class Age55BelowContributionCalculator < Year2016::CitizenOrSPR3::Age55BelowContributionCalculator
5
+ end
6
+ end
7
+ end
8
+ end