rubocop-openproject 0.7.0 → 0.7.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b6399b37d75f31159de26fc061439ab6107f3621da14770ab2e3f4a263e4748e
4
- data.tar.gz: c0bc045863a214c19a10fe29e4b23edd6d60f3598158f665fdfb4fefba851946
3
+ metadata.gz: ddc09cf55b857f7ce9d1f944be04ad89fca8733ed2ee571e7a21e61ee0b93531
4
+ data.tar.gz: 597940571a0def133a1e4c22ba02fc5f277b4e69b43e72be0ae8e63ad2b3959b
5
5
  SHA512:
6
- metadata.gz: 5089a09294d79954f16b4fe511fd6b3aabe57b9272ebf41fa4a376feb7a6fcf8c2872b072fd6e3c7eb8493484e0e5b3eb2dc88f2bbfb964fa5fb67f0cdd8e5d8
7
- data.tar.gz: 46759bc28c398aeefb4fb18305dd9494056a5296a859bb7789d4c37548b785a935a254f0cfcc98442cccceeb70fc5a788113316b3c58707dc0172506ab6462e0
6
+ metadata.gz: 7b4b3c182974ae3030781217c2a1c37abdff29b21398a1b9644806c36d55b81ec6ec1d22af6d7e44dead45a5ce3950d394a73ab361d15c15834562a67a443296
7
+ data.tar.gz: cefcaa216a26645a8ca75e6caedae544462cd411bd5b298d0d80b24e0502680075c5bf3ad4bf4b8e3e8d3054ab416c14408b87af9a841eb3950656e488ef3aef
data/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # rubocop-openproject
2
2
 
3
+ ## 0.7.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 2e41102: Widen `OpenProject/UseEffectiveTypeForConfiguration` to catch safe navigation and the derived
8
+ pattern readers. The cop only defined `on_send`, so `represented.type&.attribute_groups` parsed
9
+ as a `csend` and slipped through entirely — which is how the whole work package schema
10
+ representer read its form configuration off the root while the cop was enabled. Both sides of
11
+ the call are now matched as `send` or `csend`. `enabled_patterns` and
12
+ `replacement_pattern_defined_for?` join `CONFIGURATION_METHODS`: both resolve through
13
+ `patterns`, which a variant can own independently, so they are as variant-specific as the
14
+ aspect readers already listed.
15
+
16
+ Expect new offenses in consumers wherever a configuration aspect was read off `type` with `&.`.
17
+
3
18
  ## 0.7.0
4
19
 
5
20
  ### Minor Changes
@@ -34,6 +34,10 @@ module RuboCop
34
34
  # # bad — inside WorkPackage itself
35
35
  # type.statuses(include_default: true)
36
36
  #
37
+ # # bad — safe navigation on either side reads the root just the same
38
+ # represented.type&.attribute_groups
39
+ # model&.type.enabled_patterns
40
+ #
37
41
  # # good
38
42
  # work_package.effective_type.attribute_groups
39
43
  #
@@ -51,7 +55,9 @@ module RuboCop
51
55
  "the family's root, so this ignores the variant the project resolves to."
52
56
 
53
57
  # Configuration aspects, per Type::ConfigurationLink::ASPECTS and the readers
54
- # Type::ConfigurationLinkable resolves through the link chain.
58
+ # Type::ConfigurationLinkable resolves through the link chain, plus the derived readers
59
+ # that sit on top of one — `enabled_patterns` and `replacement_pattern_defined_for?`
60
+ # both resolve through `patterns` and are just as variant-specific.
55
61
  CONFIGURATION_METHODS = %i[
56
62
  artefact_export_enabled?
57
63
  artefact_export_mode
@@ -59,18 +65,22 @@ module RuboCop
59
65
  custom_field_ids
60
66
  custom_fields
61
67
  description
68
+ enabled_patterns
62
69
  export_templates_disabled
63
70
  export_templates_order
64
71
  patterns
65
72
  project_custom_field_type_mappings
73
+ replacement_pattern_defined_for?
66
74
  statuses
67
75
  workflows
68
76
  ].freeze
69
77
 
70
78
  RESTRICT_ON_SEND = CONFIGURATION_METHODS
71
79
 
80
+ # Both node types on both sides: `type&.attribute_groups` reads the root exactly like
81
+ # `type.attribute_groups` does, and the mistake is written with `&.` at least as often.
72
82
  def_node_matcher :type_call?, <<~PATTERN
73
- (send _ :type)
83
+ ({send csend} _ :type)
74
84
  PATTERN
75
85
 
76
86
  def on_send(node)
@@ -78,6 +88,7 @@ module RuboCop
78
88
 
79
89
  add_offense(node)
80
90
  end
91
+ alias on_csend on_send
81
92
  end
82
93
  end
83
94
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module RuboCop
4
4
  module OpenProject
5
- VERSION = "0.7.0"
5
+ VERSION = "0.7.1"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubocop-openproject
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - OpenProject GmbH