feature_map 1.2.7 → 1.2.9

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: 00c14ab0325750314e2ba3d4106396c2cf8eaa9e66677ad35a90db4d264119b2
4
- data.tar.gz: 99907c175bdd0a1b2e6e45f43ee7f4bf05c4a79e451d8d7908f18cceb2af1e76
3
+ metadata.gz: 43f73244677d8ad52995b906e493ca43dfcef13e02d4a13809035c4a5d66f014
4
+ data.tar.gz: 5c70b9958b9c9395bccffb131b99c28e8ce4da44e44952023d437a058bc838d1
5
5
  SHA512:
6
- metadata.gz: 663ed0b8debf95d4af7cc2248834a2333979dd3f1c6f9a7ef6be4e41370a126b69653c19b8374e3472d10a6a5dc862bb10bdf3647ca2ab50f966aa250f9a2148
7
- data.tar.gz: 22ad967c5af673d779a851a0422852d543eb5d0e811a862ca2c078677578189acaeb97d7d3470952d949448547bad2ae87c2ddae96e6d7c4d909e2475311f631
6
+ metadata.gz: 3adfa483a5177ab7278a550f6c61e52d6843738d56ca827253f2113e0b41a4441f81f65a0af5392debffded48e60bc931e6b3e3102a8e8adfe5c008b35b313f5
7
+ data.tar.gz: 0af4417ca1f681c9d81b26b63ced53a0e04da8585c8369bd2c5e28e3a9e79fd0ab5d8e8f3182f329b66b0d9fcc52f0f8a7ccaccf21cacf13569a10abf15d2600
@@ -31,10 +31,10 @@ module FeatureMap
31
31
  .glob(File.join('**/', FEATURE_DIRECTORY_ASSIGNMENT_FILE_NAME))
32
32
  .map(&:cleanpath)
33
33
  .each_with_object({}) do |pathname, res|
34
- feature = feature_for_directory_assignment_file(pathname)
35
- glob = glob_for_directory_assignment_file(pathname)
36
- res[glob] = feature
37
- end
34
+ feature = feature_for_directory_assignment_file(pathname)
35
+ glob = glob_for_directory_assignment_file(pathname)
36
+ res[glob] = feature
37
+ end
38
38
  end
39
39
 
40
40
  def description
@@ -10,7 +10,7 @@ module FeatureMap
10
10
  @@map_files_to_features = {} # rubocop:disable Style/ClassVars
11
11
 
12
12
  def map_files_to_features(files)
13
- return @@map_files_to_features if @@map_files_to_features&.keys && @@map_files_to_features.keys.count.positive?
13
+ return @@map_files_to_features if @@map_files_to_features&.any?
14
14
 
15
15
  @@map_files_to_features = CodeFeatures.all.each_with_object({}) do |feature, map| # rubocop:disable Style/ClassVars
16
16
  # NOTE: The FeatureDefinitionAssignment naively assumes that all
@@ -11,7 +11,7 @@ module FeatureMap
11
11
  @@map_files_to_features = {} # rubocop:disable Style/ClassVars
12
12
 
13
13
  def map_files_to_features(files)
14
- return @@map_files_to_features if @@map_files_to_features&.keys && @@map_files_to_features.keys.count.positive?
14
+ return @@map_files_to_features if @@map_files_to_features&.any?
15
15
 
16
16
  @@map_files_to_features = FeatureMap::CodeFeatures.all.each_with_object({}) do |feature, map| # rubocop:disable Style/ClassVars
17
17
  FeaturePlugins::Assignment.for(feature).assigned_globs.each do |glob|
@@ -1,8 +1,6 @@
1
1
  # @feature Metrics Calculation
2
2
  # frozen_string_literal: true
3
3
 
4
- require 'parser/current'
5
-
6
4
  module FeatureMap
7
5
  module Private
8
6
  class CyclomaticComplexityCalculator
@@ -17,6 +15,10 @@ module FeatureMap
17
15
  end
18
16
 
19
17
  def calculate
18
+ # Lazy load the parser gem only when we need to process AST nodes to avoid introducing unnecessary
19
+ # dependencies for use cases that do not exercise this functionality.
20
+ require 'parser/current'
21
+
20
22
  process(@ast)
21
23
  @complexity
22
24
  end